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

StreamingConfig: Reference Guide

By DevShelfHub

Configures an A2A client to receive task and agent updates over a streaming transport instead of polling.

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

What is StreamingConfig?

When you wire an A2AClientConfig for outbound delegation, the `updates` field decides how you observe progress from the remote crew: polling pulls state on a timer, push posts signed webhooks to you, and StreamingConfig opts into a continuous stream suited to token-by-token or event-by-event consumption. That matters for dashboards, CLI progress bars, and any UX where users expect near-real-time feedback rather than discrete snapshots.

StreamingConfig is the low-latency choice when the network path supports long-lived connections and your consumer can handle incremental payloads. It pairs naturally with verbose agents, multi-step tasks, and A2A flows where intermediate reasoning or tool calls should surface as they happen. The exact wire format follows CrewAI's A2A client implementation; from an application perspective you treat `updates=StreamingConfig()` as the signal that the client should prefer streaming semantics over PollingConfig's periodic GETs.

Compared with PollingConfig, streaming reduces average time-to-first-update and avoids hammering the server on a fixed interval. Compared with PushNotificationConfig, it avoids hosting a callback URL and verifying HMAC signatures — at the cost of holding an open connection and handling reconnects if the link drops mid-run. Pick streaming when the client process stays alive for the whole kickoff and you control both ends of the integration.

When to Use

Interactive UIs, dev-time debugging with live traces, and long-running delegations where you want incremental output without configuring webhooks.

Use Cases

  • Chat-style UIs over delegated A2A
  • Local agents streaming remote crew progress
  • Reducing poll traffic versus PollingConfig

Key Features

  • Low-latency incremental updates
  • Pairs with A2AClientConfig.updates
  • Alternative to polling and push webhooks

When NOT to Use

Serverless one-shots that cannot keep a connection open, air-gapped networks that block streaming transports, or backends where a signed webhook (PushNotificationConfig) or simple polling is operationally easier.

Notes

Backpressure and slow consumers

If your UI or logger cannot keep up with the event rate, buffer or sample updates instead of blocking the stream thread. A blocked consumer can stall the whole read loop and make the remote side look hung even when the crew is still working.

Connection drops mid-delegation

Streaming assumes a process that outlives the kickoff. On mobile clients or spotty Wi-Fi, plan for reconnect or fall back to PollingConfig for a resume path. Do not assume a single TCP session spans the entire remote run unless your client library documents automatic retry.

Operational comparison to PushNotificationConfig

Push mode fits serverless and cross-network integrations because the remote server calls you. Streaming keeps everything inbound to your client, which simplifies firewall rules but requires a long-lived outbound connection. Mixing modes across environments (dev streaming, prod push) is common — keep the choice in configuration, not hard-coded.

Install surface

A2A types ship behind the optional `crewai[a2a]` extra. If imports fail at runtime, install that extra in the same environment as your crew and match major versions between client and remote server to avoid schema skew on streamed payloads.

Import

python
from crewai.a2a.updates import StreamingConfig

Code Examples

Prefer streaming on A2AClientConfig

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

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

Contrast with polling when streaming is blocked

python
from crewai.a2a.client import A2AClientConfig
from crewai.a2a.updates import StreamingConfig, PollingConfig

# Default to streaming in the app tier
updates = StreamingConfig()

# Corporate proxy only allows short requests — fall back to polling
if os.environ.get('A2A_FORCE_POLL') == '1':
    updates = PollingConfig(interval_s=3.0)

cfg = A2AClientConfig(base_url=base_url, auth=auth, updates=updates)

Document the choice next to other update modes

python
# StreamingConfig  → live stream (this page)
# PollingConfig    → periodic GETs, interval_s tuned to rate limits
# PushNotificationConfig → server POSTs to your callback_url with HMAC

A2AClientConfig(..., updates=StreamingConfig())

Common Mistakes

❌ Using StreamingConfig inside a short-lived serverless handler with no listener

✅ Use PollingConfig or PushNotificationConfig so progress retrieval does not depend on a process-bound stream.

❌ Treating streamed chunks as final task output without aggregation

✅ Accumulate or parse frames according to the A2A client's API; the last chunk is not guaranteed to be a full message boundary.

StreamingConfig FAQ

What is StreamingConfig in CrewAI?

Configures an A2A client to receive task and agent updates over a streaming transport instead of polling. When you wire an A2AClientConfig for outbound delegation, the `updates` field decides how you observe progress from the remote crew: polling pulls state on a timer, push posts signed webhooks to you, and StreamingConfig opts into a continuous stream suited to token-by-token or event-by-event consumption. That matters for dashboards, CLI progress bars, and any UX where users expect near-real-time feedback rather than discrete snapshots. StreamingConfig is the low-latency choi…

Which package defines the CrewAI class StreamingConfig?

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

When should I use StreamingConfig?

Interactive UIs, dev-time debugging with live traces, and long-running delegations where you want incremental output without configuring webhooks.

When should I avoid using StreamingConfig?

Serverless one-shots that cannot keep a connection open, air-gapped networks that block streaming transports, or backends where a signed webhook (PushNotificationConfig) or simple polling is operationally easier.

How do I import StreamingConfig in Python?

from crewai.a2a.updates import StreamingConfig

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.