{
  "id": 14598392,
  "title": "What the Claude Agent SDK's query() Streams: Every Message, Logged",
  "url": "https://urgent.news/2026/10/15/what-the-claude-agent-sdks-query-streams-every-message-logged",
  "topic": "ai",
  "section": "AI",
  "published": "2026-10-15T03:04:11.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/gabrielanhaia/what-the-claude-agent-sdks-query-streams-every-message-logged-id4"
  },
  "original_language": "en",
  "account": "When using the Claude Agent SDK's query() function, every message produced during the interaction is streamed, including those that are logged. This is in contrast to a normal run that might take only a few seconds and return a result with a low cost. However, if the execution takes longer, or if the cost is higher than expected, there is no record of the events that occurred in between. The TypeScript reference for the Claude Agent SDK lists 36 different members in the SDKMessage union that query() can return. The five most important types mentioned by Anthropic's agent loop guide are the system init message, assistant messages, user messages, stream events, and the result. Other observability events, such as rate-limit status and task notifications, are also recorded. The order and fields of these messages can be found in Anthropic's documentation for the current SDK version (v0.3.296 at the time of writing). To demonstrate the streaming behavior, a simple agent with a single tool is created and installed. The tool is a function that looks up order status in a Map, returning an error for unknown IDs. The server is created using createSdkMcpServer, with the tool registered and the name of the server becoming part of the tool's full name.",
  "summary": "Book: AI That Acts The series: AI in TypeScript — 5 books, from your first LLM call to agents in production — all five here My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools Me: xgabriel.com | GitHub You wire up query() , wait for the message with type === \"result\" , print message.result , and ship it. Then a run takes four minutes instead…",
  "key_points": [
    "Claude Agent SDK's query() streams every message, including logged ones",
    "36 members in SDKMessage union returned by query()",
    "System init, assistant, user messages, stream events, and result are key types"
  ],
  "editors_take": "Streaming every message through the query function provides developers with essential observability into long-running or expensive agent executions that would otherwise lack a detailed record of intermediate events.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}