Add an answer
After## Expected behaviors, add ## Mock tools. Use the exact tool name as
the subheading and put the tool’s normal result inside answer:
answer can contain any JSON value that matches the tool’s real response
shape. The mock returns the same configured result each time that named tool
is called in the simulation.
The mock does not check the tool’s arguments. Add an expected behavior if you
need to check that the agent used the right caller, provider, date, or other
arguments.
Test a failure
Useerror with a string to make the tool fail:
answer or error. Do not add
delay, status, or matching rules to the envelope.
Use a connection that supports mocks
Retell phone calls do not apply these mock answers. Use text mode or a web call
when your Retell test depends on mocks.
For LiveKit, the
simulation helper is required even when a test has no mocks.
It sends the agent’s spans, reports its tools, and applies the running test’s
mock answers. Set EGMA_URL and EGMA_API_KEY in the worker environment.
If the setup exchange fails, the helper raises NotReported and the agent
session does not start. The monitor helper is for production conversations;
it does not enable simulations.
Check the result
Runegma push, then start a run. Open the
simulation’s transcript and inspect the tool call, its arguments, and its
result. The agent’s trace records both real and mocked tool calls. Calls
answered by the test’s mocks are marked mocked. The transcript prefers the
agent’s tool evidence when it is available.
A misspelled mock name does not match a tool. It creates no tool call or warning,
and the correctly named tool can still run its real implementation.
If a real backend was called, check the exact tool name, connection type, and
LiveKit setup. If the agent reacts incorrectly to the answer, compare
the mock’s response shape with the tool’s actual contract.