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

PollingConfig: Reference Guide

By DevShelfHub

Configures an A2A client to fetch updates by polling.

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

What is PollingConfig?

PollingConfig tells the A2A client to pull remote status on a fixed interval_s timer instead of holding StreamingConfig's long-lived stream or hosting PushNotificationConfig's callback URL. It is the boring default that survives corporate HTTP proxies, strict egress allowlists, and short-lived serverless handlers — at the cost of higher average latency between a remote event occurring and your Python process observing it.

Tuning interval_s is a negotiation between UX and rate limits: aggressive polling burns partner quota and can trigger HTTP 429 storms under load, while overly relaxed intervals make operators think the delegation stalled. Log status codes and back off exponentially when you see throttling signals.

Pair PollingConfig with OAuth2ClientCredentials or BearerTokenAuth so each poll includes a fresh Authorization header; long kicks that outlive token TTL need the same refresh discipline as streaming modes even though the transport looks simpler.

Expose polling interval as configuration per environment so operators can widen intervals during incidents without redeploying Python code, and add metrics on poll duration percentiles to catch slow remote status endpoints before they become outages.

When to Use

Behind firewalls/no streaming.

Use Cases

  • Restricted networks
  • HTTP-only egress without streaming
  • Serverless progress checks

Key Features

  • Configurable interval
  • Pairs with A2AClientConfig.updates
  • Works through strict proxies

When NOT to Use

Tight latency targets.

Notes

429 handling

If the remote returns rate-limit headers, honor Retry-After instead of tightening interval_s. Blind retries amplify outages.

Latency expectations

Worst-case observation delay approaches interval_s plus remote processing time. Communicate that to UX owners before they benchmark against streaming demos.

When to graduate to StreamingConfig

If both ends support long-lived outbound connections and you need sub-second traces, switch updates after proving the network path with synthetic long runs.

Import

python
from crewai.a2a.updates import PollingConfig

Key Parameters

Parameter Type Default Purpose
interval_s float 1.0 Seconds between polls.

Code Examples

Conservative corporate interval

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

cfg = A2AClientConfig(
    base_url='https://a2a.internal.corp',
    auth=BearerTokenAuth(token=os.environ['INTERNAL_A2A_TOKEN']),
    updates=PollingConfig(interval_s=5.0),
)

Faster loop for trusted low-volume partners

python
cfg = A2AClientConfig(
    base_url='https://a2a.partner.example',
    auth=auth,
    updates=PollingConfig(interval_s=1.5),
)

Switch modes by environment flag

python
from crewai.a2a.updates import PollingConfig, StreamingConfig

updates = StreamingConfig() if os.environ.get('A2A_STREAM') == '1' else PollingConfig(interval_s=4.0)

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

Common Mistakes

❌ Polling too aggressively

✅ Increase interval_s to respect rate limits.

PollingConfig FAQ

What is PollingConfig in CrewAI?

Configures an A2A client to fetch updates by polling. PollingConfig tells the A2A client to pull remote status on a fixed interval_s timer instead of holding StreamingConfig's long-lived stream or hosting PushNotificationConfig's callback URL. It is the boring default that survives corporate HTTP proxies, strict egress allowlists, and short-lived serverless handlers — at the cost of higher average latency between a remote event occurring and your Python process observing it. Tuning interval_s is a negotiation between UX and rat…

Which package defines the CrewAI class PollingConfig?

DevShelfHub maps PollingConfig 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 PollingConfig?

Behind firewalls/no streaming.

When should I avoid using PollingConfig?

Tight latency targets.

How do I import PollingConfig in Python?

from crewai.a2a.updates import PollingConfig

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.