Camel Components

A2A

Since Camel 4.21

Both producer and consumer are supported

The A2A component implements the Agent-to-Agent (A2A) v1.0 protocol, enabling Camel routes to both expose and call A2A-compliant agents.

As a consumer, it turns a Camel route into an A2A agent — automatically serving an agent card at /.well-known/agent-card.json, exposing all A2A operations via HTTP, and managing task state. As a producer, it calls remote A2A agents with automatic agent card discovery, protocol wrapping, and credential management.

The component follows the same design philosophy as REST OpenAPI: it handles protocol plumbing and delegates business logic entirely to the route.

A2A Protocol

The A2A protocol is an open standard for communication between AI agents. It defines how agents discover each other (via agent cards), exchange messages, manage long-running tasks, stream progress updates, and deliver push notifications. The protocol supports both REST (HTTP+JSON) and JSON-RPC 2.0 bindings over HTTP.

Preview Limitations

The A2A component is Preview in Camel 4.21. It targets the A2A v1.0 protocol, but endpoint options, model classes, generated metadata, and the task-store SPI may still change before the component reaches stable support.

Current Preview limitations:

  • Extended Agent Card / GetExtendedAgentCard is not implemented in this first release.

  • Consumers validate operation requests by default. Local-only examples in this page set validateAuth=false; network-exposed agents should use an agent card with securitySchemes and securityRequirements plus apiKey, bearerToken, or oauthProfile endpoint configuration.

  • The REST binding uses A2A custom-method paths containing colons, such as /message:send. These paths collide on Vert.x/platform-http. Use protocolBinding=JSONRPC with platform-http, or use httpServerComponent=undertow or httpServerComponent=jetty for REST custom-method routes.

  • Real-time SSE streaming is verified with Vert.x/platform-http, Undertow, and Jetty.

  • The default task store is in-memory and single-JVM. Register a custom A2ATaskStore for durable or cross-node task state.

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

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-a2a</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

Consumer routes also need an HTTP server component at runtime. For example, add camel-platform-http-vertx for JSON-RPC agents (including SSE streaming), or camel-undertow / camel-jetty for REST custom-method routes. See Dependencies and HTTP Server Component Discovery.

URI Format

a2a:agentCardSource[?options]

How agentCardSource determines where the agent card is loaded from:

Source Example

Remote URL (partial)

a2a:\https://agent.example.com — auto-expands to https://agent.example.com/.well-known/agent-card.json

Remote URL (full)

a2a:\https://agent.example.com/.well-known/agent-card.json

Classpath

a2a:classpath:cards/weather.json

File

a2a:file:/etc/agents/weather.json

Plain name

a2a:weather-agent?name=Weather&description=…​ — card built from params

The same URI works in both from() (consumer: "I am this agent") and to() (producer: "I am calling this agent").

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 A2A component supports the following options which are listed below.

Name Description Default Type

bridgeErrorHandler (consumer)

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored.

false

boolean

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

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

Endpoint Options

The A2A endpoint is configured using URI syntax:

a2a:agentCardSource

With the following path and query parameters:

Path Parameters

Name Description Default Type

agentCardSource (common)

Required Where the agent card comes from: a JSON file on the classpath (classpath:) or in the file system (file:), an http:// or https:// URL that the endpoint downloads the card from when it starts, or a plain name, which is the agent name when no card gives one. A URL that does not end with .json gets the path /.well-known/agent-card.json. The consumer serves the card as its own. The producer calls the URL that the card gives for protocolBinding, or this URL without the well-known path when the card gives none or when apiKey, bearerToken or oauthProfile is set.

String

Query Parameters

Name Description Default Type

agentCard (common)

An agent card, usually a reference to an org.apache.camel.component.a2a.model.AgentCard bean in the registry. The fields that it sets replace those of the card from agentCardSource, and the name, description and version options replace its fields in turn.

AgentCard

basePath (common)

The path prefix of the HTTP routes of the consumer, also of the path of its agent card, for example /agents/weather. The producer adds it to the URL of the remote agent only when the host option is set. A missing leading slash is added and a trailing slash removed.

String

dataFormat (common)

The form of the message body. PAYLOAD: the text of the message parts, one per line, where a Task of the producer gives the parts of the last message of its history. POJO: the model object, which is the Message of the request on the consumer and the Task or the Message of the response on the producer. RAW: JSON text, which is the Message of the request on the consumer and the response as received on the producer (an InputStream of the events for MESSAGE_STREAM and TASK_SUBSCRIBE), where the producer sets no A2A header but CamelA2AMethod. The reply of the consumer does not depend on it.

Enum values:

  • PAYLOAD

  • POJO

  • RAW

PAYLOAD

A2ADataFormat

description (common)

The description of the agent, which replaces the description of the agent card from agentCardSource and agentCard. If the card declares no skills, it is also the description of the default skill of the card.

String

historyLength (common)

Not used: the endpoint only checks when it starts that the value is not negative. The producer takes the history length of TASK_GET and TASK_SUBSCRIBE from the CamelA2AHistoryLength header, and that of TASK_LIST from the CamelA2AListHistoryLength header.

Integer

host (common)

The host of the remote agent that the producer calls, in place of the URL of the agent card and of agentCardSource, for example for tests. Without an http:// or https:// prefix, https is used. The port and basePath options are added to it. The consumer does not use it.

String

name (common)

The name of the agent, which replaces the name of the agent card from agentCardSource and agentCard. If no card gives a name, a plain name in agentCardSource is used, and the endpoint fails to start without a name.

String

port (common)

The port of the remote agent that the producer calls. Only used with the host option. The consumer does not use it.

