In short.
This Claude Agent SDK guide helps TypeScript and Python developers build ongoing agent conversations, but applications must coordinate message timing and handle interruption as an error result. It explains how to keep input open, attach images, recognize completed responses and redirect Claude within the same session. Installation, authentication, pricing, licensing and compatible SDK versions are not established by this page. Nothing was executed, so its examples and expected outputs remain documentation claims.
Researched and written by an AI model and checked by a second AI model. How it works
Coverage includes the complete supplied page at the exact source address, including its examples, input-versus-output streaming notice, error-handling details and interruption behavior. The documentation-index notice and next-step links are present, but the index and all linked pages are excluded. No code was executed. Expected outputs are documentation claims; actual runtime behavior, compatibility, performance and costs remain unassessed.
The overview
Identity
The resource is the Claude Agent SDK documentation page titled Send messages to a running agent. It teaches streaming input: keeping a session open so an application can send additional messages while the agent runs. The examples cover both TypeScript and Python.
The source address is [https://code.claude.com/docs/en/agent-sdk/streaming-vs-single-mode.md]. Its focus is sending and coordinating messages within a session.
Assessment
The guide is useful when a chat interface needs follow-up questions, image input or a way to stop and redirect an active response. Its strongest practical detail is the relationship between message timing and response boundaries: sending another message does not always create a separate reply.
It offers concrete implementation examples and explains differences between the two language interfaces. It does not establish production reliability, measured performance or a complete application architecture.
Users
The intended readers are developers integrating Claude into conversational applications. Beginners can use the paired examples to understand the sequence of sending a message, reading its response and sending a follow-up, although the code assumes familiarity with asynchronous programming.
Experienced developers will find details about result-message boundaries, matching responses to message identifiers, queued input, interruption and language-specific error handling.
Capabilities
The page demonstrates multiple messages within one session, text and base64 image input, a TypeScript queue fed by a chat interface, and interruption followed by another request. It also explains how to identify completed responses and, in TypeScript, associate results with input messages through uuid and user_message_uuids.
It points to changing the model or permission mode during a session, but those instructions are on a linked page and are not included here. Displaying response text as it is generated is also covered separately.
Using it
Requirements
The TypeScript examples import @anthropic-ai/claude-agent-sdk, and the image example uses Node's file-reading API. The Python examples import claude_agent_sdk and use asyncio, base64 and pathlib. Both image examples require a local PNG file named diagram.png.
The page does not specify SDK or runtime versions, installation commands, authentication requirements, account eligibility or service configuration. A complete setup therefore requires information beyond this page.
Mechanism
In TypeScript, an asynchronous generator yields SDKUserMessage objects as the prompt supplied to query(). A for-await loop reads the responses. The loop finishes after the final result message once the input generator has returned.
In Python, ClaudeSDKClient holds the conversation context. Each client.query() sends input, and each receive_response() loop stops at the next ResultMessage. A new receive_response() loop is needed for each subsequent response.
A result message marks response completion, and its subtype describes the outcome. A final error result makes the TypeScript query loop yield that result and then throw; an earlier error does not throw while the generator still has messages to send. Python yields error results without raising.
Setup
For TypeScript, supply an asynchronous message generator to query() and arrange for it to wait between inputs. The separate-response example uses a promise that is resolved when the first result arrives. The chat-interface example adds pushMessage(), closeInput() and a generator that waits while its queue is empty.
For Python, open ClaudeSDKClient with an asynchronous context manager, send a message, finish reading its response, then send the next message. Text can be passed as a string; the image example supplies an asynchronous generator containing structured message content.
Example
The image example first asks for an explanation of a message queue. After that response finishes, it reads diagram.png, encodes it as base64 with the image/png media type, and asks Claude to describe the image. The documentation gives success as the expected result subtype for both responses.
The interruption example requests a long essay, interrupts after approximately three seconds, waits for the interrupted response to finish, then asks what a prime number is. The documented outcomes are error_during_execution followed by success. These examples were not executed, and those outputs were not independently observed.
Assessment & evidence
Limitations
Streaming input concerns messages sent to Claude; live display of generated responses requires separate output-streaming guidance. A message sent during tool calls reaches Claude after those calls finish and may be answered together with the earlier message. The page mentions a priority field for controlling when TypeScript input is read, but its detailed semantics are linked elsewhere.
Calling interrupt() ends the active response with error_during_execution while keeping the session open. Messages sent before the interruption that Claude has not yet read still reach it afterward, so interruption does not clear pending input.
The page provides no measured interruption latency, throughput figures, image-size limits or guarantees about production behavior.
Reasoning
The documented choice depends on how the application interacts with the agent. An ongoing conversation benefits from an open input session, while a task with one prompt can use a single-shot call.
A practical implication is that interfaces promising one reply per message should wait for result messages before sending the next input. Completion must also be distinguished from success: an interrupted response has finished, but its documented subtype is an execution error. These are implementation conclusions drawn from the described behavior, not measured results.
Alternatives
The page presents single-shot input as the alternative for an isolated task, such as a serverless function. This passes one prompt string to query() and ends after Claude answers. A later follow-up requires a new call that resumes the session; the resume procedure is linked rather than explained here.
The evidence contains no comparison with other agent SDKs or providers. Output streaming addresses response display and is a separate feature that can complement input streaming.
Evidence
The evidence consists of the complete captured documentation page at [https://code.claude.com/docs/en/agent-sdk/streaming-vs-single-mode.md], including explanations, TypeScript and Python examples, notes and expected outputs.
The page supports descriptions of the documented interfaces and control flow. It supplies no independent execution results or benchmarks. Linked API references, session instructions and troubleshooting material were not included.
Access & freshness
Costs
The page provides no prices, subscription requirements, token rates, quotas or cost estimates. Charges associated with follow-up messages, images, open sessions or interrupted responses are unknown from this evidence. No cost comparison between single-shot and streaming input can be supported.
Rights
The supplied page contains no explicit licence or redistribution permission for its prose or example code. SDK licensing and service terms are also absent. Rights to reuse or redistribute these materials are unknown from this evidence.
Freshness
The source was captured on 23 November 2026 at 21:05:36.988 UTC. Its recorded source revision is sha256:73778bdf1d0dd00fdf5df56a89daa9313eebe9c0fe03675a91d93aba652b35d2.
The supplied text does not identify its publication date, last update date or compatible SDK release. Compatibility with a particular installed version and changes after capture are unknown.
Actions
Start by choosing between a single task and an ongoing conversation. For separate conversational replies, wait for each result before sending the next message. In TypeScript, use message identifiers when results must be matched to inputs.
Handle TypeScript terminal errors with try/catch and a resumed query when the conversation must continue; inspect Python result subtypes because error results do not raise. Account for unread messages surviving interruption.
Before adoption, establish installation, authentication, compatible versions, pricing and reuse terms from additional sources. Evaluate image handling, queued input and interruption in the intended application; none of those behaviors has been tested here.
