Skip to main content

Publishers and runtime protocols

Publishers and runtime protocols let AgentFlow communicate with systems outside the immediate graph run.

  • Publishers emit structured execution events for observability and event buses.
  • Runtime protocols expose or call agents through protocols such as A2A and ACP.

Publishers

Publishers receive structured EventModel payloads from graph execution.

from agentflow.runtime.publisher import ConsolePublisher

publisher = ConsolePublisher(config={"format": "json"})
app = graph.compile(publisher=publisher)

Available publisher implementations include:

PublisherUse case
ConsolePublisherLocal debugging.
RedisPublisherPub/Sub or stream-backed event distribution.
KafkaPublisherKafka event pipelines.
RabbitMQPublisherRabbitMQ messaging.

Events carry source, phase, content type, node name, thread ID, run ID, payload, timestamp, and metadata.

Runtime adapters

Runtime adapters normalize provider-native or third-party formats into AgentFlow messages, tool schemas, and results.

Adapter areaExamples
LLM convertersGoogleGenAIConverter, OpenAIConverter, OpenAIResponsesConverter
Tool adaptersLangChainAdapter, ComposioAdapter

A2A and ACP

A2A helpers live under agentflow.runtime.protocols.a2a.

HelperPurpose
build_a2a_app, create_a2a_serverServe an AgentFlow graph as an A2A-compatible app.
delegate_to_a2a_agentCall a remote A2A agent once.
create_a2a_client_nodeUse a remote A2A agent as a graph node.
AgentFlowExecutorBridge AgentFlow graph execution into A2A.

A2A support requires optional dependencies. Keep imports lazy or guarded when the protocol package may not be installed.

ACP support is available under agentflow.runtime.protocols.acp. Check source and reference docs before extending it because the public docs are thinner than the core graph docs.

Rules

RuleWhy it matters
Prefer publishers over ad hoc print statementsEvents stay structured and backend-agnostic.
Close network publishers on shutdownRedis, Kafka, and RabbitMQ publishers own resources.
Keep optional protocol dependencies optionalCore graph imports should stay lightweight.
Distinguish serving from delegatingServing a graph as A2A differs from calling a remote A2A agent.