Integer

protocolBinding (common)

The A2A protocol binding. HTTP+JSON is the REST binding, with a path per operation such as /message:send, and JSONRPC posts JSON-RPC 2.0 requests to the base path. The consumer serves only this binding, and the producer calls the URL that the agent card gives for this binding. The aliases rest and jsonrpc are also accepted, in any case.

Enum values:

  • HTTP+JSON

  • JSONRPC

HTTP+JSON

String

returnImmediately (common)

Whether the consumer answers SendMessage at once with a task in state TASK_STATE_SUBMITTED and runs the route in the background, so that the client polls the task with GetTask. The returnImmediately and blocking fields of the configuration of the request take precedence. With protocolBinding HTTP+JSON, a SendStreamingMessage request for which it is true is rejected. The producer does not use it.

false

boolean

validateAuth (common)

Whether the consumer checks the credentials of each request, except the request for the agent card, against the security requirements of its agent card, with the apiKey, bearerToken or oauthProfile option. If true, the card must declare securitySchemes, or every request is rejected. If false, the consumer accepts requests without credentials. The producer does not use it.

true

boolean

version (common)

The version of the agent, which replaces the version of the agent card from agentCardSource and agentCard. If no card gives a version, 1.0 is used.

String

bridgeErrorHandler (consumer (advanced))

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored.

false

boolean

exceptionHandler (consumer (advanced))

To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored.

ExceptionHandler

exchangePattern (consumer (advanced))

Sets the exchange pattern when the consumer creates an exchange.

Enum values:

  • InOnly

  • InOut

ExchangePattern

httpServerComponent (consumer (advanced))

The name of the Camel component that serves the HTTP routes of the consumer, which must implement RestConsumerFactory, for example platform-http, undertow or jetty. If not set, the consumer uses the component of the REST configuration (camel.rest.component), else platform-http, else the only RestConsumerFactory among the components or in the registry.

String

maxConcurrentTasks (consumer (advanced))

The maximum number of SendMessage and SendStreamingMessage requests that the consumer processes at the same time. A request beyond the limit is rejected with a ServerBusyError, which is HTTP status 429 with protocolBinding HTTP+JSON, unless it can wait in the queue of taskQueueSize. Use 0 for no limit.

0

int

sseHeartbeatInterval (consumer (advanced))

The interval in milliseconds at which the consumer writes a heartbeat comment line (:) to a server-sent event stream that has no event to send, so that proxies do not close the idle connection. Used for SendStreamingMessage and SubscribeToTask.

15000

long

sseQueueCapacity (consumer (advanced))

The number of server-sent events that the consumer buffers per stream for a slow client, at least 2. When the buffer is full, the consumer drops a new event and logs a warning, but for the final events of the stream it drops older events instead.

1000

int

taskQueueSize (consumer (advanced))

The number of SendMessage requests with returnImmediately that can wait in a queue, as tasks in state TASK_STATE_SUBMITTED, while maxConcurrentTasks requests are in progress. Only used when maxConcurrentTasks is greater than 0. Use 0 for no queue, so that these requests are rejected at once.

0

int

operation (producer)

The operation that the producer performs. The CamelA2AOperation header replaces it for a message.

Enum values:

  • MESSAGE_SEND

  • MESSAGE_STREAM

  • TASK_GET

  • TASK_LIST

  • TASK_CANCEL

  • TASK_SUBSCRIBE

  • PUSH_CONFIG_CREATE

  • PUSH_CONFIG_GET

  • PUSH_CONFIG_LIST

  • PUSH_CONFIG_DELETE

MESSAGE_SEND

A2AOperations

connectTimeout (producer (advanced))

The connect timeout in milliseconds of the HTTP connections of the endpoint: the requests of the producer, the push notifications that the consumer sends, and the download of the agent card from an HTTP URL when the endpoint starts. It is also the timeout of the whole download of the agent card.

30000

long

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

streamingReadTimeout (producer (advanced))

The time in milliseconds that the producer waits for the next line of a server-sent event stream, for MESSAGE_STREAM and TASK_SUBSCRIBE, before it closes the stream with an error. The heartbeat comments of the remote agent count as lines. Use 0 for no timeout.

300000

long

asyncTimeout (advanced)

The timeout in milliseconds of the route that the consumer runs in the background, for SendMessage with returnImmediately and for SendStreamingMessage: the consumer then cancels it and marks the task as failed. Use 0 for no timeout on the consumer. The producer uses it as the timeout of the response to its MESSAGE_STREAM and TASK_SUBSCRIBE requests, where it must be greater than 0, and a fixed timeout of 60 seconds for the other operations.

300000

long

completedTaskTtl (advanced)

The time in milliseconds that the in-memory task store of the consumer keeps a task after it reached a final state: completed, failed, canceled or rejected. Not used when the registry holds an A2ATaskStore, which the endpoint then uses as its task store.

3600000

long

followRedirects (advanced)

Whether the producer follows HTTP redirects of the remote agent. Disabled by default, as a redirect to another host would also receive the credentials of the producer. The download of the agent card and the push notifications of the consumer never follow redirects.

false

boolean

maxPayloadSize (advanced)

The maximum size in bytes of a request body that the consumer reads, and of a response body or a single server-sent event that the producer reads. The consumer rejects a larger request, and the producer fails the exchange. The agent card has its own limit of 1 MB.

6291456

long

pushRetryAttempts (advanced)

The number of times that the consumer retries a push notification after a network error or a webhook response with a status other than 2xx and 4xx. A 4xx status is not retried, and 410 Gone also removes the push notification config. Between 0 and 30, where 0 sends each notification once.

