Camel Components

AWS Bedrock Agent Runtime

Since Camel 4.5

Only producer is supported

The AWS2 Bedrock component supports invoking a supported LLM model from AWS Bedrock service.

Prerequisites

You must have a valid Amazon Web Services developer account, and be signed up to use Amazon Bedrock. More information is available at Amazon Bedrock.

URI Format

aws-bedrock-agent-runtime://label[?options]

You can append query options to the URI in the following format:

?options=value&option2=value&…​

Configuring Options

Camel components are configured on two separate levels:

  • component level

  • endpoint level

Configuring Component Options

At the component level, you set general and shared configurations that are, then, inherited by the endpoints. It is the highest configuration level.

For example, a component may have security settings, credentials for authentication, urls for network connection and so forth.

Some components only have a few options, and others may have many. Because components typically have pre-configured defaults that are commonly used, then you may often only need to configure a few options on a component; or none at all.

You can configure components using:

  • the Component DSL.

  • in a configuration file (application.properties, *.yaml files, etc).

  • directly in the Java code.

Configuring Endpoint Options

You usually spend more time setting up endpoints because they have many options. These options help you customize what you want the endpoint to do. The options are also categorized into whether the endpoint is used as a consumer (from), as a producer (to), or both.

Configuring endpoints is most often done directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL and DataFormat DSL as a type safe way of configuring endpoints and data formats in Java.

A good practice when configuring options is to use Property Placeholders.

Property placeholders provide a few benefits:

  • They help prevent using hardcoded urls, port numbers, sensitive information, and other settings.

  • They allow externalizing the configuration from the code.

  • They help the code to become more flexible and reusable.

The following two sections list all the options, firstly for the component followed by the endpoint.

Component Options

The AWS Bedrock Agent Runtime component supports the following options which are listed below.

Name Description Default Type

configuration (producer)

The configuration that the endpoints of the component start from. Each endpoint uses a copy of it, in which its own URI options replace the values.

BedrockAgentRuntimeConfiguration

knowledgeBaseId (producer)

The ID of the knowledge base that retrieve and retrieveAndGenerate query. The other operations do not use it, and neither do these with pojoRequest.

String

lazyStartProducer (producer)

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

boolean

modelId (producer)

The ID or ARN of the model that retrieveAndGenerate generates the answer with, for example anthropic.claude-3-5-sonnet-20241022-v2:0. The other operations do not use it, and neither does retrieveAndGenerate with pojoRequest.

Enum values:

  • amazon.titan-text-express-v1

  • amazon.titan-text-lite-v1

  • amazon.titan-image-generator-v1

  • amazon.titan-embed-text-v1

  • amazon.titan-embed-image-v1

  • amazon.titan-text-premier-v1:0

  • amazon.titan-embed-text-v2:0

  • amazon.titan-image-generator-v2:0

  • amazon.nova-canvas-v1:0

  • amazon.nova-lite-v1:0

  • amazon.nova-micro-v1:0

  • amazon.nova-premier-v1:0

  • amazon.nova-pro-v1:0

  • amazon.nova-reel-v1:0

  • amazon.nova-reel-v1:1

  • amazon.nova-sonic-v1:0

  • amazon.rerank-v1:0

  • ai21.jamba-1-5-large-v1:0

  • ai21.jamba-1-5-mini-v1:0

  • anthropic.claude-3-sonnet-20240229-v1:0

  • anthropic.claude-3-5-sonnet-20240620-v1:0

  • anthropic.claude-3-5-sonnet-20241022-v2:0

  • anthropic.claude-3-haiku-20240307-v1:0

  • anthropic.claude-3-5-haiku-20241022-v1:0

  • anthropic.claude-3-opus-20240229-v1:0

  • anthropic.claude-3-7-sonnet-20250219-v1:0

  • anthropic.claude-opus-4-20250514-v1:0

  • anthropic.claude-sonnet-4-20250514-v1:0

  • cohere.command-r-plus-v1:0

  • cohere.command-r-v1:0

  • cohere.embed-english-v3

  • cohere.embed-multilingual-v3

  • cohere.rerank-v3-5:0

  • meta.llama3-8b-instruct-v1:0

  • meta.llama3-70b-instruct-v1:0

  • meta.llama3-1-8b-instruct-v1:0

  • meta.llama3-1-70b-instruct-v1:0

  • meta.llama3-1-405b-instruct-v1:0

  • meta.llama3-2-1b-instruct-v1:0

  • meta.llama3-2-3b-instruct-v1:0

  • meta.llama3-2-11b-instruct-v1:0

  • meta.llama3-2-90b-instruct-v1:0

  • meta.llama3-3-70b-instruct-v1:0

  • meta.llama4-maverick-17b-instruct-v1:0

  • meta.llama4-scout-17b-instruct-v1:0

  • mistral.mistral-7b-instruct-v0:2

  • mistral.mixtral-8x7b-instruct-v0:1

  • mistral.mistral-large-2402-v1:0

  • mistral.mistral-large-2407-v1:0

  • mistral.mistral-small-2402-v1:0

  • mistral.pixtral-large-2502-v1:0

  • stability.sd3-5-large-v1:0

  • stability.stable-image-control-sketch-v1:0

  • stability.stable-image-control-structure-v1:0

  • stability.stable-image-core-v1:1

