DS DevShelfHub Projects · AI tools
Tutorials / CrewAI / Reference / Classes / A2AClientConfig
Class a2a

A2AClientConfig: Reference Guide

By DevShelfHub

Configures an outbound A2A connection: base URL, auth, transports, and update mode (polling/push/streaming).

See the CrewAI API reference index, CrewAI introduction, and MCP & A2A tutorial for surrounding context.

What is A2AClientConfig?

A2AClientConfig bundles everything the CrewAI runtime needs to call a remote agent that speaks the Agent-to-Agent protocol: where to reach it (`base_url`), how to authenticate (`auth` as an AuthConfig subtype), and how you want progress and partial results delivered (`updates` as StreamingConfig, PollingConfig, or PushNotificationConfig). You typically build one object per external environment (staging vs production) and reuse it across kicks while secrets rotate underneath.

The `updates` field is where most production tuning happens. PollingConfig is the conservative default when you sit behind strict proxies or short-lived processes; StreamingConfig reduces latency when you can hold an outbound connection open for the whole delegation; PushNotificationConfig fits serverless backends that cannot stream but can verify HMAC-signed webhooks. Mismatched expectations between client and remote server versions show up first as confusing partial payloads or dropped events, so keep CrewAI major versions aligned on both sides and install the `crewai[a2a]` extra wherever this type is imported.

When to Use

Calling remote agents via A2A from a CrewAI crew or agent, especially when you need explicit auth and a chosen update transport.

Use Cases

  • Cross-team agent delegation
  • Vendor-hosted agents
  • Bridging CrewAI to non-CrewAI A2A servers

Key Features

  • Auth pluggability
  • Pluggable update modes
  • Pairs with A2A auth helpers

When NOT to Use

In-process delegation between agents in the same Python process — use hierarchical crews or Flows instead of network A2A.

Notes

Install surface and version skew

A2A types live behind the optional `crewai[a2a]` extra. If imports fail in CI or production, add that extra to the same environment that runs the crew. Keep the CrewAI major version aligned with the remote A2A implementation so agent cards, status envelopes, and streamed frames deserialize consistently.

Rate limits and polling interval

When `updates` is PollingConfig, every interval hits the remote status endpoint. Set `interval_s` high enough to stay under partner rate limits and low enough for your UX SLA. Log HTTP 429 responses and back off rather than tightening the interval under pressure.

Streaming and process lifetime

StreamingConfig assumes your client process outlives the remote kickoff. Serverless handlers and very short jobs should prefer polling or push callbacks so progress retrieval does not depend on a single long-lived outbound socket.

Secret hygiene

Never embed long-lived API keys or bearer strings in source control. Read them from environment variables or a secret manager at process start, and rotate keys independently of code deploys so A2AClientConfig construction stays a pure configuration concern.

Import

python
from crewai.a2a import A2AClientConfig

Key Parameters

Parameter Type Default Purpose
base_url str Remote agent endpoint.
auth AuthConfig Auth implementation.
updates StreamingConfig | PollingConfig | PushNotificationConfig PollingConfig() How status updates flow.

Code Examples

Bearer token with streaming updates

python
import os
from crewai.a2a import A2AClientConfig
from crewai.a2a.auth import BearerTokenAuth
from crewai.a2a.updates import StreamingConfig

cfg = A2AClientConfig(
    base_url='https://a2a.partner.example',
    auth=BearerTokenAuth(token=os.environ['PARTNER_A2A_TOKEN']),
    updates=StreamingConfig(),
)

API key with conservative polling

python
import os
from crewai.a2a import A2AClientConfig
from crewai.a2a.auth import APIKeyAuth
from crewai.a2a.updates import PollingConfig

cfg = A2AClientConfig(
    base_url='https://a2a.internal.corp',
    auth=APIKeyAuth(key=os.environ['INTERNAL_A2A_KEY']),
    updates=PollingConfig(interval_s=4.0),
)

Push webhooks for serverless consumers

python
from crewai.a2a import A2AClientConfig
from crewai.a2a.auth import BearerTokenAuth
from crewai.a2a.updates import PushNotificationConfig

cfg = A2AClientConfig(
    base_url='https://a2a.vendor.example',
    auth=BearerTokenAuth(token=os.environ['VENDOR_TOKEN']),
    updates=PushNotificationConfig(
        callback_url='https://api.myapp.com/a2a/callback',
        secret=os.environ['A2A_WEBHOOK_SECRET'],
    ),
)

Common Mistakes

❌ Omitting `updates` and assuming streaming by default

✅ Set `updates=StreamingConfig()` explicitly when you need live chunks; otherwise accept the default polling semantics.

❌ Pointing `base_url` at a path that already includes `/v1/...` fragments that the client also adds

✅ Use the bare agent root the A2A client library expects—trim duplicate path prefixes and test against a recorded trace.

A2AClientConfig FAQ

What is A2AClientConfig in CrewAI?

Configures an outbound A2A connection: base URL, auth, transports, and update mode (polling/push/streaming). A2AClientConfig bundles everything the CrewAI runtime needs to call a remote agent that speaks the Agent-to-Agent protocol: where to reach it (`base_url`), how to authenticate (`auth` as an AuthConfig subtype), and how you want progress and partial results delivered (`updates` as StreamingConfig, PollingConfig, or PushNotificationConfig). You typically build one object per external environment (staging vs production) and reuse it across kicks while secrets rotate underneath. …

Which package defines the CrewAI class A2AClientConfig?

DevShelfHub maps A2AClientConfig to Python module crewai.a2a (package path crewai.a2a in this reference). Pin your installed crewai version and match imports to the snippet on this page.

When should I use A2AClientConfig?

Calling remote agents via A2A from a CrewAI crew or agent, especially when you need explicit auth and a chosen update transport.

When should I avoid using A2AClientConfig?

In-process delegation between agents in the same Python process — use hierarchical crews or Flows instead of network A2A.

How do I import A2AClientConfig in Python?

from crewai.a2a import A2AClientConfig

Where can I explore more CrewAI API reference pages?

Open the CrewAI API reference index on DevShelfHub to search 58 classes, 30 methods, and 16 decorators, each with runnable examples, parameters, common mistakes, and cross-links.