3

int

pushRetryBackoffMs (advanced)

The delay in milliseconds before the first retry of a push notification, doubled for each further retry and capped at one hour. At most 3600000, and greater than 0 when pushRetryAttempts is greater than 0.

1000

long

allowLocalWebhookUrls (security)

Whether the consumer accepts push notification webhook URLs whose host resolves to a loopback address, such as localhost or 127.0.0.1, also with http. By default these URLs are rejected, like the URLs to private, link-local and other non-public addresses, which this option does not allow. For local development only.

false

boolean

apiKey (security)

The API key, for the security schemes of type apiKey in the agent card. The producer sends it in the header, query parameter or cookie that the scheme names, with the Bearer prefix in the Authorization header. The consumer compares the key of each request with it when validateAuth is true.

String

apiKeyHeader (security)

The name of the header, query parameter or cookie that holds the API key, for a security scheme of type apiKey in the agent card that gives no name.

Authorization

String

bearerToken (security)

The bearer token, for the security schemes of type http in the agent card. The producer sends it in the Authorization header when oauthProfile is not set or gives no token. The consumer compares the bearer token of each request with it, also for the oauth2 and openIdConnect schemes, when validateAuth is true and oauthProfile is not set.

String

oauthProfile (security)

The name of a camel-oauth profile, for the security schemes of type oauth2, openIdConnect and http in the agent card. The producer gets an access token with the OAuth 2.0 client credentials grant, from the client-id, client-secret and token-endpoint properties of the profile under camel.oauth, and sends it as a bearer token. The consumer validates the bearer token of each request with this profile when validateAuth is true. Requires camel-oauth, or for the consumer another OAuthTokenValidationFactory.

String

Message Headers

The A2A component supports the following message header(s), which is/are listed below:

Name Description Default Type

CamelA2AOperation (producer)

Constant: OPERATION

The operation that the producer performs, in place of the operation option: the enum name, such as TASK_GET, or the A2A method name, such as GetTask. For an unknown value, the producer logs a warning and uses the operation option.

String

CamelA2ARequestOperation (consumer)

Constant: REQUEST_OPERATION

The A2A method of the request that the consumer passes to the route: SendMessage or SendStreamingMessage, as the consumer answers the other methods itself. Also set as an exchange property of the same name.

String

CamelA2ARequestTaskId (consumer)

Constant: REQUEST_TASK_ID

The id of the task that the consumer created or continues for the request. The reply of the consumer uses the exchange property of the same name, not this header.

String

CamelA2ARequestContextId (consumer)

Constant: REQUEST_CONTEXT_ID

The context id of the request: the contextId of the message, else that of the task that it continues, else a new id. The reply of the consumer uses the exchange property of the same name, not this header.

String

CamelA2AReplyTaskState (consumer)

Constant: REPLY_TASK_STATE

The state of the task in the reply of the consumer to SendMessage, set by the route, for example TASK_STATE_INPUT_REQUIRED. If not set, the task is TASK_STATE_COMPLETED, and an unknown value gives TASK_STATE_UNSPECIFIED. Not used for SendStreamingMessage, whose task ends as TASK_STATE_COMPLETED.

String

CamelA2AReplyType (consumer)

Constant: REPLY_TYPE

The kind of reply of the consumer to SendMessage, set by the route: task, the default, for a task that holds the reply message, or message for the reply message alone. The consumer does not keep a task that it created for a request answered with a message.

String

CamelA2ATaskId (producer)

Constant: TASK_ID

The id of the task for the producer operations TASK_GET, TASK_CANCEL, TASK_SUBSCRIBE and the PUSH_CONFIG operations. The producer sets it to the id of the task of the response of MESSAGE_SEND, TASK_GET and TASK_CANCEL. MESSAGE_SEND and MESSAGE_STREAM do not read it: to continue a task, send a Message whose taskId is set.

String

CamelA2APushConfigId (common)

Constant: PUSH_CONFIG_ID

The id of the push notification config for the producer operations PUSH_CONFIG_GET and PUSH_CONFIG_DELETE, which the producer sets from the response of PUSH_CONFIG_CREATE and PUSH_CONFIG_GET. With protocolBinding HTTP+JSON, these two operations do not read it, and take the task id and the config id from the CamelA2ATaskId header written as taskId:configId.

String

CamelA2AContextId (producer)

Constant: CONTEXT_ID

The context id that the producer sets on the message that it sends with MESSAGE_SEND or MESSAGE_STREAM, unless the body is a SendMessageRequest. The producer sets it to the context id of the task of the response of MESSAGE_SEND, TASK_GET and TASK_CANCEL.

String

CamelA2AMessageId (common)

Constant: MESSAGE_ID

The id of a message. The consumer sets it to the messageId of the message of the request. The producer sets it to the messageId of a response that is a message, not a task.

String

CamelA2ATaskState (producer)

Constant: TASK_STATE

The state of the task of the response of the producer, for MESSAGE_SEND, TASK_GET and TASK_CANCEL, for example TASK_STATE_COMPLETED or TASK_STATE_WORKING.

String

CamelA2AMethod (producer)

Constant: METHOD

The A2A method that the producer called, for example SendMessage or GetTask.

String

CamelA2AResponseType (producer)

Constant: RESPONSE_TYPE

The kind of response that the producer received: task, message, taskList, pushConfigList or stream. Not set for PUSH_CONFIG_CREATE, PUSH_CONFIG_GET and PUSH_CONFIG_DELETE, nor with dataFormat RAW. The CamelA2AReplyType header sets the kind of reply of the consumer instead.

String

