2025/10/13 - Amazon Bedrock AgentCore Data Plane Fronting Layer - 1 new2 updated api methods
Changes Updated InvokeAgentRuntime API to accept account id optionally and added CompleteResourceTokenAuth API.
Confirms the user authentication session for obtaining OAuth2.0 tokens for a resource.
See also: AWS API Documentation
Request Syntax
client.complete_resource_token_auth( userIdentifier={ 'userToken': 'string', 'userId': 'string' }, sessionUri='string' )
dict
[REQUIRED]
The OAuth2.0 token or user ID that was used to generate the workload access token used for initiating the user authorization flow to retrieve OAuth2.0 tokens.
userToken (string) --
The OAuth2.0 token issued by the user’s identity provider
userId (string) --
The ID of the user for whom you have retrieved a workload access token for
string
[REQUIRED]
Unique identifier for the user's authentication session for retrieving OAuth2 tokens. This ID tracks the authorization flow state across multiple requests and responses during the OAuth2 authentication process.
dict
Response Syntax
{}
Response Structure
(dict) --
{'customState': 'string', 'sessionUri': 'string'}Response
{'sessionStatus': 'IN_PROGRESS | FAILED', 'sessionUri': 'string'}
Returns the OAuth 2.0 token of the provided resource.
See also: AWS API Documentation
Request Syntax
client.get_resource_oauth2_token( workloadIdentityToken='string', resourceCredentialProviderName='string', scopes=[ 'string', ], oauth2Flow='USER_FEDERATION'|'M2M', sessionUri='string', resourceOauth2ReturnUrl='string', forceAuthentication=True|False, customParameters={ 'string': 'string' }, customState='string' )
string
[REQUIRED]
The identity token of the workload from which you want to retrieve the OAuth2 token.
string
[REQUIRED]
The name of the resource's credential provider.
list
[REQUIRED]
The OAuth scopes being requested.
(string) --
string
[REQUIRED]
The type of flow to be performed.
string
Unique identifier for the user's authentication session for retrieving OAuth2 tokens. This ID tracks the authorization flow state across multiple requests and responses during the OAuth2 authentication process.
string
The callback URL to redirect to after the OAuth 2.0 token retrieval is complete. This URL must be one of the provided URLs configured for the workload identity.
boolean
Indicates whether to always initiate a new three-legged OAuth (3LO) flow, regardless of any existing session.
dict
A map of custom parameters to include in the authorization request to the resource credential provider. These parameters are in addition to the standard OAuth 2.0 flow parameters, and will not override them.
(string) --
(string) --
string
An opaque string that will be sent back to the callback URL provided in resourceOauth2ReturnUrl. This state should be used to protect the callback URL of your application against CSRF attacks by ensuring the response corresponds to the original request.
dict
Response Syntax
{ 'authorizationUrl': 'string', 'accessToken': 'string', 'sessionUri': 'string', 'sessionStatus': 'IN_PROGRESS'|'FAILED' }
Response Structure
(dict) --
authorizationUrl (string) --
The URL to initiate the authorization process, provided when the access token requires user authorization.
accessToken (string) --
The OAuth 2.0 access token to use.
sessionUri (string) --
Unique identifier for the user's authorization session for retrieving OAuth2 tokens. This matches the sessionId from the request and can be used to track the session state.
sessionStatus (string) --
Status indicating whether the user's authorization session is in progress or has failed. This helps determine the next steps in the OAuth2 authentication flow.
{'accountId': 'string'}
Sends a request to an agent or tool hosted in an Amazon Bedrock AgentCore Runtime and receives responses in real-time.
To invoke an agent you must specify the AgentCore Runtime ARN and provide a payload containing your request. You can optionally specify a qualifier to target a specific version or endpoint of the agent.
This operation supports streaming responses, allowing you to receive partial responses as they become available. We recommend using pagination to ensure that the operation returns quickly and successfully when processing large responses.
For example code, see Invoke an AgentCore Runtime agent.
If you're integrating your agent with OAuth, you can't use the Amazon Web Services SDK to call InvokeAgentRuntime. Instead, make a HTTPS request to InvokeAgentRuntime. For an example, see Authenticate and authorize with Inbound Auth and Outbound Auth.
To use this operation, you must have the bedrock-agentcore:InvokeAgentRuntime permission. If you are making a call to InvokeAgentRuntime on behalf of a user ID with the X-Amzn-Bedrock-AgentCore-Runtime-User-Id header, You require permissions to both actions ( bedrock-agentcore:InvokeAgentRuntime and bedrock-agentcore:InvokeAgentRuntimeForUser).
See also: AWS API Documentation
Request Syntax
client.invoke_agent_runtime( contentType='string', accept='string', mcpSessionId='string', runtimeSessionId='string', mcpProtocolVersion='string', runtimeUserId='string', traceId='string', traceParent='string', traceState='string', baggage='string', agentRuntimeArn='string', qualifier='string', accountId='string', payload=b'bytes'|file )
string
The MIME type of the input data in the payload. This tells the agent runtime how to interpret the payload data. Common values include application/json for JSON data.
string
The desired MIME type for the response from the agent runtime. This tells the agent runtime what format to use for the response data. Common values include application/json for JSON data.
string
The identifier of the MCP session.
string
The identifier of the runtime session.
This field is autopopulated if not provided.
string
The version of the MCP protocol being used.
string
The identifier of the runtime user.
string
The trace identifier for request tracking.
string
The parent trace information for distributed tracing.
string
The trace state information for distributed tracing.
string
Additional context information for distributed tracing.
string
[REQUIRED]
The Amazon Web Services Resource Name (ARN) of the agent runtime to invoke. The ARN uniquely identifies the agent runtime resource in Amazon Bedrock.
string
The qualifier to use for the agent runtime. This can be a version number or an endpoint name that points to a specific version. If not specified, Amazon Bedrock uses the default version of the agent runtime.
string
The identifier of the Amazon Web Services account for the agent runtime resource.
bytes or seekable file-like object
[REQUIRED]
The input data to send to the agent runtime. The format of this data depends on the specific agent configuration and must match the specified content type. For most agents, this is a JSON object containing the user's request.
dict
Response Syntax
{ 'runtimeSessionId': 'string', 'mcpSessionId': 'string', 'mcpProtocolVersion': 'string', 'traceId': 'string', 'traceParent': 'string', 'traceState': 'string', 'baggage': 'string', 'contentType': 'string', 'response': StreamingBody(), 'statusCode': 123 }
Response Structure
(dict) --
runtimeSessionId (string) --
The identifier of the runtime session.
mcpSessionId (string) --
The identifier of the MCP session.
mcpProtocolVersion (string) --
The version of the MCP protocol being used.
traceId (string) --
The trace identifier for request tracking.
traceParent (string) --
The parent trace information for distributed tracing.
traceState (string) --
The trace state information for distributed tracing.
baggage (string) --
Additional context information for distributed tracing.
contentType (string) --
The MIME type of the response data. This indicates how to interpret the response data. Common values include application/json for JSON data.
response (:class:`.StreamingBody`) --
The response data from the agent runtime. The format of this data depends on the specific agent configuration and the requested accept type. For most agents, this is a JSON object containing the agent's response to the user's request.
statusCode (integer) --
The HTTP status code of the response. A status code of 200 indicates a successful operation. Other status codes indicate various error conditions.