String

operation (producer)

Required The operation that the producer performs. The CamelAwsBedrockAgentRuntimeOperation header replaces this option.

Enum values:

  • retrieveAndGenerate

  • invokeFlow

  • invokeAgent

  • invokeInlineAgent

  • retrieve

BedrockAgentRuntimeOperations

overrideEndpoint (producer)

Whether to send the requests to the URI of the uriEndpointOverride option instead of the endpoint of the region. It has no effect when uriEndpointOverride is not set.

false

boolean

pojoRequest (producer)

Whether the body is the request object of the AWS SDK for the operation, which the producer sends as it is: a RetrieveAndGenerateRequest, RetrieveRequest, InvokeFlowRequest, InvokeAgentRequest or InvokeInlineAgentRequest. The options and headers that build the request are then not used, and a body of another type fails the exchange.

false

boolean

profileCredentialsName (producer)

The name of the profile in the AWS shared credentials and config files, used when useProfileCredentialsProvider is true. If not set, the AWS SDK uses its default profile, which the AWS_PROFILE environment variable can change.

false

String

region (producer)

The AWS region of Amazon Bedrock, as a region ID such as us-east-1, which is the value of Region.US_EAST_1.id(). If not set, the AWS SDK takes the region from its default region provider chain, for example the AWS_REGION environment variable.

Enum values:

  • us-east-1

  • us-east-2

  • us-west-2

  • us-gov-west-1

  • ap-northeast-1

  • ap-northeast-2

  • ap-south-1

  • ap-southeast-1

  • ap-southeast-2

  • ca-central-1

  • eu-central-1

  • eu-central-2

  • eu-west-1

  • eu-west-2

  • eu-west-3

  • sa-east-1

String

uriEndpointOverride (producer)

The URI of the endpoint to use instead of the endpoint of the region, for example http://localhost:4566 for a local emulator. It is used only when overrideEndpoint is true.

String

useDefaultCredentialsProvider (producer)

Whether to load the credentials with the default credentials provider chain of the AWS SDK, which looks in system properties, environment variables, the shared credentials and config files, and the container or instance role. It takes precedence over the other credentials options.

false

boolean

useProfileCredentialsProvider (producer)

Whether to load the credentials from a profile of the AWS shared credentials and config files, the one of the profileCredentialsName option. It is not used when useDefaultCredentialsProvider is true, and it takes precedence over the session and static credentials.

false

boolean

autowiredEnabled (advanced)

Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc.

true

boolean

bedrockAgentRuntimeAsyncClient (advanced)

Autowired To use a custom software.amazon.awssdk.services.bedrockagentruntime.BedrockAgentRuntimeAsyncClient for invokeFlow, invokeAgent and invokeInlineAgent, which receive their response as an event stream. When it is not set, the endpoint builds one from the credentials, region, proxy and endpoint override options: at start when the operation option is one of these, or else on first use. The Camel endpoint does not close a client that is set or autowired.

BedrockAgentRuntimeAsyncClient

bedrockAgentRuntimeClient (advanced)

Autowired To use a custom software.amazon.awssdk.services.bedrockagentruntime.BedrockAgentRuntimeClient for retrieve and retrieveAndGenerate. When this option is set or autowired, the credentials, region, proxy, endpoint override and trustAllCertificates options are not used for this client. The Camel endpoint does not close a client that is set or autowired.

BedrockAgentRuntimeClient

agentAliasId (agent)

The ID of the alias of the agent that invokeAgent invokes. The CamelAwsBedrockAgentRuntimeAgentAliasId header replaces this option.

String

agentId (agent)

The ID of the agent that invokeAgent invokes. The CamelAwsBedrockAgentRuntimeAgentId header replaces this option.

String

enableTrace (agent)

Whether invokeFlow, invokeAgent and invokeInlineAgent ask for the trace events of the invocation, which the producer gives in the CamelAwsBedrockAgentRuntimeFlowTraces or CamelAwsBedrockAgentRuntimeAgentTraces header. The CamelAwsBedrockAgentRuntimeFlowEnableTrace header replaces it for invokeFlow, and the CamelAwsBedrockAgentRuntimeAgentEnableTrace header for the agent operations.

false

boolean

foundationModel (agent)

The ID of the foundation model that the inline agent of invokeInlineAgent uses, for example anthropic.claude-3-5-sonnet-20241022-v2:0. The CamelAwsBedrockAgentRuntimeAgentFoundationModel header replaces this option.

String

instruction (agent)

The instructions that tell the inline agent of invokeInlineAgent what to do and how to interact with users. The CamelAwsBedrockAgentRuntimeAgentInstruction header replaces this option.

String

sessionId (agent)

The ID of the session of invokeAgent and invokeInlineAgent: reuse the same value to continue the conversation. The CamelAwsBedrockAgentRuntimeSessionId header replaces this option. If neither is set, the producer uses a random ID for each message, and gives it in that header.

String

streamOutputMode (agent)