CamelA2AReturnImmediately (common)

Constant: RETURN_IMMEDIATELY

Not used: the consumer looks for it in the HTTP request after it removed every header whose name starts with Camel, so the configuration of the request and the returnImmediately option apply. The producer does not send it.

Boolean

CamelA2AHistoryLength (common)

Constant: HISTORY_LENGTH

The maximum number of the latest messages of the task history that the remote agent returns, for the producer operations TASK_GET and TASK_SUBSCRIBE.

Integer

CamelA2AStreamEmitter (consumer)

Constant: STREAM_EMITTER

The emitter of the server-sent event stream of a SendStreamingMessage request, which the route can use to send status updates, artifacts and messages of the task to the client. Only set for SendStreamingMessage.

A2AStreamEmitter

CamelA2AListContextId (common)

Constant: LIST_CONTEXT_ID

Only list the tasks of this context id, for the producer operation TASK_LIST.

String

CamelA2AListPageSize (common)

Constant: LIST_PAGE_SIZE

The maximum number of tasks of the page that the remote agent returns, for the producer operation TASK_LIST.

Integer

CamelA2AListPageToken (common)

Constant: LIST_PAGE_TOKEN

The token of the page of tasks to return, for the producer operation TASK_LIST: the nextPageToken of the previous response, which only dataFormat RAW gives.

String

CamelA2AListIncludeArtifacts (common)

Constant: LIST_INCLUDE_ARTIFACTS

Whether the remote agent includes the artifacts of the tasks, for the producer operation TASK_LIST.

Boolean

CamelA2AListHistoryLength (common)

Constant: LIST_HISTORY_LENGTH

The maximum number of the latest messages of the history of each task that the remote agent returns, for the producer operation TASK_LIST.

Integer

CamelA2AListStatusTimestampAfter (common)

Constant: LIST_STATUS_TIMESTAMP_AFTER

Only list the tasks whose status changed after this time, an ISO-8601 date-time with an offset, for the producer operation TASK_LIST.

String

CamelA2AListStatus (common)

Constant: LIST_STATUS

Only list the tasks in these states, a comma-separated list such as TASK_STATE_WORKING,TASK_STATE_COMPLETED, for the producer operation TASK_LIST.

String

CamelA2AExtensions (consumer)

Constant: EXTENSIONS

The URIs of the A2A extensions that the client requested in the A2A-Extensions HTTP header and that the agent card of the consumer declares. Also set as an exchange property of the same name.

List

Message Body

The message body at each side of the A2A 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

Consumer

text

The message of the caller, for SendMessage and SendStreamingMessage (the component answers the task and push config requests itself): the text of its parts, one per line, a data part as JSON and a file part as its URL. With dataFormat POJO the Message, with RAW the Message as JSON.

  • With dataFormat=POJO: pojo (org.apache.camel.component.a2a.model.Message)

Consumer reply

text, bytes, stream, file or pojo

The reply of the agent: text, sent as one text part (bytes, a stream or a file as their text), or Message content with the consumer task/context identity. Another body is sent as text: a Task as the text of its last message, a Map or a POJO as its toString(): marshal it first. The reply goes in a Task, completed unless the CamelA2AReplyTaskState header says another state, or as a Message when the CamelA2AReplyType header is message.

Producer input

text, bytes, stream, file or pojo

The message to send: text, sent as one text part (bytes, a stream or a file as their text), or a Message. Forwarding the original consumer Message instance strips its task/context IDs; route-supplied copies retain theirs. MESSAGE_STREAM also takes a SendMessageRequest. Another body is sent as its toString(), so a Map or a POJO needs marshalling first, and JSON text is sent as text. PUSH_CONFIG_CREATE needs a TaskPushNotificationConfig, and the other operations read headers, not the body.

  • With operation=TASK_GET: any

  • With operation=TASK_LIST: any

  • With operation=TASK_CANCEL: any

  • With operation=TASK_SUBSCRIBE: any

  • With operation=PUSH_CONFIG_CREATE: pojo (org.apache.camel.component.a2a.model.TaskPushNotificationConfig)

  • With operation=PUSH_CONFIG_GET: any

  • With operation=PUSH_CONFIG_LIST: any

  • With operation=PUSH_CONFIG_DELETE: any

Producer output

text

The reply of the agent as text: the parts of the Message, or of the last message in the history of the Task, one per line. TASK_GET and TASK_CANCEL give the text of the Task, TASK_LIST a List of Task, MESSAGE_STREAM and TASK_SUBSCRIBE an Iterator of the events as they arrive (split it), and the push config operations a TaskPushNotificationConfig, a List of them, or an empty Map for delete. With dataFormat POJO the Task or the Message, with RAW the JSON of the response as text (a stream of the events for MESSAGE_STREAM and TASK_SUBSCRIBE).

  • With operation=MESSAGE_STREAM: iterator (org.apache.camel.component.a2a.streaming.SseEventIterator)

  • With operation=TASK_GET: text

  • With operation=TASK_LIST: list or null

  • With operation=TASK_CANCEL: text

  • With operation=TASK_SUBSCRIBE: iterator (org.apache.camel.component.a2a.streaming.SseEventIterator)

  • With operation=PUSH_CONFIG_CREATE: pojo (org.apache.camel.component.a2a.model.TaskPushNotificationConfig)

  • With operation=PUSH_CONFIG_GET: pojo (org.apache.camel.component.a2a.model.TaskPushNotificationConfig)

  • With operation=PUSH_CONFIG_LIST: list or null

  • With operation=PUSH_CONFIG_DELETE: map

  • With dataFormat=POJO: pojo

  • With dataFormat=RAW: text

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.

