agentic_retrieve_stream¶
Operation¶
agentic_retrieve_stream
async
¶
agentic_retrieve_stream(input: AgenticRetrieveStreamInput, plugins: list[Plugin] | None = None) -> OutputEventStream[AgenticRetrieveStreamResponseOutput, AgenticRetrieveStreamOutput]
Retrieves information from one or more knowledge bases using an agentic approach. Agentic retrieval uses a foundation model to intelligently decompose complex queries into sub-queries and iteratively retrieve relevant information from your knowledge bases. This approach improves retrieval accuracy for complex, multi-step questions that a single retrieval pass might not fully address.
The operation returns results through a stream that includes retrieval results, trace events for visibility into the process, and a generated response synthesized from the results by default, which can be turned off.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
AgenticRetrieveStreamInput
|
An instance of |
required |
plugins
|
list[Plugin] | None
|
A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations. |
None
|
Returns:
| Type | Description |
|---|---|
OutputEventStream[AgenticRetrieveStreamResponseOutput, AgenticRetrieveStreamOutput]
|
An |
Input¶
AgenticRetrieveStreamInput
dataclass
¶
Request structure for the agentic retrieve stream operation.
Attributes¶
agentic_retrieve_configuration
class-attribute
instance-attribute
¶
agentic_retrieve_configuration: AgenticRetrieveConfiguration | None = None
Configuration settings for the agentic retrieval operation.
generate_response
class-attribute
instance-attribute
¶
generate_response: bool = True
Whether to generate a response based on the retrieved results.
messages
class-attribute
instance-attribute
¶
messages: list[AgenticRetrieveMessage] | None = None
The list of messages for the agentic retrieval conversation.
next_token
class-attribute
instance-attribute
¶
next_token: str | None = None
Opaque continuation token for paginated results.
policy_configuration
class-attribute
instance-attribute
¶
policy_configuration: AgenticRetrievePolicyConfiguration | None = None
Policy configuration for guardrails and content filtering.
retrievers
class-attribute
instance-attribute
¶
retrievers: list[AgenticRetriever] | None = None
The list of retrievers to use for agentic retrieval.
user_context
class-attribute
instance-attribute
¶
user_context: UserContext | None = field(repr=False, default=None)
Contains information about the user making the request. This is used for access control filtering to ensure that retrieval results only include documents the user is authorized to access.
Output¶
This operation returns an OutputEventStream for server-to-client streaming.
Event Stream Structure¶
Output Event Type¶
AgenticRetrieveStreamResponseOutput
Initial Response Structure¶
AgenticRetrieveStreamOutput
dataclass
¶
Response structure for the agentic retrieve stream operation.