A2A Mock Scenarios
Use A2A mock scenarios to return predictable task results from an Agent Card without running a real upstream agent. Scenarios are evaluated in order, and the first matching condition wins.
Add a scenario
- Open an Agent Card.
- Select A2A Mocking Service.
- Select Add Scenario.
- Enter a name and a condition against the incoming user message.
- Define the A2A result using the Form or JSON editor.
- Select Save on that scenario.
A new scenario expands automatically and scrolls into view. Its card is highlighted as Unsaved changes until it is saved. The Save button is disabled when the scenario matches its last saved version.
Select Cancel to discard a scenario’s unsaved changes and restore its last saved version. Canceling a new scenario that has never been saved removes that draft.
Scenario editing is explicit. A²D does not autosave A2A mock scenario changes.
If you reload the browser or use the page’s Back button with unsaved scenarios, A²D asks you to confirm before discarding the drafts.
Choose Form or JSON
The response editor has two modes:
- Form covers the common fields: task and context IDs, task state, text artifacts, and existing history text.
- JSON exposes the complete A2A result and supports custom metadata, non-text parts, and other protocol fields.
Switching from JSON to Form requires confirmation. The Form editor intentionally projects the response to the fields it supports, so custom metadata, non-text parts, and other JSON-only personalizations may be removed.
New scenarios open in JSON mode by default. Switch to Form for guided editing of common fields, or stay in JSON for full control over the returned payload.
Validate and save
When you select Save, A²D checks that the response:
- is valid JSON;
- contains a non-empty
contextId; - has a supported A2A task state;
- contains an
artifactsarray; - uses valid artifact IDs and content-bearing parts; and
- matches the Agent Card’s protocol shape.
A²D also prevents two saved scenarios from using the same condition. Change the field, operator, or value before saving a duplicate condition. For contains, values that differ only by letter case are treated as the same condition; for exists, the comparison value is ignored.
If the response uses the other protocol’s task shape, A²D normalizes it during save. For example, input-required becomes TASK_STATE_INPUT_REQUIRED for an A2A 1.0 card. A2A 1.0 task parts are also normalized to the unified part shape, while A2A 0.3.0 tasks use kind-tagged parts.
A status.message on the response — for an input-required task this is where the agent’s follow-up question belongs — is preserved and returned at runtime alongside artifacts, for both A2A 0.3.0 and 1.0. On a 1.0 card it is normalized to the unified message shape (ROLE_* role, no kind). Consumers that read status.message (rather than the artifact) see exactly what the scenario declares.
Validation failures appear directly below A2A result JSON, and the scenario is not persisted until the error is fixed.
Task status override
The Task status control is a scenario-level override. When set, it takes precedence over status.state in the response JSON at runtime. Leave it at From response JSON when the task state should come from the edited response.
Available task states are:
submittedworkingcompletedfailedcanceledrejectedinput-requiredauth-required
A²D emits the protocol-appropriate spelling when the mock endpoint handles a request. See A2A Protocol Versions for the wire-format differences.
Reorder or delete scenarios
Use the arrow controls to change scenario priority. Reordering marks the affected scenarios as unsaved. Saving either changed scenario persists the current ordering together with all previously saved scenario content; unsaved edits in other scenarios remain local.
Deleting a scenario always asks for confirmation. This prevents an accidental delete from immediately changing the mock endpoint.
Next Steps
Build protocol-aware mock responses with guided editing, full JSON control, and validation before they go live.