How invokeAgent and invokeInlineAgent give the answer: complete gives the whole text as a String, and chunks gives a List of the text of each chunk. In both modes the producer waits until the agent has finished. The CamelAwsBedrockAgentRuntimeAgentStreamOutputMode header replaces this option.

Enum values:

  • complete

  • chunks

complete

String

flowAliasIdentifier (flow)

The ID of the alias of the flow that invokeFlow invokes. The CamelAwsBedrockAgentRuntimeFlowAliasIdentifier header replaces this option.

String

flowIdentifier (flow)

The ID of the flow that invokeFlow invokes. The CamelAwsBedrockAgentRuntimeFlowIdentifier header replaces this option.

String

healthCheckConsumerEnabled (health)

Used for enabling or disabling all consumer based health checks from this component.

true

boolean

healthCheckProducerEnabled (health)

Used for enabling or disabling all producer based health checks from this component. Notice: Camel has by default disabled all producer based health-checks. You can turn on producer checks globally by setting camel.health.producersEnabled=true.

true

boolean

proxyHost (proxy)

The host name of the proxy that the HTTP clients of Bedrock Agent Runtime connect through. The proxy is used only when the proxyPort option is set too.

String

proxyPort (proxy)

The port of the proxy that the HTTP clients of Bedrock Agent Runtime connect through. The proxy is used only when the proxyHost option is set too.

Integer

proxyProtocol (proxy)

The protocol that the HTTP clients of Bedrock Agent Runtime use to connect to the proxy. It is used only when the proxyHost and proxyPort options are set.

Enum values:

  • HTTP

  • HTTPS

HTTPS

Protocol

accessKey (security)

The access key ID of the AWS credentials, used together with the secretKey option. It is required, unless bedrockAgentRuntimeClient is set or useDefaultCredentialsProvider, useProfileCredentialsProvider or useSessionCredentials is true.

String

secretKey (security)

The secret access key of the AWS credentials, used together with the accessKey option. It is required, unless bedrockAgentRuntimeClient is set or useDefaultCredentialsProvider, useProfileCredentialsProvider or useSessionCredentials is true.

String

sessionToken (security)

The session token of temporary AWS credentials, for example of an assumed IAM role. It is used only when useSessionCredentials is true, together with the accessKey and secretKey options. When it is not set, the accessKey and secretKey options are used without a session token.

String

trustAllCertificates (security)

Whether the HTTP clients of Bedrock Agent Runtime trust every TLS certificate without checking it. It applies to any endpoint, not only to an overridden one, so use it only for testing, for example against a local emulator.

false

boolean

useSessionCredentials (security)

Whether to use temporary credentials made of the accessKey, secretKey and sessionToken options, for example those of an assumed IAM role. It is not used when useDefaultCredentialsProvider or useProfileCredentialsProvider is true.

false

boolean

Endpoint Options

The AWS Bedrock Agent Runtime endpoint is configured using URI syntax:

aws-bedrock-agent-runtime:label

With the following path and query parameters:

Path Parameters

Name Description Default Type

label (producer)

Required A logical name of the endpoint, which you choose freely. The producer does not use it: the knowledge base, agent or flow and the operation are given by options and headers.

String

Query Parameters

Name Description Default Type

knowledgeBaseId (producer)

The ID of the knowledge base that retrieve and retrieveAndGenerate query. The other operations do not use it, and neither do these with pojoRequest.

String

modelId (producer)

The ID or ARN of the model that retrieveAndGenerate generates the answer with, for example anthropic.claude-3-5-sonnet-20241022-v2:0. The other operations do not use it, and neither does retrieveAndGenerate with pojoRequest.

Enum values:

  • amazon.titan-text-express-v1

  • amazon.titan-text-lite-v1

  • amazon.titan-image-generator-v1

  • amazon.titan-embed-text-v1

  • amazon.titan-embed-image-v1

  • amazon.titan-text-premier-v1:0

  • amazon.titan-embed-text-v2:0

  • amazon.titan-image-generator-v2:0

  • amazon.nova-canvas-v1:0

  • amazon.nova-lite-v1:0

  • amazon.nova-micro-v1:0

  • amazon.nova-premier-v1:0

  • amazon.nova-pro-v1:0

  • amazon.nova-reel-v1:0

  • amazon.nova-reel-v1:1

  • amazon.nova-sonic-v1:0

  • amazon.rerank-v1:0

  • ai21.jamba-1-5-large-v1:0

  • ai21.jamba-1-5-mini-v1:0

  • anthropic.claude-3-sonnet-20240229-v1:0

  • anthropic.claude-3-5-sonnet-20240620-v1:0

  • anthropic.claude-3-5-sonnet-20241022-v2:0

  • anthropic.claude-3-haiku-20240307-v1:0

  • anthropic.claude-3-5-haiku-20241022-v1:0

  • anthropic.claude-3-opus-20240229-v1:0

  • anthropic.claude-3-7-sonnet-20250219-v1:0

  • anthropic.claude-opus-4-20250514-v1:0

  • anthropic.claude-sonnet-4-20250514-v1:0

  • cohere.command-r-plus-v1:0

  • cohere.command-r-v1:0

  • cohere.embed-english-v3

  • cohere.embed-multilingual-v3

  • cohere.rerank-v3-5:0

  • meta.llama3-8b-instruct-v1:0

  • meta.llama3-70b-instruct-v1:0

  • meta.llama3-1-8b-instruct-v1:0

  • meta.llama3-1-70b-instruct-v1:0

  • meta.llama3-1-405b-instruct-v1:0

  • meta.llama3-2-1b-instruct-v1:0

  • meta.llama3-2-3b-instruct-v1:0

  • meta.llama3-2-11b-instruct-v1:0

  • meta.llama3-2-90b-instruct-v1:0

  • meta.llama3-3-70b-instruct-v1:0

  • meta.llama4-maverick-17b-instruct-v1:0

  • meta.llama4-scout-17b-instruct-v1:0

  • mistral.mistral-7b-instruct-v0:2

  • mistral.mixtral-8x7b-instruct-v0:1

  • mistral.mistral-large-2402-v1:0

  • mistral.mistral-large-2407-v1:0

  • mistral.mistral-small-2402-v1:0

  • mistral.pixtral-large-2502-v1:0

  • stability.sd3-5-large-v1:0

  • stability.stable-image-control-sketch-v1:0

  • stability.stable-image-control-structure-v1:0

  • stability.stable-image-core-v1:1

