One serve api session and one streamed run
Four lifelines: curl on the host, docker-agent serve api on 127.0.0.1:8080 serving pong.yaml, the session database work/api-session.db, and the cassette 23-api that --fake replays in place of ai/qwen3:4b. curl lists the agents and gets pong, creates a session with an empty body, and posts the message ping to /api/sessions/<uuid>/agent/pong with Accept text/event-stream. The server streams team_info, toolset_info, user_message, and stream_started, makes one chat completion that the cassette answers with pong, then streams agent_choice, message_added, token_usage, and stream_stopped. A last GET reads the stored session with both messages.
curl
serve api :8080
api-session.db
cassette 23-api
1
GET /api/agents
2
name: pong, multi: false
3
POST /api/sessions {}
4
session <uuid>
5
200, id <uuid>
tools_approved: false
6
POST /api/sessions/<uuid>/agent/pong
messages: user ping
7
team_info, toolset_info, user_message
8
stream_started
9
chat completion, dmr/ai/qwen3:4b
--fake replays the recorded answer
10
pong, finish_reason stop
11
agent_choice: pong
12
message_added, token_usage
13
stream_stopped, reason normal
14
GET /api/sessions/<uuid>
15
messages: ping, pong
with reasoning_content