Skip to content

agentic_retrieve_stream

Operation

Async only

This operation uses an event stream, so only the asynchronous client supports it.

agentic_retrieve_stream async

agentic_retrieve_stream(request: AgenticRetrieveStreamInput | AgenticRetrieveStreamInputDict | None = None, /, *, plugins: list[Plugin] | None = None, **kwargs: Unpack[AgenticRetrieveStreamInputDict]) -> AsyncOutputEventStream[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
request AgenticRetrieveStreamInput | AgenticRetrieveStreamInputDict | None

The input as a model or dictionary. Pass this or keyword arguments, not both.

None
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
**kwargs Unpack[AgenticRetrieveStreamInputDict]

The input fields as keyword arguments.

{}

Returns:

Type Description
AsyncOutputEventStream[AgenticRetrieveStreamResponseOutput, AgenticRetrieveStreamOutput]

An AsyncOutputEventStream for server-to-client streaming.

Input

Pass the input as keyword arguments, a positional dictionary, or a positional model object. Pass plugins separately as a keyword argument.

AgenticRetrieveStreamInputDict

Bases: TypedDict

Dictionary form of AgenticRetrieveStreamInput.

Attributes

agentic_retrieve_configuration instance-attribute

Configuration settings for the agentic retrieval operation.

generate_response instance-attribute
generate_response: bool | None

Whether to generate a response based on the retrieved results.

memory_configuration instance-attribute

The configuration for using an Amazon Bedrock AgentCore Memory resource with this retrieval.

messages instance-attribute

The list of messages for the agentic retrieval conversation.

next_token instance-attribute
next_token: str | None

Opaque continuation token for paginated results.

policy_configuration instance-attribute

Policy configuration for guardrails and content filtering.

retrieval_instruction_configuration instance-attribute

A retrieval instruction to apply to this request.

retrievers instance-attribute

The list of retrievers to use for agentic retrieval.

user_context instance-attribute
user_context: UserContext | UserContextDict | 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.

AgenticRetrieveStreamInput dataclass

Bases: _SerdeShape

Request structure for the agentic retrieve stream operation.

Attributes

agentic_retrieve_configuration class-attribute instance-attribute
agentic_retrieve_configuration: AgenticRetrieveConfiguration | None = ...

Configuration settings for the agentic retrieval operation.

generate_response class-attribute instance-attribute
generate_response: bool = ...

Whether to generate a response based on the retrieved results.

memory_configuration class-attribute instance-attribute
memory_configuration: AgenticRetrieveMemoryConfiguration | None = ...

The configuration for using an Amazon Bedrock AgentCore Memory resource with this retrieval.

messages class-attribute instance-attribute
messages: list[AgenticRetrieveMessage] | None = ...

The list of messages for the agentic retrieval conversation.

next_token class-attribute instance-attribute
next_token: str | None = ...

Opaque continuation token for paginated results.

policy_configuration class-attribute instance-attribute
policy_configuration: AgenticRetrievePolicyConfiguration | None = ...

Policy configuration for guardrails and content filtering.

retrieval_instruction_configuration class-attribute instance-attribute
retrieval_instruction_configuration: AgenticRetrieveInstructionConfiguration | None = ...

A retrieval instruction to apply to this request.

retrievers class-attribute instance-attribute
retrievers: list[AgenticRetriever] | None = ...

The list of retrievers to use for agentic retrieval.

user_context class-attribute instance-attribute
user_context: UserContext | 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 AsyncOutputEventStream for server-to-client streaming.

Event Stream Structure

Output Event Type

AgenticRetrieveStreamResponseOutput

Initial Response Structure

AgenticRetrieveStreamOutput dataclass

Bases: _SerdeShape

Response structure for the agentic retrieve stream operation.

Attributes
response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.