String

operation (producer)

Required The operation that the producer performs. The CamelAwsBedrockAgentRuntimeOperation header replaces this option.

Enum values:

  • retrieveAndGenerate

  • invokeFlow

  • invokeAgent

  • invokeInlineAgent

  • retrieve

BedrockAgentRuntimeOperations

overrideEndpoint (producer)

Whether to send the requests to the URI of the uriEndpointOverride option instead of the endpoint of the region. It has no effect when uriEndpointOverride is not set.

false

boolean

pojoRequest (producer)

Whether the body is the request object of the AWS SDK for the operation, which the producer sends as it is: a RetrieveAndGenerateRequest, RetrieveRequest, InvokeFlowRequest, InvokeAgentRequest or InvokeInlineAgentRequest. The options and headers that build the request are then not used, and a body of another type fails the exchange.

false

boolean

profileCredentialsName (producer)

The name of the profile in the AWS shared credentials and config files, used when useProfileCredentialsProvider is true. If not set, the AWS SDK uses its default profile, which the AWS_PROFILE environment variable can change.

false

String

region (producer)

The AWS region of Amazon Bedrock, as a region ID such as us-east-1, which is the value of Region.US_EAST_1.id(). If not set, the AWS SDK takes the region from its default region provider chain, for example the AWS_REGION environment variable.

Enum values:

  • us-east-1

  • us-east-2

  • us-west-2

  • us-gov-west-1

  • ap-northeast-1

  • ap-northeast-2

  • ap-south-1

  • ap-southeast-1

  • ap-southeast-2

  • ca-central-1

  • eu-central-1

  • eu-central-2

  • eu-west-1

  • eu-west-2

  • eu-west-3

  • sa-east-1

String

uriEndpointOverride (producer)

The URI of the endpoint to use instead of the endpoint of the region, for example http://localhost:4566 for a local emulator. It is used only when overrideEndpoint is true.

String

useDefaultCredentialsProvider (producer)

Whether to load the credentials with the default credentials provider chain of the AWS SDK, which looks in system properties, environment variables, the shared credentials and config files, and the container or instance role. It takes precedence over the other credentials options.

false

boolean

useProfileCredentialsProvider (producer)

Whether to load the credentials from a profile of the AWS shared credentials and config files, the one of the profileCredentialsName option. It is not used when useDefaultCredentialsProvider is true, and it takes precedence over the session and static credentials.

false

boolean

lazyStartProducer (producer (advanced))

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

boolean

bedrockAgentRuntimeAsyncClient (advanced)

Autowired To use a custom software.amazon.awssdk.services.bedrockagentruntime.BedrockAgentRuntimeAsyncClient for invokeFlow, invokeAgent and invokeInlineAgent, which receive their response as an event stream. When it is not set, the endpoint builds one from the credentials, region, proxy and endpoint override options: at start when the operation option is one of these, or else on first use. The Camel endpoint does not close a client that is set or autowired.

BedrockAgentRuntimeAsyncClient

bedrockAgentRuntimeClient (advanced)

Autowired To use a custom software.amazon.awssdk.services.bedrockagentruntime.BedrockAgentRuntimeClient for retrieve and retrieveAndGenerate. When this option is set or autowired, the credentials, region, proxy, endpoint override and trustAllCertificates options are not used for this client. The Camel endpoint does not close a client that is set or autowired.

BedrockAgentRuntimeClient

agentAliasId (agent)

The ID of the alias of the agent that invokeAgent invokes. The CamelAwsBedrockAgentRuntimeAgentAliasId header replaces this option.

String

agentId (agent)

The ID of the agent that invokeAgent invokes. The CamelAwsBedrockAgentRuntimeAgentId header replaces this option.

String

enableTrace (agent)

