

# Agentic retrieval

Agentic retrieval answers a natural-language question for you. The AWS Context retrieval agent searches the Agent context and follows relationships. It reads the business rules, metrics, and skills it finds, and reads knowledge base passages. When the question needs data, it queries your connected data sources. It then writes an answer with citations. Callers need `context:AgenticRetrieveStream` or `context:AgenticRetrieve` on the Agent context (see [Authentication and identity for MCP](authentication-and-identity-for-mcp.md)). Stream examples for JavaScript and Java are in [Consume the event stream](consume-the-event-stream.md). To give the agent guidance such as which sources to trust, what your terms mean, and what to cite, see [Customize retrieval instructions](retrieval-instructions.md).

Two operations take the same request and return the same answer, citations, and retrieved context. They differ in how the result arrives and where you can call them.


|  |  `AgenticRetrieveStream`  |  `AgenticRetrieve`  | 
| --- | --- | --- | 
| Response | An event stream: progress events, the answer, and a final result | One response when retrieval finishes | 
| Where to call it | The AWS SDKs, the MCP tool `context___AgenticRetrieveStream`, and **Chat with context** in the console | The MCP tool `context___AgenticRetrieve` only | 
| Time limit | The endpoint closes the stream after 300 seconds | A 100-second retrieval budget | 
| Use it when | The question can take a while, or you want to show progress | The question is short, or you need an authorization URL for a third-party source (see [Read the answer, citations, and retrieved context](read-the-answer-citations-and-retrieved-context.md)) | 

For what happens when a limit is reached, see [Step and time limits](control-scope-depth-and-timing.md).

You control five things:
+ The Agent context.
+ The conversation (`messages`).
+ The maximum number of agent steps (`maxIterations`).
+ A `sessionId` that groups traces.
+ Whether the trace is kept (`analysisConfiguration.emitTrace`, on by default; a trace is stored only when trace analysis is turned on for the Agent context and the other conditions in [AWS Context agent traces](feedback-trace-sources.md#feedback-agentic-traces) are met).

 AWS Context chooses the model, the searches the agent runs, traversal depth, ranking, the time budget, and the answer length. To control those, use search and traversal from your own agent.

**Topics**
+ [Ask a question with agentic retrieval](ask-a-question-with-agentic-retrieval.md)
+ [Read the answer, citations, and retrieved context](read-the-answer-citations-and-retrieved-context.md)
+ [Streamed events](streamed-events.md)
+ [Step and time limits](control-scope-depth-and-timing.md)
+ [Continue a conversation](continue-a-conversation.md)
+ [How AWS Context answers questions over structured data](how-aws-context-answers-questions-over-structured-data.md)
+ [Query sources that run their own query engine](query-sources-that-run-their-own-query-engine.md)
+ [Combine data from several sources in one question](combine-data-from-several-sources-in-one-question.md)
+ [How access controls apply when AWS Context queries data](how-access-controls-apply-when-aws-context-queries-data.md)
+ [How a custom ontology is used in agentic retrieval](agentic-retrieval-custom-ontology.md)