Sub-Pages

For more details on consumer and producer usage, see:

  • Consumer Guide - Exposing an A2A agent with authentication, SSE streaming, async tasks, push notifications, and capacity limiting

  • Producer Guide - Calling remote agents with streaming, async task lifecycle, push notifications, and parallel multicast

Simple Language Functions

The component registers custom Simple language functions under the a2a: namespace:

Function Description

${a2a:emit('message')}

Emit a status update with WORKING state. Used in script EIP for SSE streaming side effects.

${a2a:emit(STATE, 'message')}

Emit a status update with an explicit TaskState (e.g., INPUT_REQUIRED).

${a2a:text}

Extract TextPart content from the body (Task or Message). If the body is a Task, extracts from the last history message.

${a2a:text(expression)}

Extract TextPart content from the result of a Simple expression.

${a2a:data}

Extract DataPart content as a JSON string from the body.

${a2a:data(expression)}

Extract DataPart content from the result of a Simple expression.

${a2a:file}

Extract FilePart content — the url value for URL file parts, or a binary-size description for inline base64 raw content.

${a2a:file(expression)}

Extract FilePart content from the result of a Simple expression.

${a2a:card}

Full agent card as JSON string. Resolves the card from the A2A endpoint (consumer’s own card, or the cached remote card on the producer).

${a2a:card.name}

Agent card name.

${a2a:card.description}

Agent card description.

${a2a:card.url}

Agent card URL.

${a2a:card.version}

Agent card version.

${a2a:card.skills}

Skills formatted as human-readable text, one per line: * Skill Name: description.

${a2a:card.skills.json}

Skills as a JSON array string.

${a2a:card.iconUrl}

Agent card icon URL.

${a2a:card.documentationUrl}

Agent card documentation URL.

${a2a:card.provider}

Agent provider as JSON string.

${a2a:card.capabilities}

Agent capabilities as JSON string.

${a2a:card.supportedInterfaces}

Supported interfaces as JSON array string.

${a2a:card.securitySchemes}

Security schemes as JSON object string.

${a2a:card.securityRequirements}

A2A v1.0 security requirements as JSON array string.

${a2a:card.security}

Legacy draft security field as JSON array string.

The ${a2a:card} functions resolve the agent card from the exchange context. On a consumer route, exchange.getFromEndpoint() provides the agent’s own card. On a producer route, the component scans registered endpoints for a cached remote card. Returns an empty string if no card is available.

The card functions support flat field access only — nested property access like ${a2a:card.skills[0].name} or ${a2a:card.provider.organization} is not supported. For structured data, use ${a2a:card.skills.json} or ${a2a:card} (full JSON) and parse downstream.

Example — including remote agent skills in an LLM prompt:

steps:
  - setBody:
      expression:
        simple:
          expression: |
            Generate a plan using these available skills:
            ${a2a:card.skills}

For the full text of all parts combined, use the TypeConverter:

steps:
  - convertBodyTo:
      type: String

Exchange Headers

Header Type Description

CamelA2AOperation

String

Producer operation to invoke. The consumer does not set this header. Accepts both enum names (TASK_GET, PUSH_CONFIG_CREATE) and PascalCase method names (GetTask, CreateTaskPushNotificationConfig).

CamelA2ATaskId

String

Task ID for GetTask, CancelTask, SubscribeToTask, and push notification operations.

CamelA2APushConfigId

String

Push notification config ID for get/delete operations.

CamelA2AContextId

String

Downstream context ID for multi-turn conversations. Used by producers and set from producer responses. Consumer context is available separately in CamelA2ARequestContextId.

CamelA2AMessageId

String

Message ID from the request/response.

CamelA2ATaskState

String

Task state from the response (e.g., TASK_STATE_COMPLETED, TASK_STATE_WORKING).

CamelA2AMethod

String

A2A method name invoked (set on producer response).

CamelA2AResponseType

String

Response type after a producer call (task, message, taskList, pushConfigList, or stream). This is a producer result; it does not select the consumer reply type. Use CamelA2AReplyType for that.

CamelA2ARequestOperation

String

Incoming method name, such as SendMessage or SendStreamingMessage. Also retained as an exchange property.

CamelA2ARequestTaskId

String

Consumer task ID. Also retained as an exchange property used for replies and progress updates.

CamelA2ARequestContextId

String

Consumer context ID. Also retained as an exchange property used for replies.

CamelA2AReplyTaskState

String

State of the task returned by SendMessage; defaults to TASK_STATE_COMPLETED. Producer results do not change it.

CamelA2AReplyType

String

SendMessage reply type: task (default) or message. Producer results do not change it.

CamelA2AReturnImmediately

Boolean

Override returnImmediately per-request. Takes precedence over endpoint-level config.

CamelA2AHistoryLength

Integer

Producer request field for GetTask and SubscribeToTask.

CamelA2AUserProfile

Map<String, Object>

Authenticated user profile (set as exchange property, not a header). Populated when validateAuth=true and authentication succeeds. Access via $\{exchangeProperty.CamelA2AUserProfile} in Simple expressions.

CamelA2AListContextId

String

Context ID filter for ListTasks.

CamelA2AListPageSize

Integer

Page size for ListTasks.

CamelA2AListPageToken

String

Pagination token for ListTasks.

CamelA2AListStatus

String

Comma-separated status filter for ListTasks.

CamelA2AListIncludeArtifacts

Boolean

Whether ListTasks responses include artifacts.

CamelA2AListHistoryLength

Integer

Maximum history messages to include per task in ListTasks responses.

CamelA2AListStatusTimestampAfter