Whether invokeFlow, invokeAgent and invokeInlineAgent ask for the trace events of the invocation, which the producer gives in the CamelAwsBedrockAgentRuntimeFlowTraces or CamelAwsBedrockAgentRuntimeAgentTraces header. The CamelAwsBedrockAgentRuntimeFlowEnableTrace header replaces it for invokeFlow, and the CamelAwsBedrockAgentRuntimeAgentEnableTrace header for the agent operations.

false

boolean

foundationModel (agent)

The ID of the foundation model that the inline agent of invokeInlineAgent uses, for example anthropic.claude-3-5-sonnet-20241022-v2:0. The CamelAwsBedrockAgentRuntimeAgentFoundationModel header replaces this option.

String

instruction (agent)

The instructions that tell the inline agent of invokeInlineAgent what to do and how to interact with users. The CamelAwsBedrockAgentRuntimeAgentInstruction header replaces this option.

String

sessionId (agent)

The ID of the session of invokeAgent and invokeInlineAgent: reuse the same value to continue the conversation. The CamelAwsBedrockAgentRuntimeSessionId header replaces this option. If neither is set, the producer uses a random ID for each message, and gives it in that header.

String

streamOutputMode (agent)

How invokeAgent and invokeInlineAgent give the answer: complete gives the whole text as a String, and chunks gives a List of the text of each chunk. In both modes the producer waits until the agent has finished. The CamelAwsBedrockAgentRuntimeAgentStreamOutputMode header replaces this option.

Enum values:

  • complete

  • chunks

complete

String

flowAliasIdentifier (flow)

The ID of the alias of the flow that invokeFlow invokes. The CamelAwsBedrockAgentRuntimeFlowAliasIdentifier header replaces this option.

String

flowIdentifier (flow)

The ID of the flow that invokeFlow invokes. The CamelAwsBedrockAgentRuntimeFlowIdentifier header replaces this option.

String

proxyHost (proxy)

The host name of the proxy that the HTTP clients of Bedrock Agent Runtime connect through. The proxy is used only when the proxyPort option is set too.

String

proxyPort (proxy)

The port of the proxy that the HTTP clients of Bedrock Agent Runtime connect through. The proxy is used only when the proxyHost option is set too.

Integer

proxyProtocol (proxy)

The protocol that the HTTP clients of Bedrock Agent Runtime use to connect to the proxy. It is used only when the proxyHost and proxyPort options are set.

Enum values:

  • HTTP

  • HTTPS

HTTPS

Protocol

accessKey (security)

The access key ID of the AWS credentials, used together with the secretKey option. It is required, unless bedrockAgentRuntimeClient is set or useDefaultCredentialsProvider, useProfileCredentialsProvider or useSessionCredentials is true.

String

secretKey (security)

The secret access key of the AWS credentials, used together with the accessKey option. It is required, unless bedrockAgentRuntimeClient is set or useDefaultCredentialsProvider, useProfileCredentialsProvider or useSessionCredentials is true.

String

sessionToken (security)

The session token of temporary AWS credentials, for example of an assumed IAM role. It is used only when useSessionCredentials is true, together with the accessKey and secretKey options. When it is not set, the accessKey and secretKey options are used without a session token.

String

trustAllCertificates (security)

Whether the HTTP clients of Bedrock Agent Runtime trust every TLS certificate without checking it. It applies to any endpoint, not only to an overridden one, so use it only for testing, for example against a local emulator.

false

boolean

useSessionCredentials (security)

Whether to use temporary credentials made of the accessKey, secretKey and sessionToken options, for example those of an assumed IAM role. It is not used when useDefaultCredentialsProvider or useProfileCredentialsProvider is true.

false

boolean

Message Headers

The AWS Bedrock Agent Runtime component supports the following message header(s), which is/are listed below:

Name Description Default Type

CamelAwsBedrockAgentRuntimeOperation (producer)

Constant: OPERATION

The operation that the producer performs. It replaces the operation option.

String

CamelAwsBedrockAgentRuntimeCitations (producer)

Constant: CITATIONS

The citations of the answer, which link its parts to the sources that they come from. Set by retrieveAndGenerate, invokeAgent and invokeInlineAgent when the answer has citations.

List

CamelAwsBedrockAgentRuntimeSessionId (producer)

Constant: SESSION_ID

The ID of the session. retrieveAndGenerate, invokeAgent and invokeInlineAgent read it to continue a session, and set it to the session of the response; for the agent operations it replaces the sessionId option.

String

CamelAwsBedrockAgentRuntimeAgentId (producer)

Constant: AGENT_ID

The ID of the agent for invokeAgent. It replaces the agentId option.

String

CamelAwsBedrockAgentRuntimeAgentAliasId (producer)

Constant: AGENT_ALIAS_ID

The ID of the alias of the agent for invokeAgent. It replaces the agentAliasId option.

String

CamelAwsBedrockAgentRuntimeAgentEnableTrace (producer)

Constant: AGENT_ENABLE_TRACE

Whether invokeAgent and invokeInlineAgent ask for the trace events of the invocation. It replaces the enableTrace option for them.

Boolean

CamelAwsBedrockAgentRuntimeAgentEndSession (producer)

