본문으로 건너뛰기
cccskills
무료GitHub에 공개

write-egma-tests

Write or edit tests for a voice agent that can run on the Egma platform.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(2)

  • SKILL.md10.4 KB
  • agents/openai.yaml301 B

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

First off, check if there's a newer version of this skill

Use npx skills update write-voice-agent-tests to update the project/global version of this skill installed on the developer's machine.

Writing tests for voice agents that can run on the Egma platform

An Egma Test describes one situation that a voice agent should handle and the expected behaviors that should hold during that situation. Tests are grouped inside Suites. Each Test runs once for every Persona named in it.

A Suite and its Tests do not store the Agent or Connection they run against. The Agent and Connection are selected later when starting a Run.

Currently, Egma supports these voice agents platforms - retell, livekit-agents (python/ js) framework & pipecat (python).

We need to do three things to create good tests:

  1. Find or create the Suite that should hold the Tests.
  2. Understand the voice agent and create appropriate tests for it.
  3. Write test files and push them to Egma.

1. Find or create the Suite

  1. First off, check whether egma/config.yaml exists.
  • If it does not exist, run egma init. This initializes the repository and pulls its current Egma state.
  • If it already exists, run egma pull before deciding whether a Suite needs to be created.
  1. Every direct directory under egma/tests/ is one Suite. Its suite.yaml file holds the Suite ID and display name.
  • If the correct Suite already exists, use it.
  • If a new Suite is needed, create it through the CLI: egma suite create appointment-booking --name "Appointment booking"

2. Understand the voice agent and decide the tests

This is one of the most crucial step. Here you should read the voice agent’s prompt, tools, the overall harness that makes this voice agent behave the way it does (example multiple subagents, context strategies, etc) and any crucial metadata the voice agent should have before a production session startup path before writing Tests such as organisation name, tenant ID, locale, or agent configuration.

Important concepts to know before writing them:

A. One Test is one situation

  • Write the Scenario as a situation that a real human might find themselves in while speaking with the voice agent being tested.
  • Each Test should cover one clear situation. For example, “call the recepionist to book an appointment at medspa "ABC" but ask for a specific provider "XYZ" and be flexible around dates but you don't know which treatment is right for your skin and so first you'd like to discuss some options but you're someone who's not very decisive". Replace with actual values that you infer from calling the tools attached to this voice agent.

B. Each scenario has one or more personas

  • A persona is just a digital human who is enacting the scenario. Different personas have different characteristics. Creating new personas is out of scope for this skill but use one of the default personas. you can run egma persona list find the available persona names/ their IDs. If several personas could be appropriate, choose one or two most appropriate by default.

C. Expected behaviors

  • An expected behavior is simply a lens through which an LLM based grader should look at the entire transcript of a simulation and determine whether that expected behavior is actually observed or not. Each expected behavior should be a binary 0/1 decision for the LLM grader. This of an expected behavior like an assertion in classical testing.
  • Each behavior should make one clear claim. What these behaviors should be must be grounded in the voice agent’s actual prompt, harness, tools, and the product requirements to the best of your knowledge.
  • Usually aim to write around three or four expected behaviors for one Test. Split unrelated requirements into separate Tests.

D. Mock tools

  • You can add mock tools to a test when you don't want real writes to happen or want to use a controlled backend state. Egma supplies mock tools to the vocie agent of supported platforms and leaves any tools whose mocks were not supplied as it is. For example, you might want to read real availability slots / provider info for a appointment booking voice agent but don't want to create fake appointments in prodution CRM systems.
  • To create a mock tool, use the exact tool name supplied to the agent and the same response shape that the real tool returns. A Mock Tool contains exactly one of the following in its result json that will be supplied to the agent during simulation
    • answer for a successful result
    • error for a failed/erronous result
  • If egma tests are being written in this repo for the first time - err on the side of writing mocks for write tools. If the agent has only read tools, mock atleast one read tool. If the agent has no tools, you can skip writing mocks.
  • For livekit agents, you will need to setup the agent with egma sdk in order to use mock tools. egma has support for livekit-agents python and js/ts with dedicated sdks. Refer Egma livekit python package or Egma livekit js sdk for info on how to setup the agent code to listen for mock tools.
  • For pipecat bots, the egma sdk line await simulation(worker, runner_args) from egma.pipecat answers mock tools; see the Pipecat Python SDK guide. Mock any tool the bot's LLM can call, whether it was registered with register_function or given in the LLM context.
  • Never mock a Pipecat Flows function (a function whose handler comes from pipecat.flows). Egma does not mock Flows functions, and a simulation whose test mocks one fails when the flow first offers that function. Unmocked Flows functions run for real and are recorded, so write behaviors about them instead.