String

Status timestamp filter for ListTasks. Use an ISO-8601 offset date-time.

CamelA2AExtensions

List<String>

Consumer-side negotiated A2A extension URIs from the A2A-Extensions request header. Set as both an exchange property and a route header after validation.

CamelA2AStreamEmitter

A2AStreamEmitter

Consumer-side: the stream emitter injected for streaming routes. Available for advanced use cases — prefer ${a2a:emit()} or A2AProgress API for most agents.

CamelA2AResponseTask and CamelA2AUserProfile are exchange properties, not headers. Access them via $\{exchangeProperty.CamelA2AResponseTask} and $\{exchangeProperty.CamelA2AUserProfile} in Simple expressions. CamelA2AResponseTask contains the full Task object from the producer response, useful in polling workflows. CamelA2AUserProfile contains the authenticated user’s profile map, available when validateAuth=true.

Supported Operations

Operation (enum) Method Name Producer Consumer

MESSAGE_SEND

SendMessage

Send message, receive Task or Message

Route processes message

MESSAGE_STREAM

SendStreamingMessage

Lazy Iterator<StreamResponse> (PAYLOAD/POJO), or raw InputStream (RAW)

Route emits via ${a2a:emit()}

TASK_GET

GetTask

Retrieve task from remote

Read from task store

TASK_LIST

ListTasks

List tasks from remote

Query task store

TASK_CANCEL

CancelTask

Cancel remote task

Update store + cancel in-flight async

TASK_SUBSCRIBE

SubscribeToTask

Lazy Iterator<StreamResponse> of task updates

Event-to-Stream Bridge (real-time SSE) for REST and JSON-RPC bindings

PUSH_CONFIG_CREATE

CreateTaskPushNotificationConfig

Register webhook

Store config + SSRF validation

PUSH_CONFIG_GET

GetTaskPushNotificationConfig

Retrieve config

Read from store

PUSH_CONFIG_LIST

ListTaskPushNotificationConfigs

List configs

Read from store

PUSH_CONFIG_DELETE

DeleteTaskPushNotificationConfig

Delete config

Remove from store

The CamelA2AOperation header accepts both the enum name (left column) and the PascalCase method name (second column).

The built-in JSON-RPC consumer dispatches SendMessage, SendStreamingMessage, GetTask, ListTasks, CancelTask, SubscribeToTask, and the push notification config operations.

Pluggable Authentication

Authentication uses a strategy-per-scheme pattern via the A2ASecuritySchemeHandler SPI. One handler covers both producer (apply credentials) and consumer (validate credentials) for a given security scheme type.

Default handlers:

Scheme Type Handler Description

http (bearer)

HttpBearerSchemeHandler

OAuth profile or static bearer token

apiKey

ApiKeySchemeHandler

API key in header, query, or cookie location. If the security scheme declares location=header and name, that header is used; otherwise apiKeyHeader is used.

oauth2

OAuth2SchemeHandler

Token via camel-oauth SPI

openIdConnect

OpenIdConnectSchemeHandler

Same as OAuth2, stores OIDC discovery URL

Override or extend by registering a custom handler bean:

Java-only: implementing a custom A2ASecuritySchemeHandler
@BindToRegistry("myCustomAuth")
public class MutualTlsHandler implements A2ASecuritySchemeHandler {
    public String schemeType() { return "mutualTls"; }

    public void applyCredentials(Exchange exchange, SecurityScheme scheme,
            A2AConfiguration config, CamelContext context) {
        // producer: configure mTLS
    }

    public A2AUserProfile validateCredentials(Exchange exchange,
            SecurityScheme scheme, A2AConfiguration config) {
        // consumer: extract client certificate
        return A2AUserProfile.fromMap(Map.of(
                "scheme", "mutualTls",
                "subject", "CN=client"));
    }
}

Security Scheme Priority

When the agent card declares multiple security schemes, selection is based on configuration hints:

  • oauthProfile configured → OAuth2 / OpenID Connect schemes tried first

  • bearerToken configured → HTTP bearer schemes tried first

  • apiKey configured → API key schemes tried first

  • No hint → schemes tried in agent card declaration order

On the producer, the first matching handler applies credentials. On the consumer, all declared schemes are tried until one succeeds (or all fail with 401).

Task State Machine

A2A tasks follow this state machine:

                    +--> COMPLETED
                    |
SUBMITTED --> WORKING +--> FAILED
                    |
                    +--> CANCELED
                    |
                    +--> INPUT_REQUIRED --> WORKING (resumed)
                    |
                    +--> AUTH_REQUIRED --> WORKING (after re-auth)
                    |
                    +--> REJECTED

All valid task states (wire values use the A2A v1.0 proto names shown below; the $\{a2a:emit()} function uses the short Java enum names — e.g., INPUT_REQUIRED, not TASK_STATE_INPUT_REQUIRED):

State Description

TASK_STATE_UNSPECIFIED

Unknown or missing task state fallback

TASK_STATE_SUBMITTED

Task accepted, not yet processing

TASK_STATE_WORKING

Task is actively being processed

TASK_STATE_COMPLETED

Task completed successfully (terminal)

TASK_STATE_FAILED

Task failed due to error or timeout (terminal)

TASK_STATE_CANCELED

Task was canceled by the client (terminal)

TASK_STATE_INPUT_REQUIRED

Agent needs additional input from the client before proceeding

TASK_STATE_AUTH_REQUIRED

Agent needs the client to re-authenticate before proceeding

TASK_STATE_REJECTED

Agent rejected the task (terminal)