Constant: AGENT_END_SESSION

Whether invokeAgent and invokeInlineAgent end the session after this invocation.

Boolean

CamelAwsBedrockAgentRuntimeAgentMemoryId (producer)

Constant: AGENT_MEMORY_ID

The ID of the memory of the agent for invokeAgent, which keeps a summary of the earlier sessions. invokeInlineAgent does not read it.

String

CamelAwsBedrockAgentRuntimeAgentStreamOutputMode (producer)

Constant: AGENT_STREAM_OUTPUT_MODE

The output mode of invokeAgent and invokeInlineAgent: complete or chunks. It replaces the streamOutputMode option.

String

CamelAwsBedrockAgentRuntimeAgentFoundationModel (producer)

Constant: AGENT_FOUNDATION_MODEL

The ID of the foundation model of the inline agent for invokeInlineAgent. It replaces the foundationModel option.

String

CamelAwsBedrockAgentRuntimeAgentInstruction (producer)

Constant: AGENT_INSTRUCTION

The instructions of the inline agent for invokeInlineAgent. It replaces the instruction option.

String

CamelAwsBedrockAgentRuntimeAgentTraces (producer)

Constant: AGENT_TRACES

The trace events of the invocation: TracePart elements for invokeAgent, and InlineAgentTracePart elements for invokeInlineAgent. Set when the trace is enabled and the agent sends trace events.

List

CamelAwsBedrockAgentRuntimeAgentReturnControl (producer)

Constant: AGENT_RETURN_CONTROL

The actions that the agent returns to the caller to carry out, instead of calling an action group itself: ReturnControlPayload elements for invokeAgent, and InlineAgentReturnControlPayload elements for invokeInlineAgent. Set when the agent returns control.

List

CamelAwsBedrockAgentRuntimeAgentFiles (producer)

Constant: AGENT_FILES

The files that the agent generated: FilePart elements for invokeAgent, and InlineAgentFilePart elements for invokeInlineAgent. Set when the agent sends files.

List

CamelAwsBedrockAgentRuntimeFlowIdentifier (producer)

Constant: FLOW_IDENTIFIER

The ID of the flow for invokeFlow. It replaces the flowIdentifier option.

String

CamelAwsBedrockAgentRuntimeFlowAliasIdentifier (producer)

Constant: FLOW_ALIAS_IDENTIFIER

The ID of the alias of the flow for invokeFlow. It replaces the flowAliasIdentifier option.

String

CamelAwsBedrockAgentRuntimeFlowEnableTrace (producer)

Constant: FLOW_ENABLE_TRACE

Whether invokeFlow asks for the trace events of the flow. It replaces the enableTrace option for invokeFlow.

Boolean

CamelAwsBedrockAgentRuntimeFlowExecutionId (producer)

Constant: FLOW_EXECUTION_ID

The ID of a flow execution that invokeFlow continues, for a flow that waits for more input, as in a multi-turn conversation.

String

CamelAwsBedrockAgentRuntimeFlowOutputs (producer)

Constant: FLOW_OUTPUTS

The output events of the flow, set by invokeFlow, as an empty List when the flow has no output. The body is the document of the last one.

List

CamelAwsBedrockAgentRuntimeFlowTraces (producer)

Constant: FLOW_TRACES

The trace events of the flow. Set by invokeFlow when the trace is enabled and the flow sends trace events.

List

CamelAwsBedrockAgentRuntimeFlowCompletionReason (producer)

Constant: FLOW_COMPLETION_REASON

The reason why the flow completed: SUCCESS, or INPUT_REQUIRED when it waits for more input. Set by invokeFlow when the flow sends a completion event.

String

CamelAwsBedrockAgentRuntimeRetrievedResults (producer)

Constant: RETRIEVED_RESULTS

The results that retrieve found in the knowledge base, the same List as the body.

List

CamelAwsBedrockAgentRuntimeNumberOfResults (producer)

Constant: NUMBER_OF_RESULTS

The maximum number of results that retrieve returns. If not set, Amazon Bedrock uses its default.

Integer

CamelAwsBedrockAgentRuntimeSearchType (producer)

Constant: OVERRIDE_SEARCH_TYPE

The search type of retrieve: HYBRID, which combines the vector search with a text search, or SEMANTIC, which uses the vector search only. If not set, Amazon Bedrock chooses one.

String

CamelAwsBedrockAgentRuntimeNextToken (producer)

Constant: NEXT_TOKEN

The token of the next page of the results of retrieve. Set it to get that page; retrieve sets it when there are more results, and removes it when there are none.

String

CamelAwsBedrockAgentRuntimeRetrieveGuardrailAction (producer)

Constant: RETRIEVE_GUARDRAIL_ACTION

Whether the guardrail of the knowledge base intervened in retrieve: INTERVENED or NONE. Set by retrieve when the response has it, and removed otherwise.

String

Message Body

The message body at each side of the AWS Bedrock Agent Runtime component: Consumer is the body of the messages the consumer creates, Consumer reply the bodies a consumer that answers its caller can reply with, Producer input the bodies the producer can send or write, and Producer output the body after the producer.

Side Body Description

Producer input

