Skip to main content
Deploy agents with A2U (Agent-to-User) event streaming for real-time agent-to-user communication.

CLI

Expected Output:

Python

Expected Output:

A2U Endpoints

Event Types

Subscribe to Events

Subscribe Response:

Emit Events from Agent

publish_sync and tracked delivery

Behavior changed in v4.6.162.
A2UEventBus.publish_sync(event) returns immediately with a tracked asyncio.Task. The module keeps a WeakSet of live tasks so the event loop can’t garbage-collect one mid-flight, and each task’s done-callback surfaces exceptions that were previously swallowed silently. Use A2UEventBus.last_publish_task() to await the most recent scheduled publish — for example in tests, or when you need the real delivered subscriber count. The task’s result is the delivered count. publish_sync checks asyncio.get_running_loop(). Inside a running loop it schedules the tracked task and returns the number of targeted subscribers; last_publish_task() then exposes the delivered count. Outside a running loop it blocks and returns the actual delivered count via the async bridge — but last_publish_task() stays None, so only await it from an async context. The related push/client.py future creation and acp/server.py asyncio.to_thread calls likewise use get_running_loop() instead of the deprecated asyncio.get_event_loop().

SSE Event Format

Python Client

CLI Options

Security & Limits

The A2U server fails closed on non-loopback binds without a token and caps subscriptions and per-subscription queues.

Fail-closed authentication

Loopback binds (127.0.0.1, ::1, localhost, empty) still allow unauthenticated traffic for local development. Every other bind without A2U_AUTH_TOKEN set returns 503:
This matches the call-server security contract in Gateway Bind-Aware Auth.

Environment variables

Both _MAX_SUBS and _QUEUE_MAX fall back to their defaults on non-positive or unparseable env values, which prevents asyncio.Queue(maxsize<=0) from becoming silently unbounded.

Subscription and queue caps

When the subscription cap is reached, subscribe routes return 429:
When a subscription’s queue is full, publish_sync drops the event (put_nowaitasyncio.QueueFull) and logs:

HTTP responses

Troubleshooting