The consumer manages transitions automatically:

  • SUBMITTED — when returnImmediately=true and the task is accepted

  • WORKING — when the route starts processing (async tasks)

  • COMPLETED — when setBody produces a non-null response

  • FAILED — when the route throws an exception or asyncTimeout expires

Routes can emit any state explicitly via ${a2a:emit(INPUT_REQUIRED, 'Please provide your address')} or A2AProgress.emit(exchange, TaskState.AUTH_REQUIRED, "Re-authentication needed").

Unified Body-as-Response

Both streaming and async agents use the same route pattern — setBody is always the final response:

steps:
  - script:
      expression:
        simple:
          expression: "${a2a:emit('progress...')}"    # optional status events
  - setBody:
      expression:
        constant:
          expression: "final response"              # consumer handles delivery

The consumer handles delivery regardless of mechanism:

  • Synchronous: returned directly in the HTTP response

  • Streaming: emitted as an SSE message event

  • Async + polling: stored in the task’s history and status message, returned via GetTask

  • Push notifications: included in the COMPLETED status webhook payload

Agent Card Resolution

Card fields are resolved with layered precedence (lowest to highest):

  1. Agent card JSON file — loaded from the URI source (base)

  2. Bean reference — agentCard=#myBean fills/overrides fields from a programmatic object

  3. URI parameters — name, description, version override everything

Bean reference example — useful when the card needs programmatic construction (e.g., dynamic skills):

- route:
    from:
      uri: a2a:classpath:agent-card.json
      parameters:
        agentCard: "#myCardBean"
      steps:
        - setBody:
            expression:
              constant:
                expression: "final response"

URI parameter overrides — customize base cards per environment via properties:

- route:
    from:
      uri: a2a:classpath:agent-card.json
      parameters:
        name: "{{agent.name}}"
        version: "{{agent.version}}"
      steps:
        - setBody:
            expression:
              constant:
                expression: "final response"

Security schemes from the card drive auth handler selection. Config parameters (oauthProfile, bearerToken, apiKey) provide the runtime credentials and influence scheme priority.

The resolver currently merges these card fields from file and bean cards: name, description, url, version, provider, capabilities, skills, supportedInterfaces, securitySchemes, securityRequirements, iconUrl, documentationUrl, defaultInputModes, defaultOutputModes, supportsAuthenticatedExtendedCard, and unknown extension properties. Legacy input cards using security are converted to securityRequirements. URI parameters can override only name, description, and version.

The card is loaded once at endpoint startup and cached. Periodic card refresh is not yet implemented.

HTTP Server Component Discovery

The consumer needs an HTTP server to register A2A endpoints. The discovery order is:

  1. Explicit httpServerComponent parameter (e.g., undertow, jetty)

  2. Global camel.rest.component / REST DSL component configuration

  3. Already registered platform-http component

  4. Exactly one already registered Camel component implementing RestConsumerFactory

  5. Exactly one registry bean implementing RestConsumerFactory

The preview component does not auto-create arbitrary HTTP server components and does not choose between multiple discovered server factories. Add and register one of the tested server components, or set httpServerComponent explicitly.

Tested behavior in this Preview release:

  • camel-platform-http / Vert.x - suitable for JSON-RPC agents (including SSE streaming) and serving the public agent card. REST custom-method paths containing colons can collide.

  • camel-undertow and camel-jetty - suitable for REST custom-method paths and real-time SSE streaming.

Data Format

The dataFormat parameter controls what the exchange body contains, following the same convention as the CXF component. It applies to both consumer (inbound request) and producer (response) sides.

Value Default Description

PAYLOAD

Yes

Extracts text content from message parts as a String. On the consumer, incoming Message parts are flattened via messageToString(). On the producer, response Task or Message objects are converted to text. Backward compatible — simple routes using ${body} get clean text. Streaming: same as POJO (lazy iterator on producer, emitter-based on consumer).

POJO

No

Full Java model objects. On the consumer, the body is the Message record with all parts, metadata, and files intact — access individual parts via $\{body.parts()[0]}. On the producer, the body is the Task or Message response object. Streaming: body is a lazy Iterator<StreamResponse> parsed on demand (use with Split EIP).

RAW

No

Raw JSON string with no deserialization. On the consumer, the body is the JSON representation of the incoming Message. On the producer, the body is the raw JSON response string. Useful for forwarding, logging, or compliance where byte-exact fidelity matters. Streaming: body is the raw InputStream — true SSE passthrough with no buffering.

Example — consumer in POJO mode for multimodal processing:

- route:
    from:
      uri: a2a:classpath:agent-card.json?dataFormat=POJO
      steps:
        - log:
            message: "Received ${body.parts().size()} parts"
        - setBody:
            expression:
              simple:
                expression: "Processed ${body.parts()[0]}"

Example — producer in RAW mode for proxying:

- route:
    from:
      uri: direct:proxy
      steps:
        - to:
            uri: a2a:http://remote-agent:8080?dataFormat=RAW
        - log:
            message: "Raw JSON: ${body}"

Task Store

The default InMemoryTaskStore manages task state with lazy cleanup. It is thread-safe, using concurrent maps for storage and lock-protected eviction for task-associated data such as message-id mappings, subscribers, and push configs.

The completedTaskTtl URI parameter (default 3,600,000 ms / 1 hour) controls the TTL for terminal tasks. Expired tasks are evicted on read or during periodic cleanup.

The following settings are configurable programmatically on the InMemoryTaskStore bean, not via URI parameters:

Property Default Description

maxStoredTasks

10000

Maximum tasks in the store. When exceeded, the oldest terminal task is evicted; if no terminal task exists, no task is evicted. Set to 0 for unlimited.

