Skip to content
This repository was archived by the owner on Jun 3, 2026. It is now read-only.

feat(a2a): support custom ClientFactory in A2AAgent for authenticated requests - #810

Merged
mkmeral merged 1 commit into
strands-agents:mainfrom
cogwirrel:feat/a2a-client-factory
Apr 13, 2026
Merged

mkmeral merged 1 commit into
strands-agents:mainfrom
cogwirrel:feat/a2a-client-factory

Conversation

@cogwirrel

Copy link
Copy Markdown
Contributor

Motivation

The A2AAgent currently always creates a default ClientFactory internally, providing no way to customize how HTTP requests are made to the remote A2A server. This prevents users from authenticating requests with mechanisms like SigV4 signing or bearer tokens, which is required when invoking A2A agents on services like Bedrock AgentCore.

The Python SDK already supports this by accepting a custom A2A client factory in its A2AAgent class.

Resolves: #802

Public API Changes

A2AAgentConfig now accepts an optional clientFactory parameter:

// Before: no way to authenticate requests
const agent = new A2AAgent({ url: "http://localhost:9000" })

// After: pass a custom ClientFactory for authenticated requests
const sigv4Fetch = ...
const a2aClientFactory = new ClientFactory(
  ClientFactoryOptions.createFrom(ClientFactoryOptions.default, {
    transports: [new JsonRpcTransportFactory({ fetchImpl: sigv4Fetch })],
    cardResolver: new DefaultAgentCardResolver({ fetchImpl: sigv4Fetch }),
  }),
)

const agent = new A2AAgent({
  url: "http://localhost:9000",
  clientFactory: a2aClientFactory,
})

When no clientFactory is provided, the default ClientFactory is used — fully backward compatible.

Use Cases

  • SigV4 authentication: Sign requests when invoking A2A agents on Bedrock AgentCore
  • Bearer token authentication: Pass JWT or other bearer tokens for authenticated endpoints
  • Custom transport: Provide any custom fetch implementation for specialized networking requirements

@poshinchen poshinchen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks neat to me

@mkmeral
mkmeral added this pull request to the merge queue Apr 13, 2026
Merged via the queue into strands-agents:main with commit 6d12bed Apr 13, 2026
13 of 15 checks passed

This branch had an error being deployed

1 failed deployment
manual-approval — 6c525d45 Deployed Apr 13, 2026 by cogwirrel via Run integration tests #1760
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] A2AAgent pass custom a2a client factory for authenticating requests

3 participants