text, bytes, stream, file or map

The question, the query or the input of the agent as text for retrieveAndGenerate, retrieve, invokeAgent and invokeInlineAgent: bytes, a stream or a file are read as text, a Map or a Jackson JsonNode is sent as JSON text, another POJO as its toString(), so take the text out of it first, and no body fails. invokeFlow takes a String, which becomes the document of the input node FlowInputNode, or a FlowInput or a List of FlowInput of the AWS SDK: another body is read as text, as for the other operations. With pojoRequest=true the request of the AWS SDK for the operation, such as a RetrieveAndGenerateRequest: another body fails.

  • With operation=invokeFlow: text, bytes, stream, file, map, list or pojo

Producer output

text or list

The answer as text for retrieveAndGenerate, with the citations and the session id in headers, and a List of KnowledgeBaseRetrievalResult for retrieve. invokeAgent and invokeInlineAgent give the answer as text, or a List of the chunks with streamOutputMode=chunks or the CamelAwsBedrockAgentRuntimeAgentStreamOutputMode header; the text is empty when the agent returns control. invokeFlow gives the document of the last output of the flow as text, or as a Document of the AWS SDK for another type, and keeps the body when the flow has no output.

  • With operation=retrieveAndGenerate: text (java.lang.String)

  • With operation=retrieve: list (java.util.List<software.amazon.awssdk.services.bedrockagentruntime.model.KnowledgeBaseRetrievalResult>)

  • With operation=invokeFlow: text, pojo or unchanged

The bodies are the ones with the default options. A side that is not listed is not known, and tooling does not guess it. The carriers, the sides and the tools that use them are described in Message Body Types.

Required Bedrock component options

You have to provide the bedrockAgentRuntimeClient in the Registry or your accessKey and secretKey to access the Amazon Bedrock service.

Usage

Supported operations

The component supports the following operations on the operation URI option:

  • retrieveAndGenerate — Query a Bedrock Knowledge Base and generate a grounded response from the selected model.

  • retrieve — Run a semantic search against a Bedrock Knowledge Base and return the matched chunks without LLM generation.

  • invokeFlow — Invoke a Bedrock Flow by id/alias and stream the resulting events back as Camel message headers.

  • invokeAgent — Invoke a deployed Bedrock Agent by id/alias and stream the response back.

  • invokeInlineAgent — Invoke an agent defined inline at invocation time (foundation model plus instruction).

The CamelAwsBedrockAgentRuntimeOperation header overrides the operation option per exchange. With neither set, the exchange fails with an IllegalArgumentException.

Retrieving from a Bedrock Knowledge Base

The retrieve operation performs a semantic search against a Bedrock Knowledge Base and returns the matching chunks without invoking an LLM. Use this when you want to plug retrieval into your own generation step, inspect retrieval quality, or build pagination on top of the knowledge base.

Mandatory options:

  • knowledgeBaseId — the id of the Bedrock Knowledge Base to query.

The body of the in-message is the search query as a String. A Map or a Jackson JsonNode body is sent as JSON text, and another body is converted to a String. When pojoRequest=true, the body must be a RetrieveRequest (any retrieval-config knobs in that POJO are honored verbatim).

The retrieval configuration can be tuned per exchange via the following headers:

  • CamelAwsBedrockAgentRuntimeNumberOfResults (Integer) — maximum number of chunks to return.

  • CamelAwsBedrockAgentRuntimeSearchType (String) — overrides the search type (HYBRID or SEMANTIC).

  • CamelAwsBedrockAgentRuntimeNextToken (String) — pagination token returned by a previous call.

The producer surfaces the matched chunks as the out-message body (a List<KnowledgeBaseRetrievalResult>) and on the following headers:

  • CamelAwsBedrockAgentRuntimeRetrievedResults — the same List<KnowledgeBaseRetrievalResult> available on the body.

  • CamelAwsBedrockAgentRuntimeNextToken — present when the response carries a pagination token.

  • CamelAwsBedrockAgentRuntimeRetrieveGuardrailAction — present when the knowledge base applies a guardrail action.

Invoking a Bedrock Flow

The invokeFlow operation streams flow events using the AWS SDK async client; the producer transparently allocates a BedrockAgentRuntimeAsyncClient when the endpoint is configured with operation=invokeFlow. When the CamelAwsBedrockAgentRuntimeOperation header picks invokeFlow, invokeAgent or invokeInlineAgent on an endpoint of another operation, the async client is created when the first exchange needs it.

Mandatory options:

  • flowIdentifier — the unique id of the flow to invoke (overridable via the CamelAwsBedrockAgentRuntimeFlowIdentifier header).

  • flowAliasIdentifier — the unique id of the flow alias to invoke (overridable via the CamelAwsBedrockAgentRuntimeFlowAliasIdentifier header).

Optional options:

  • enableTrace — when true, the producer collects the emitted FlowTraceEvent`s into the `CamelAwsBedrockAgentRuntimeFlowTraces header (overridable via CamelAwsBedrockAgentRuntimeFlowEnableTrace).

