Skip to main content

Publishers and runtime adapters

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

  • Publishers emit structured execution events for observability and event buses.
  • Runtime adapters normalize provider-native SDK payloads into AgentFlow messages and tool results.

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.
CompositePublisherFan an event out to several publishers at once.
OtelPublisherOpenTelemetry spans for each run, node, and tool call.
LogfirePublisherLogfire traces.
LangsmithPublisherLangSmith traces over OTLP.

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 areaExports
LLM convertersBaseConverter, ConverterType, GoogleGenAIConverter, OpenAIConverter, OpenAIResponsesConverter

Import them from agentflow.runtime.adapters.

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 publisher dependencies optionalCore graph imports should stay lightweight.