cleanupInterval

100

Number of put() calls between periodic bulk cleanup runs.

stuckTaskTtlMs

0 (disabled)

TTL for non-terminal stuck tasks (SUBMITTED, WORKING). When set to a positive value, tasks older than this duration are marked FAILED on read or periodic cleanup, and subscribers are notified. This preview safety net is disabled by default; prefer asyncTimeout on the endpoint for normal timeout handling.

To customize, register a bean implementing A2ATaskStore in the Camel registry. The preview SPI is also split into narrower parent contracts (A2ATaskRepository, A2ATaskSubscriptions, A2APushConfigStore, and A2ATaskCleanup) so custom stores can keep storage, subscription, push-config, and cleanup responsibilities separate. Registry-provided stores are wrapped by a guard that enforces terminal-state protection, delegates subscriber registration and notification to the custom store, tracks endpoint subscribers for terminal-event cleanup, validates push webhook URLs, and normalizes push config IDs/task IDs on the endpoint path. Custom stores still need to preserve durable storage and any cross-node notification semantics inside their own implementation; the dispatcher revalidates webhook URLs before delivery.

Custom subscribers can be registered on a task-store bean for audit logging, metrics, or custom delivery:

Java-only: registering a custom A2ATaskStore with a global subscriber
@BindToRegistry
public A2ATaskStore taskStore() {
    MyAuditingTaskStore store = new MyAuditingTaskStore();
    store.addGlobalSubscriber((taskId, event) -> auditLog.record(taskId, event));
    return store;
}

Model Classes

The component uses Java model classes aligned with A2A v1.0:

Class Description

Task

Task with id, contextId, status (TaskStatus), history (List<Message>), artifacts (List<Artifact>), and metadata (Map<String, Object>). contextId is the key for multi-turn conversations (maps to CamelA2AContextId header). Task.latest() returns the last message in history.

Message

Agent or user message with role, parts, messageId, contextId, taskId, referenceTaskIds, metadata, and extensions. The Role enum uses ROLE_USER, ROLE_AGENT, and ROLE_UNSPECIFIED; ROLE_UNSPECIFIED is the fallback for unknown role values during deserialization.

SendMessageRequest

Operation request wrapper with message, configuration, and metadata. The consumer requires message.role and at least one message part.

SendMessageConfiguration

Send-message runtime options with returnImmediately, blocking, historyLength, and retained extension properties. returnImmediately wins over blocking; blocking=false is treated as immediate return.

SendMessageResponse

Response wrapper containing exactly one of task or message.

TaskListRequest

List-tasks request with contextId, status, statusTimestampAfter, includeArtifacts, historyLength, pageSize, and pageToken.

ListTasksResponse

List-tasks response with tasks, nextPageToken, pageSize, and totalSize.

StreamResponse

SSE event wrapper containing exactly one of task, message, statusUpdate, or artifactUpdate.

TextPart

Text content part implementing Part<String>.

DataPart

Structured data part implementing Part<Object>.

FilePart

File content with raw for inline base64 data, url for referenced content, plus optional mediaType, filename, and metadata.

TaskStatus

Status snapshot with state (TaskState), optional message (Message), and timestamp (OffsetDateTime).

Artifact

Named output with artifactId, name, description, parts (List<Part<?>>), metadata, and extensions.

TaskPushNotificationConfig

Push notification webhook config with id, taskId, url, token (simple bearer token), and authentication (AuthenticationInfo with scheme + credentials). The token field provides a simpler alternative to full authentication for webhook auth.

ListPushNotificationConfigsResponse

Push notification config list response with configs.

Core immutable model types such as Task, Message, Artifact, and AgentCard provide builders, for example: Task.builder().id("t1").contextId("ctx-1").status(new TaskStatus(TaskState.WORKING)).build(). Mutable request/configuration classes use standard getters and setters.

Preview API and SPI Boundaries

The stable user-facing surface for this Preview release is the endpoint URI/options, exchange headers, documented model classes, type converters, and these registry SPIs: A2ATaskStore, A2AExtensionHandler, and A2ASecuritySchemeHandler.

The protocol and operation implementation classes under org.apache.camel.component.a2a.protocol and org.apache.camel.component.a2a.operation are public so the component can share implementation code across packages and tests, but they are not extension SPIs. A2AProtocol is sealed deliberately to the built-in REST and JSON-RPC bindings; select a binding with protocolBinding rather than implementing a custom protocol class.

The JSON mapper helper returns a shared, immutable Jackson 3 ObjectMapper. Use rebuild() to derive a customized mapper: this does not change component-wide serialization behavior.

Dependencies

The component has zero compile-time coupling to any HTTP library. Transport is discovered at runtime:

Role SPI Examples

Consumer HTTP server

RestConsumerFactory

camel-platform-http, camel-undertow, camel-jetty

Producer HTTP client

Built-in java.net.http.HttpClient

No additional dependency

OAuth tokens

OAuthClientAuthenticationFactory

camel-oauth (optional, discovered via FactoryFinder)

Task state

A2ATaskStore

Built-in InMemoryTaskStore (default), custom implementations via registry

Add the HTTP server component you want as a runtime dependency. Consumer routes require one of these dependencies; producer-only routes do not.

<!-- Consumer: JSON-RPC or non-streaming HTTP endpoint serving -->
<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-platform-http-vertx</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

<!-- Consumer: REST custom-method routes and real-time SSE streaming -->
<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-undertow</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

<!-- Alternative consumer transport for REST custom-method routes and real-time SSE streaming -->
<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-jetty</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

<!-- Optional: OAuth authentication -->
<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-oauth</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>