a2aproject / a2aproject/a2a-inspector
[Bug]: Streaming chat fails with "received a streamed Message from the server after first response" (a2a-sdk 0.3.10)
- Lenguaje dominante
- TypeScript
- Estrellas
- 490
- Forks
- 152
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
### 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`)
Guía de contribución
Línea de trabajo
The issue is in backend/app.py where ClientConfig is created. First, examine the pyproject.toml and uv.lock files to understand the current a2a-sdk version (0.3.10). The fix involves updating the dependency to a newer version (v1.x) that removes the strict check. Check the a2a-sdk changelog and update the lockfile. Then, verify that the backend imports and the streaming functionality still work correctly with the new SDK version. Run the reproduction steps to confirm the fix.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python, typescript
- Área
- api, backend
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Tranquilo
- Claridad
- Bien especificado
- Aptitud para principiantes
- 65/100