New in Rasa Pro 3.17Rasa can expose your assistant as a native Agent-to-Agent (A2A) sub-agent.
a2a_server block is present in endpoints.yml, rasa run registers A2A JSON-RPC routes on the same Sanic port as REST and channel webhooks.
External orchestrators discover your assistant’s capabilities via AgentCard, send turns over JSON-RPC, and receive A2A task lifecycle updates mapped from Rasa’s dialogue state.
This page documents the sub-agent (server) side. For Rasa as an orchestrator that calls external A2A agents, see External Sub Agent and Integrating External Agents via A2A.
Basic Configuration
Adda2a_server to your endpoints.yml file. Only description is required; other fields have sensible defaults.
Configuration Reference
Prerequisites
Rasa enforces two startup guardrails whena2a_server is configured. Both fail fast with actionable error messages.
Session configuration
When A2A is enabled,domain.session_config.start_session_after_expiry must be false.
Resumed orchestrator contextId values reuse the same Rasa sender_id. If start_session_after_expiry is true, Rasa runs action_session_start after inactivity and can silently reset slot state when the orchestrator resumes the same context.
This is validated when a model is loaded with a2a_server in endpoints.yml (for example during rasa run via load_agent). The error code is validation.a2a_server.incompatible_session_config.
domain.yml
ConversationInactive does not release an input_required A2A context. With start_session_after_expiry: false, the next message on the same contextId continues the flow after inactivity.
See Session Timer for full session configuration details.
Sanic workers
SANIC_WORKERS=1 is required until a persistent solution for storing A2A tasks and messages ships.
Multiple Sanic workers break messageId idempotency, in-flight HTTP 409 handling, orchestrator cancel, and max_contexts enforcement because these are per-worker only.
This is validated when starting the Sanic server (rasa run). The error code is validation.a2a_server.incompatible_sanic_workers.
Scale horizontally with additional replicas and load balancer sticky routing by contextId instead of increasing Sanic workers per pod.
Multi-replica load balancing
Whena2a_server is enabled and you run more than one Rasa replica, configure your ingress or load balancer so all A2A JSON-RPC traffic for a given contextId routes to the same pod.
A2A V1 keeps task state, messageId deduplication caches, in-flight turn queues, push notification callback registration, and max_contexts enforcement in memory on each replica. The shared tracker store (for example PostgreSQL) persists dialogue history, but A2A-specific state is not yet replicated across pods. Without sticky routing, follow-up turns on the same contextId may land on a different pod — the session can appear fresh, idempotency breaks, tasks/cancel may miss in-flight work, and push callbacks registered on one pod are invisible to others.
Requirements for multi-replica A2A:
When routing is configured correctly, orchestrator traffic for a given
contextId (or connection) consistently hits the same pod — in-memory stores, queues, deduplication, and push config all stay coherent.
Deriving the routing key
Your load balancer must resolve a sticky key fromcontextId on every A2A POST / request. Use at least one of these sources (in order of typical precedence):
Configure consistent hashing or equivalent session affinity on the resolved key — not round-robin alone.
Istio on Kubernetes
Apply two Istio resources when Rasa runs behind an Istio ingress with multiple replicas. IstioconsistentHash accepts one hash key per DestinationRule (header, cookie, source IP, or query parameter) — use a gateway EnvoyFilter to normalize contextId into a single internal header.
1. DestinationRule — consistent-hash on that header for the Rasa Service:
namespace: istio-system, selector istio: ingressgateway). Insert a Lua HTTP filter before envoy.filters.http.router that:
- Applies only to
POSTrequests on your assistant hostname (for exampleassistant.example.com). - Resolves
contextIdin order:"contextId"in the JSON body →X-A2A-Context-Idrequest header →a2a-context-idcookie. - Sets request header
x-a2a-context-idto the resolved value (the DestinationRule hash key). - Stores the value in Envoy dynamic metadata during the request phase.
- On response, emits
Set-Cookie: a2a-context-id=<contextId>; Path=/; Max-Age=3600; HttpOnly; SameSite=Laxso methods liketasks/cancelthat omit bodycontextIdstill route to the pod that handled prior turns.
kubectl apply. Adjust spec.host and the hostname guard in the Lua filter to match your release name, namespace, and ingress host.
Verify: With at least two replicas and SANIC_WORKERS=1, send two message/send turns with the same contextId — the second should continue the dialogue, not restart it. Confirm in pod logs that each contextId appears on one pod only. Exercise tasks/cancel with X-A2A-Context-Id or cookie persistence (curl -c / -b).
Other ingress and load balancers
On NGINX Ingress, AWS ALB, HAProxy, or other gateways, implement equivalent behavior:- Inspect
POST /JSON bodies for"contextId"where present. - Accept
X-A2A-Context-Idas a fallback for methods that only passtask_id. - Optionally set and honor an
a2a-context-idcookie for clients that do not sendcontextIdon every request. - Hash-route (or pin sessions) on that key to a single backend pod.
Orchestrator and HTTP client guidance
- Reuse the same
contextIdacross turns in a multi-step flow. - For
tasks/canceland similar calls that only passtask_idin the body, sendX-A2A-Context-Id: <contextId>or rely on cookie persistence through your ingress. - HTTP test clients should preserve cookies (
curl -c/-b) when exercising sticky ingress.
HTTP Surface
A2A routes are registered at the root of the Rasa server (no URL prefix).Context and task mapping
contextIdin A2A requests maps to Rasasender_id. One persistent Rasa conversation exists per orchestrator context.- Each orchestrator message gets a new
task_id. input_requiredkeeps the context reserved for follow-up turns on the samecontextId.
AgentCard Generation
Orchestrators discover your assistant’s capabilities through the public AgentCard.Auto-generated (default)
Whenagent_card_path is omitted, Rasa auto-generates the AgentCard from user-facing flows at server startup (after the model loads):
- Each user flow becomes an
AgentSkillwithid,name, anddescription(from the flow description or readable name). - Pattern/system flows (
pattern_*) are included only wheninclude_conversation_repair: true(the default). nameis taken fromassistant_idinconfig.yml, or defaults to"Rasa Agent".versionis derived from the loaded model filename (without.tar.gzsuffix), or frommodel_id, or defaults to"1.0.0".capabilities.streamingis alwaystrue.capabilities.push_notificationsreflectspush_notifications_enabled.
Static override
Setagent_card_path to load a static AgentCard JSON file. Rasa still overwrites the url field at startup with the resolved public URL from url or from --port / --interface / --ssl-certificate. The description field in endpoints.yml is ignored when a static card is used.
Refresh timing
Atrasa run startup:
- Before the model loads, a placeholder AgentCard is served (empty
skillsarray). - After the model loads, the flow-generated or static AgentCard replaces it.
PUT /model does not refresh the AgentCard or re-wire the A2A executor. Restart the server after deploying a new model to update advertised skills and version.
Task States and Structured Output
Rasa maps dialogue stack and tracker state to A2A task states:working, input_required, completed, failed, canceled, rejected, and auth_required.
Terminal and interactive-terminal updates include:
- A
DataPartwith structured state:state,active_flow, currentslots, and (when applicable) persisted slot values from flows that declarepersisted_slots. - A
TextPartcarrying the user-visible bot utterance when present, so clients that only readstatus.messagestill receive NLG.
message/stream emits working status and artifact deltas during token/chunk streaming custom actions. Blocking message/send returns the final task.
Orchestrator operations
tasks/cancel— idle cancel on aninput_requiredcontext, or signal in-flight work; publishescanceledand recordsFlowCancelledwhen a user flow was active.messageIddeduplication — retries with the same(contextId, messageId)replay the cached terminal task without re-running the turn. A concurrent duplicate while in flight returns HTTP 409 with a JSON-RPC error (retry after the first completes).
Orchestrator Slot Pre-seeding
On everymessage/send / message/stream turn, Rasa reads slot context from the incoming A2A Message, applies it as SetSlotCommands before dialogue processing, and strips slot markers from the user text so they are not passed to the LLM.
Orchestrators can supply slots in any of these shapes. Later sources override earlier ones on key conflicts within the payload:
- Text transcript (lowest precedence) — append to the text part:
SLOTS: {"slot_name": "value", ...}on its own line, or- a trailing fenced block:
```json\n{"slot_name": "value"}\n```
message.metadata—{"slots": {"slot_name": "value", ...}}(merged with JSON-RPC request metadata).DataPart(highest precedence) —{"kind": "data", "data": {"slots": {"slot_name": "value", ...}}}.
"none", "null", and "undefined" are stored as null.
Per-turn precedence: if command generation extracts a SetSlotCommand for a slot from the current user message, that value wins over orchestrator metadata for the same slot on that turn. Orchestrator values still pre-fill slots the parser did not set.
Send an orchestrator slot snapshot on each follow-up message for slots the user did not answer in that turn.
Do not rely on user-visible text alone to carry slot values when a collect step is active — prefer metadata.slots or a DataPart, or keep slot JSON out of text the user is answering with.
Authentication
Whena2a_server.auth is set, every protected request must include Authorization: Bearer <jwt>.
Missing or invalid tokens receive HTTP 401 with a WWW-Authenticate: Bearer response header before message processing starts.
This applies to the JSON-RPC endpoint (POST /) and AgentCard discovery (GET /.well-known/agent-card.json, including the deprecated alias).
If auth is omitted, behaviour is unchanged and no token is required.
Only type: bearer is supported (API key auth is not available).
Auth validates the orchestrator only; end-user identity belongs in A2A message metadata or slot pre-population, not in this JWT.
JWT configuration
- Production (RS256)
- Local dev (HS256)
message/send, message/stream, or other A2A JSON-RPC methods.
Push Notifications
Push notifications are disabled by default (push_notifications_enabled: false) because callback URLs are client-controlled and can be an SSRF vector when the A2A endpoint is reachable by untrusted callers.
Enabling push notifications
Setpush_notifications_enabled: true in endpoints.yml to advertise the capability in the AgentCard and allow orchestrators to register callback URLs:
- An orchestrator supplies a
pushNotificationConfig.urlonmessage/send,message/stream, or viatasks/pushNotificationConfig/set. - Rasa POSTs task state updates to that callback as the task progresses.
message/streamemits intermediate states (submitted,working) as well as the terminal state.- The public AgentCard advertises the
push_notificationscapability. - Rasa also POSTs the terminal
canceledtask when a callback URL is registered, because the a2a-sdk suppliedon_cancel_taskdoes not send push notifications.
Redirects are disabledRasa disables HTTP redirect following on every outbound push notification POST.
URL policy is enforced only on the registered callback URL — redirect targets are not re-validated.What happens today: if the callback responds with a 3xx redirect (for example
302 with a Location header), httpx does not follow it.
Rasa treats the delivery as failed (non-2xx response), logs the error, and does not retry.
The A2A task itself still completes normally — a failed push does not change the task outcome returned to the orchestrator over JSON-RPC or SSE.
Only a single POST is sent to the registered URL; no second request is made to the redirect target.Why redirects are disabled: if Rasa followed redirects, an orchestrator could register a callback URL that passes policy checks (public hostname, global IP), then respond with Location: http://127.0.0.1/... or another internal address.
Rasa would POST task state — including structured slot data — to that internal target without running URL policy on the redirect destination.
That is a classic server-side request forgery (SSRF) vector when the A2A endpoint is reachable by untrusted callers.Register the final callback URL directly.
If the callback endpoint moves, update the registered pushNotificationConfig.url on the orchestrator side.URL validation
Callback URLs are validated on registration and before each POST:- Only
http/httpsURLs with a hostname are accepted. - Loopback, link-local, and private-network targets are rejected (including hostnames that resolve to those addresses via DNS).
- URLs with embedded credentials are rejected.
- HTTP redirects are not followed on outbound push POSTs (see note above).
- Outbound push POSTs use an explicit httpx timeout (5s connect, 30s overall).
- DNS checks are bounded by a 5s application timeout.
push_notification_allowed_hosts (exact hostname or subdomain match).
Rejected URLs surface as InvalidParamsError on the JSON-RPC methods that register them.
TLS
A2A shares the same port as REST, channels, and other Sanic routes. Configure HTTPS with the usualrasa run flags — not under a2a_server in endpoints.yml. A legacy tls block in endpoints.yml is rejected at startup.
Rasa serves HTTPS directly
Clients connect to Rasa over TLS using your certificate and key (the same cert covers REST, channels, and A2A):url is omitted, the AgentCard URL scheme follows --ssl-certificate. Set an explicit url: "https://..." when the public hostname or port differs from the local bind address.
HTTPS handled by a reverse proxy or ingress
Seturl to the public base URL orchestrators use. Rasa can listen on plain HTTP behind the proxy while the AgentCard advertises HTTPS:
Monitoring and Troubleshooting
Health checks
Key log events
Rasa emits structured log events prefixed witha2a_server.:
Common failure modes
Complete Example
Out of Scope
Multi-worker A2A support (persistent task and message stores) is planned for a future release. Until then, useSANIC_WORKERS=1 per replica.