Mock Action Responses

Test how your agent handles every action outcome without calling real systems

Mock Action Responses let you choose what an action returns during testing. The agent gets the response you configure, so your real endpoint isn't called and no real transfer is placed. Use mocks to:

  • Test success, error, and timeout paths without changing your backend
  • Keep test calls from writing to production systems
  • Get repeatable results in Test Logic, Test Audio, and Simulations

Mocks are saved per agent variant and only apply in testing. Live calls always use the real action.

Set Up Mock Responses

Open a custom action or transfer action in Agent Builder and scroll to the Mock Responses section. Save the agent before you add mocks.

🚧

Mocks are linked to the action name. If you rename the action, its mocks are detached.

Custom Actions

Click Add mock and configure:

  • Mock name: A short label, e.g. Patient found or Lookup timeout
  • Response status: Whether Regal treats the call as a success or an action error
  • Response body: The JSON object the agent receives as the action result. Optional for errors.
StatusBehavior
200Success. The agent receives the response body.
400, 404, 500Action error
TimeoutNo response. The agent handles the call as timed out.
Other codeAny 3-digit code. Codes of 400 and above are treated as errors.
{
  "match": true,
  "patient_id": "P-10482",
  "plan": "Gold PPO"
}
{
  "match": false,
  "error": "patient_not_found"
}

Transfers

Internal and external transfers don't use JSON. Configure:

  • Mock name: e.g. No agents available
  • Result: Success or Failed
  • Message to agent (optional): What the agent receives as the result, e.g. The care team queue is unavailable. Offer to schedule a callback instead.

Choose a Default

Each action has one Default. Test Logic, Test Audio, and Simulations use it unless a test picks a different mock. To change it, click Make default on any mock.

Action typeDefault if none is set
Custom actionUnmocked: calls the action's real endpoint
TransferMocked Success: returns success without placing a real transfer

Test Logic and Test Audio

Manual tests use each action's default automatically. To use a different mock for a session:

  1. In Test Logic or Test Audio, click Variables & Actions.
  2. Under Action Mocks, open the Returns dropdown for the action.
  3. Pick the default or any mock under From Library, then click Save.

When the agent calls the action, the test transcript shows the Action Invocation followed by the mocked Action Result. Check that the agent's next reply handles that result correctly.

Test Cases and Simulations

Each test case can use its own mock for each action. This lets you cover several outcomes of the same scenario, such as a transfer that succeeds and one that fails.

  1. Create or edit a test case.
  2. Under Action Mocks, choose what each action returns. Leave it on Default to use the action's default.
  3. Save the test case and run the simulation.
📘

A mock chosen in the test case overrides the action's default.

The simulated transcript shows the mocked Action Result, so you can check the agent's behavior against the test's success criteria.

Have feedback? We'd love to hear from you - reach out to us with your thoughts!


Did this page help you?