E. Session initiation data

  • Many agents need per-session context and certain dynamic variables supplied before they speak even a single word - such as an organisation name which they represent, tenant ID, or some other agent configuration needed for the agent to do its job properly in production. Egma provides a way to supply this data for each simulation so that it is as close to the agent's production behavior as possible.
  • To find what dynamic variables / job dispatch metadata/ inbound webhooks etc that the agent being tested depends on - carefully look at its code and setting. Inspect the agent’s entrypoint, the normal path it goes through before speaking anything and identify which variables need to be supplied in the simulation. Once you have the required session initiation metadata needed, you can use the ## Env section of each test to supply curated data that makes the most sense for that test.
  • For each of the supported agent platforms, egma has a specifc field in its env json that it supplies.
    • If the agent is based on retell - use retell_dynamic_variables in the env section to supply any inbound webhook and dynamic variables data used by the agent. Egma passes it as is to the retell agent as its dynamic variables.
    • If the agent is based on livekit, use a job_dispatch_metadata in the env section. for values the LiveKit agent reads from ctx.job.metadata. Make sure the code of the livekit agent is able to read the needed data from ctx.job.metadata. If the agent must detect whether its running in an Egma simulation, you can add a check when ctx.room.name starts with egma-sim-.
    • If the agent is based on pipecat, use pipecat_body_params in the env section for values the bot reads from runner_args.body (for example runner_args.body.get("tenant")). It is a JSON object and its values can be any JSON (not only strings). Egma merges it into the body of the start request it sends for each simulation, the same body a production client sends, so the bot reads it exactly as in production.
      • The key egma inside pipecat_body_params is reserved: Egma adds its own egma key to every start request, and a test that holds one is refused on egma push. Name the key something else.
      • The object can be at most 512 KiB once serialized. Put a large value in the developer's own store and pass its id instead.
      • Do not use the egma key to detect a simulation in the bot; the egma SDK handles it.
  • Finally, use realistic, non-secret values to pass in the env section. Ask the developer only when a required value cannot be found or safely inferred. Use the default test orgs that usually the developer uses while iterating on the voice agent themselves.

3. Write the Test files and push them

You can now actually start writing the tests. A test can be created by simply creating a new md file in a suite directory. Once all tests are created, push them to the platform using egma push.

A test file should look like this:

---
format: 5
name: booking-happy-path
description: The caller wants to book an available appointment.
personas:
  - name: Everyday person
---

## Scenario

Call the recepionist to book an appointment at medspa "ABC" but ask for a specific provider "XYZ" and be flexible around dates but you don't know which treatment is right for your skin and so first you'd like to discuss some options but you're someone who's not very decisive.

## Expected behaviors

1. The agent walks the patient through avaialble options. It calls get_available_treatments tool before  quoting any treatments and does not hallucinate anything that wasn't provided by the tool call.
2. The agent calls check_providers tool before suggesting a provider. 
3. The agent calls the check_availability tool to get the appointment slots. it passes the right provider_id which the patient selected and offer slots in the default 7 day window. 

## Mock tools

### check_availability

```json
{
  "answer": {
    "slots": [
      "Wednesday 15:00",
      "Wednesday 16:30"
    ]
  }
}
```

## Env

```json
{
  "retell_dynamic_variables": {
    "clinic_name": "Youth Medspa, Walnut Creek branch",
    "assistant_name": "Emily"
  },
  "job_dispatch_metadata": {
    "clinic_name": "Youth Medspa, Walnut Creek branch",
    "assistant_name": "Emily"
  },
  "pipecat_body_params": {
    "clinic_name": "Youth Medspa, Walnut Creek branch",
    "assistant_name": "Emily"
  }
}
```

The above example shows retell_dynamic_variables, job_dispatch_metadata & pipecat_body_params only for reference. In reality, you should only supply the field corresponding to the platform the agent is built on.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

ask-matt

무료

Ask which skill or flow fits your situation. A router over the skills in this repo.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

egma-ai/egma1452026년 9월 30일 업데이트

bro

무료

Re-explain the previous assistant message in a much simpler way — for when the reply made you go 'bro what'. Use /bro to get a plain-language version of the last answer.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

egma-ai/egma1452026년 9월 30일 업데이트

Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes — Standards (does the code follow this repo's documented coding standards?) and Spec (does the code match what the originating issue/spec asked for?). Runs both reviews in parallel sub-agents and reports them side by side. Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to "review since X".

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

egma-ai/egma1452026년 9월 30일 업데이트

Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

egma-ai/egma1452026년 9월 30일 업데이트

Drive one ticketed effort through parallel implementation, independent review, serial integration, and one open pull request.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

egma-ai/egma1452026년 9월 30일 업데이트

Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

egma-ai/egma1452026년 9월 30일 업데이트

egma-ai의 스킬 모두 보기

이 스킬의 문제 신고