BedrockAgentRuntime class
Contains APIs related to model invocation and querying of knowledge bases.
Constructors
- BedrockAgentRuntime({required String region, AwsClientCredentials? credentials, AwsClientCredentialsProvider? credentialsProvider, Client? client, String? endpointUrl})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
) → void - Closes the internal HTTP client if none was provided at creation. If a client was passed as a constructor argument, this becomes a noop.
-
createInvocation(
{required String sessionIdentifier, String? description, String? invocationId}) → Future< CreateInvocationResponse> - Creates a new invocation within a session. An invocation groups the related invocation steps that store the content from a conversation. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
-
createSession(
{String? encryptionKeyArn, Map< String, String> ? sessionMetadata, Map<String, String> ? tags}) → Future<CreateSessionResponse> - Creates a session to temporarily store conversations for generative AI (GenAI) applications built with open-source frameworks such as LangGraph and LlamaIndex. Sessions enable you to save the state of conversations at checkpoints, with the added security and infrastructure of Amazon Web Services. For more information, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
-
deleteAgentMemory(
{required String agentAliasId, required String agentId, String? memoryId, String? sessionId}) → Future< void> - Deletes memory from the specified memory identifier.
-
deleteSession(
{required String sessionIdentifier}) → Future< void> -
Deletes a session that you ended. You can't delete a session with an
ACTIVEstatus. To delete an active session, you must first end it with the EndSession API operation. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions. -
endSession(
{required String sessionIdentifier}) → Future< EndSessionResponse> - Ends the session. After you end a session, you can still access its content but you can’t add to it. To delete the session and it's content, you use the DeleteSession API operation. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
-
generateQuery(
{required QueryGenerationInput queryGenerationInput, required TransformationConfiguration transformationConfiguration}) → Future< GenerateQueryResponse> - Generates an SQL query from a natural language query. For more information, see Generate a query for structured data in the Amazon Bedrock User Guide.
-
getAgentMemory(
{required String agentAliasId, required String agentId, required String memoryId, required MemoryType memoryType, int? maxItems, String? nextToken}) → Future< GetAgentMemoryResponse> - Gets the sessions stored in the memory of the agent.
-
getExecutionFlowSnapshot(
{required String executionIdentifier, required String flowAliasIdentifier, required String flowIdentifier}) → Future< GetExecutionFlowSnapshotResponse> - Retrieves the flow definition snapshot used for a flow execution. The snapshot represents the flow metadata and definition as it existed at the time the execution was started. Note that even if the flow is edited after an execution starts, the snapshot connected to the execution remains unchanged.
-
getFlowExecution(
{required String executionIdentifier, required String flowAliasIdentifier, required String flowIdentifier}) → Future< GetFlowExecutionResponse> - Retrieves details about a specific flow execution, including its status, start and end times, and any errors that occurred during execution.
-
getInvocationStep(
{required String invocationIdentifier, required String invocationStepId, required String sessionIdentifier}) → Future< GetInvocationStepResponse> - Retrieves the details of a specific invocation step within an invocation in a session. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
-
getSession(
{required String sessionIdentifier}) → Future< GetSessionResponse> - Retrieves details about a specific session. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
-
invokeAgent(
{required String agentAliasId, required String agentId, required String sessionId, BedrockModelConfigurations? bedrockModelConfigurations, bool? enableTrace, bool? endSession, String? inputText, String? memoryId, PromptCreationConfigurations? promptCreationConfigurations, SessionState? sessionState, String? sourceArn, StreamingConfigurations? streamingConfigurations}) → Future< InvokeAgentResponse> - Sends a prompt for the agent to process and respond to. Note the following fields for the request:
-
invokeFlow(
{required String flowAliasIdentifier, required String flowIdentifier, required List< FlowInput> inputs, bool? enableTrace, String? executionId, ModelPerformanceConfiguration? modelPerformanceConfiguration}) → Future<InvokeFlowResponse> - Invokes an alias of a flow to run the inputs that you specify and return the output of each node as a stream. If there's an error, the error is returned. For more information, see Test a flow in Amazon Bedrock in the Amazon Bedrock User Guide.
-
invokeInlineAgent(
{required String foundationModel, required String instruction, required String sessionId, List< AgentActionGroup> ? actionGroups, AgentCollaboration? agentCollaboration, String? agentName, InlineBedrockModelConfigurations? bedrockModelConfigurations, List<CollaboratorConfiguration> ? collaboratorConfigurations, List<Collaborator> ? collaborators, CustomOrchestration? customOrchestration, String? customerEncryptionKeyArn, bool? enableTrace, bool? endSession, GuardrailConfigurationWithArn? guardrailConfiguration, int? idleSessionTTLInSeconds, InlineSessionState? inlineSessionState, String? inputText, List<KnowledgeBase> ? knowledgeBases, OrchestrationType? orchestrationType, PromptCreationConfigurations? promptCreationConfigurations, PromptOverrideConfiguration? promptOverrideConfiguration, StreamingConfigurations? streamingConfigurations}) → Future<InvokeInlineAgentResponse> - Invokes an inline Amazon Bedrock agent using the configurations you provide with the request.
-
listFlowExecutionEvents(
{required FlowExecutionEventType eventType, required String executionIdentifier, required String flowAliasIdentifier, required String flowIdentifier, int? maxResults, String? nextToken}) → Future< ListFlowExecutionEventsResponse> - Lists events that occurred during a flow execution. Events provide detailed information about the execution progress, including node inputs and outputs, flow inputs and outputs, condition results, and failure events.
-
listFlowExecutions(
{required String flowIdentifier, String? flowAliasIdentifier, int? maxResults, String? nextToken}) → Future< ListFlowExecutionsResponse> - Lists all executions of a flow. Results can be paginated and include summary information about each execution, such as status, start and end times, and the execution's Amazon Resource Name (ARN).
-
listInvocations(
{required String sessionIdentifier, int? maxResults, String? nextToken}) → Future< ListInvocationsResponse> - Lists all invocations associated with a specific session. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
-
listInvocationSteps(
{required String sessionIdentifier, String? invocationIdentifier, int? maxResults, String? nextToken}) → Future< ListInvocationStepsResponse> - Lists all invocation steps associated with a session and optionally, an invocation within the session. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
-
listSessions(
{int? maxResults, String? nextToken}) → Future< ListSessionsResponse> - Lists all sessions in your Amazon Web Services account. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
-
listTagsForResource(
{required String resourceArn}) → Future< ListTagsForResourceResponse> - List all the tags for the resource you specify.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
optimizePrompt(
{required InputPrompt input, required String targetModelId}) → Future< OptimizePromptResponse> - Optimizes a prompt for the task that you specify. For more information, see Optimize a prompt in the Amazon Bedrock User Guide.
-
putInvocationStep(
{required String invocationIdentifier, required DateTime invocationStepTime, required InvocationStepPayload payload, required String sessionIdentifier, String? invocationStepId}) → Future< PutInvocationStepResponse> - Add an invocation step to an invocation in a session. An invocation step stores fine-grained state checkpoints, including text and images, for each interaction. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
-
rerank(
{required List< RerankQuery> queries, required RerankingConfiguration rerankingConfiguration, required List<RerankSource> sources, String? nextToken}) → Future<RerankResponse> - Reranks the relevance of sources based on queries. For more information, see Improve the relevance of query responses with a reranker model.
-
retrieve(
{required String knowledgeBaseId, required KnowledgeBaseQuery retrievalQuery, GuardrailConfiguration? guardrailConfiguration, String? nextToken, KnowledgeBaseRetrievalConfiguration? retrievalConfiguration}) → Future< RetrieveResponse> - Queries a knowledge base and retrieves information from it.
-
retrieveAndGenerate(
{required RetrieveAndGenerateInput input, RetrieveAndGenerateConfiguration? retrieveAndGenerateConfiguration, RetrieveAndGenerateSessionConfiguration? sessionConfiguration, String? sessionId}) → Future< RetrieveAndGenerateResponse> - Queries a knowledge base and generates responses based on the retrieved results and using the specified foundation model or inference profile. The response only cites sources that are relevant to the query.
-
retrieveAndGenerateStream(
{required RetrieveAndGenerateInput input, RetrieveAndGenerateConfiguration? retrieveAndGenerateConfiguration, RetrieveAndGenerateSessionConfiguration? sessionConfiguration, String? sessionId}) → Future< RetrieveAndGenerateStreamResponse> -
Queries a knowledge base and generates responses based on the retrieved
results, with output in streaming format.
This operation requires permission for the
bedrock:RetrieveAndGenerateaction. -
startFlowExecution(
{required String flowAliasIdentifier, required String flowIdentifier, required List< FlowInput> inputs, String? flowExecutionName, ModelPerformanceConfiguration? modelPerformanceConfiguration}) → Future<StartFlowExecutionResponse> - Starts an execution of an Amazon Bedrock flow. Unlike flows that run until completion or time out after five minutes, flow executions let you run flows asynchronously for longer durations. Flow executions also yield control so that your application can perform other tasks.
-
stopFlowExecution(
{required String executionIdentifier, required String flowAliasIdentifier, required String flowIdentifier}) → Future< StopFlowExecutionResponse> -
Stops an Amazon Bedrock flow's execution. This operation prevents further
processing of the flow and changes the execution status to
Aborted. -
tagResource(
{required String resourceArn, required Map< String, String> tags}) → Future<void> - Associate tags with a resource. For more information, see Tagging resources in the Amazon Bedrock User Guide.
-
toString(
) → String -
A string representation of this object.
inherited
-
untagResource(
{required String resourceArn, required List< String> tagKeys}) → Future<void> - Remove tags from a resource.
-
updateSession(
{required String sessionIdentifier, Map< String, String> ? sessionMetadata}) → Future<UpdateSessionResponse> - Updates the metadata or encryption settings of a session. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited