Answer: The query() function accepts a prompt (a string or AsyncIterable) and an optional options object, and returns a Query object that extends AsyncGenerator with additional methods. Status: Confirmed Entry: tool/claude-code/agents-and-automation/query-function-parameters-returns Revision: 4 Digest: sha256:7ed80373adf6abea (changes whenever the content changes) Timeline: Created: 2026-11-13T03:03:08Z Last changed: 2026-11-20T12:17:42Z (return description: Returns a [`Query`](#query-object) object that extends `AsyncGenerator<`[`SDKMessage`](#sdkmessage)`, void>` with additional methods. → Query) Last verified: 2026-11-20T12:17:42Z Next check: 2026-11-21T12:17:42Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of prompt parameter type | string | AsyncIterable | [1] | 2026-11-20 options parameter type | Options | [1] | 2026-11-20 return type | Query | [1] | 2026-11-20 return description | Query | [1] | 2026-11-20 Sources: [1] Anthropic. "Agent SDK reference - TypeScript". https://code.claude.com/docs/en/agent-sdk/typescript.md Role: primary. Accessed: 2026-11-20T12:17:42Z Quote: "prompt: string | AsyncIterable;" (Supports: prompt parameter type) Quote: "options?: Options;" (Supports: options parameter type) Quote: "}): Query;" (Supports: return type) Quote: "Returns a [`Query`](#query-object) object that extends `AsyncGenerator<`[`SDKMessage`](#sdkmessage)`, void>` with additional methods." (Supports: return description) Published: 2026-11-20T10:22:56Z Snapshot SHA-256: b5444415a9ff038182cbc8281d0de0ebf914d9eb979d9464cf04e20a54d708b4 (captured 2026-11-20T12:17:44Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. Cross-check: not-available at 2026-11-20T12:17:42Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:17:42Z Last attempt: 2026-11-20T12:17:42Z Notes and limitations: Extracted automatically from a single official source (section "`query()`"). Related: https://latestn.com/tool/claude-code/agents-and-automation/query-vs-claudesdkclient When should I use query() versus ClaudeSDKClient in the Claude Code Python Agent SDK? https://latestn.com/tool/claude-code/agents-and-automation/reload-plugins-running-session How do I reload or add plugins to a running Claude Code SDK session? https://latestn.com/tool/claude-code/agents-and-automation/restrict-subagent-tools How do I restrict which tools a Claude Code subagent can use? https://latestn.com/tool/claude-code/agents-and-automation/persist-sessions-hosting How do I persist sessions and state when hosting the Claude Code Agent SDK in production? https://latestn.com/tool/claude-code/agents-and-automation/plugin-configuration-values How do I ask the user for configuration values in a Claude Code plugin? https://latestn.com/tool/claude-code/agents-and-automation/python-recipes-cookbook Where are the Python recipes for the Claude Code Agent SDK? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-20T12:17:42Z | changed | return description: Returns a [`Query`](#query-object) object that extends `AsyncGenerator<`[`SDKMessage`](#sdkmessage)`, void>` with additional methods. → Query | [1] 2026-11-19T12:13:25Z | changed | return description: Query → Returns a [`Query`](#query-object) object that extends `AsyncGenerator<`[`SDKMessage`](#sdkmessage)`, void>` with additional methods. | [1] 2026-11-14T12:13:24Z | changed | return description: — → Query | [1] 2026-11-13T03:03:08Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/claude-code/agents-and-automation/query-function-parameters-returns/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/claude-code/agents-and-automation/query-function-parameters-returns POST: https://latestn.com/dispute/tool/claude-code/agents-and-automation/query-function-parameters-returns with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/claude-code/agents-and-automation/query-function-parameters-returns?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). What does the Claude Code Agent SDK query() function accept and return? Revision 4, last verified 2026-11-20T12:17:42Z. https://latestn.com/tool/claude-code/agents-and-automation/query-function-parameters-returns (accessed 2026-11-21T09:59:32Z). @misc{LatestN_tool_claude_code_agents_and_automation_query_function_parameters_returns_r4, title = {What does the Claude Code Agent SDK query() function accept and return?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/claude-code/agents-and-automation/query-function-parameters-returns}}, note = {Revision 4; digest sha256:7ed80373adf6abea; last verified 2026-11-20T12:17:42Z; accessed 2026-11-21T09:59:32Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/claude-code/agents-and-automation/query-function-parameters-returns