Skip to content

A2A Transport

@caracalai/transport-a2a helps one agent call another agent endpoint through a Caracal-authorized A2A request.

Terminal window
npm install @caracalai/transport-a2a

The package targets Node >=22 and depends on @caracalai/oauth and @caracalai/sdk.

import { a2aCall } from "@caracalai/transport-a2a";
const response = await a2aCall({
agentUrl: "https://agent.example.com",
resource: "https://agent.example.com",
method: "summarize",
params: { ticketId: "T-123" },
requestId: crypto.randomUUID(),
scopes: ["agent:call"],
}, subjectToken, zoneId, applicationId, {
stsUrl: process.env.CARACAL_STS_URL!,
clientSecret: process.env.CARACAL_APP_CLIENT_SECRET,
});
FieldMeaning
agentUrlTarget agent base URL; the helper posts to ${agentUrl}/a2a.
resourceOptional STS resource; defaults to agentUrl.
methodA2A method name.
paramsMethod payload.
requestIdCorrelation ID; response must echo it.
scopesSTS scopes for the target call.
sessionId, agentSessionId, delegationEdgeIdOptional context anchors.
metadataOptional request metadata forwarded in the A2A body.
OptionMeaning
stsUrlSTS base URL.
clientSecret, clientAssertion, clientAssertionTypeApplication authentication for token exchange.
ttlSecondsRequested mandate TTL.
timeoutMs, retries, retryBaseMsExchange and request retry controls.
retryTransientStatusesRetry transient A2A HTTP responses when true.
fetchImplCustom fetch-like implementation.
oauthClientTest or custom token-exchange client.

The helper exchanges a mandate, injects Caracal envelope headers, posts the A2A JSON body, and verifies the response contains the same requestId and a result field.