The body of the in-message can be:

  • a String — wrapped in a single FlowInput targeting node FlowInputNode, output document;

  • a FlowInput instance — used as the sole input to the flow;

  • a List<FlowInput> — passed verbatim to the request (use this form to chain multiple flow inputs);

  • a Map or a Jackson JsonNode — marshalled to JSON text and used as above;

  • another body, such as a byte[], an InputStream or a file, is converted to a String and used as above.

When pojoRequest=true, the body must be an InvokeFlowRequest and is sent unchanged.

The producer collects emitted events into headers:

  • CamelAwsBedrockAgentRuntimeFlowOutputs — the list of `FlowOutputEvent`s emitted by the flow.

  • CamelAwsBedrockAgentRuntimeFlowTraces — the list of `FlowTraceEvent`s (only when tracing is enabled).

  • CamelAwsBedrockAgentRuntimeFlowCompletionReason — the completion reason reported by the flow (when present).

The out-message body is the document of the last FlowOutputEvent (decoded as String when the document is a string, otherwise the raw Document). When the flow emits no outputs, the body is left untouched.

Invoking a Bedrock Agent

The invokeAgent operation invokes a deployed Bedrock Agent. Like invokeFlow it uses the AWS SDK async client, and the producer transparently allocates a BedrockAgentRuntimeAsyncClient when the endpoint is configured with operation=invokeAgent.

Mandatory options:

  • agentId — the unique id of the agent to invoke (overridable via the CamelAwsBedrockAgentRuntimeAgentId header).

  • agentAliasId — the unique id of the agent alias (overridable via the CamelAwsBedrockAgentRuntimeAgentAliasId header).

The in-message body is the input text sent to the agent. A Map or a Jackson JsonNode body is sent as JSON text, and another body is converted to a String. When pojoRequest=true, the body must be an InvokeAgentRequest and is sent unchanged.

The agent APIs are session based. Set sessionId on the endpoint, or the CamelAwsBedrockAgentRuntimeSessionId header, to continue an existing conversation; when neither is supplied a random session id is generated for the invocation. The session id used is always echoed back on the CamelAwsBedrockAgentRuntimeSessionId header of the out-message so a route can reuse it on the next call.

  • Java

  • YAML

from("direct:agent")
    .to("aws-bedrock-agent-runtime://label?operation=invokeAgent&agentId=RAWAGENTID&agentAliasId=RAWALIASID");
- route:
    from:
      uri: direct:agent
      steps:
        - to:
            uri: aws-bedrock-agent-runtime:label
            parameters:
              operation: invokeAgent
              agentId: RAWAGENTID
              agentAliasId: RAWALIASID

Invoking an inline Bedrock Agent

The invokeInlineAgent operation defines the agent at invocation time instead of referencing a deployed one.

Mandatory options:

  • foundationModel — the model backing the agent (overridable via the CamelAwsBedrockAgentRuntimeAgentFoundationModel header).

  • instruction — the instruction given to the agent (overridable via the CamelAwsBedrockAgentRuntimeAgentInstruction header).

For the richer inline options (action groups, knowledge bases, collaborators, guardrails), set pojoRequest=true and send an InvokeInlineAgentRequest body, which is passed to AWS unchanged.

Agent response and streaming output

Both agent operations stream their response. The producer collects the emitted events into headers:

  • CamelAwsBedrockAgentRuntimeAgentTraces — the trace events (only when tracing is enabled via enableTrace or the CamelAwsBedrockAgentRuntimeAgentEnableTrace header).

  • CamelAwsBedrockAgentRuntimeAgentReturnControl — the return-control payloads, emitted when the agent asks the caller to fulfil an action.

  • CamelAwsBedrockAgentRuntimeAgentFiles — the files emitted by the agent.

  • CamelAwsBedrockAgentRuntimeCitations — the citations attributed to the response chunks.

The out-message body depends on streamOutputMode:

  • complete (the default) — the response chunks are accumulated and the body is the full text as a String.

  • chunks — the body is the List<String> of individual chunks.

The mode can be overridden per exchange with the CamelAwsBedrockAgentRuntimeAgentStreamOutputMode header.

Static credentials, Default Credential Provider and Profile Credentials Provider

You have the possibility of avoiding the usage of explicit static credentials by specifying the useDefaultCredentialsProvider option and set it to true.

The order of evaluation for Default Credentials Provider is the following:

  • Java system properties - aws.accessKeyId and aws.secretKey.

  • Environment variables - AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

  • Web Identity Token from AWS STS.

  • The shared credentials and config files.

  • Amazon ECS container credentials - loaded from the Amazon ECS if the environment variable AWS_CONTAINER_CREDENTIALS_RELATIVE_URI is set.

  • Amazon EC2 Instance profile credentials.

You have also the possibility of using Profile Credentials Provider, by specifying the useProfileCredentialsProvider option to true and profileCredentialsName to the profile name.

Only one of static, default and profile credentials could be used at the same time.

For more information about this you can look at AWS credentials documentation

Dependencies

Maven users will need to add the following dependency to their pom.xml.

pom.xml

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-aws-bedrock</artifactId>
    <version>${camel-version}</version>
</dependency>

where ${camel-version} must be replaced by the actual version of Camel.