a2aproject / a2aproject/a2a-inspector
[Bug]: Streaming chat fails with "received a streamed Message from the server after first response" (a2a-sdk 0.3.10)
- Lingua principale
- TypeScript
- Stelle
- 490
- Fork
- 152
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
### What happened?
Sending a chat message to an A2A agent whose card advertises `streaming: true` fails with:
```
Failed to send message: Invalid state error: received a streamed Message from the server after first response; this is not supported
```
The Inspector backend catches the exception and surfaces it to the chat UI.
### Reproduction
1. `docker run -d -p 8080:8080 ` (pinned `a2a-sdk==0.3.10` via `uv.lock`).
2. Connect to an agent card with `capabilities.streaming=true` and `url=.../message:stream` (e.g. an **Agno AgentOS** server exposing `/a2a/agents/{id}/.well-known/agent-card.json`, whose `message:stream` SSE returns a `Task` event followed by a `Message`).
3. Send "Hello" in the chat.
### Expected
The agent's streamed response is displayed.
### Actual
`A2AClientInvalidStateError` is raised; no response shown.
### Root cause
`backend/app.py` creates `ClientConfig` without `streaming=False`, so the client uses streaming. The pinned `a2a-sdk` v0.3.10 raises the error in `src/a2a/client/base_client.py:108-111` when a `Message` appears after the first event in a Task-based stream — it only allows either a single `Message` response or a pure Task-update stream (no trailing `Message`):
```python
async def _process_response(self, tracker, event):
if isinstance(event, Message):
raise A2AClientInvalidStateError(
'received a streamed Message from server after first response; this is not supported')
```
This strict check was removed in the refactored `send_message` of `a2a-sdk` `main`/v1.x (no `A2AClientInvalidStateError`), so newer SDK no longer fails on `Task`→`Message` streams.
`uv.lock` pins `a2a-sdk==0.3.10` (https://github.com/a2aproject/a2a-inspector/blob/main/uv.lock#L87), so the official image is affected.
### Workaround
Add `streaming=False` to the `ClientConfig` in `backend/app.py` to use `message/send` (non-streaming). Loses live streaming but unblocks chat/inspection. Server must expose `message:send` (Agno AgentOS does).
### Suggested fix
- Bump `a2a-sdk` to the latest (v1.x) in `pyproject.toml`/`uv.lock` and re-verify backend imports, **or**
- Expose a UI/config toggle to disable streaming, and/or relax handling of `Message` after Task events.
### Environment
- Inspector: latest `main`, `a2a-sdk==0.3.10`
- Agent server: Agno AgentOS (A2A JSON-RPC transport, `streaming: true`)
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.