Definition
Agents communicate through events, topics, and queues asynchronously, rather than via direct function calls.
Category: Information flow
When to use
Platform-scale async tasks, long-running work, observability, cross-service agent orchestration.
When not to use
Simple synchronous tasks, or organizations without event-schema governance.
How to implement
- Design a unified event envelope:
event_id, run_id, session_id, type, payload, timestamp. - Define a schema and version per event type.
- Every agent action publishes events; orchestrators recover state from the log.
- Support replay, dedupe, idempotency, dead-letter queues.
Minimal pseudocode
TypeScript
type AgentEvent = {
id: string;
runId: string;
sessionId: string;
type: string;
actor: string;
payload: unknown;
ts: string;
schemaVersion: string;
};
Recommended trace events
event.publishedevent.consumedevent.replayedevent.dead_lettered
Common failure modes
- Events without a schema.
- Duplicate consumption causes duplicate side effects.
- Async pipelines are hard to debug.
- Event volume too high without sampling.
Implementation checklist
- Input/output schemas defined.
- Each agent's permission boundary defined.
- Every agent call carries a run id / trace id.
- Failure, timeout, cancel, and retry strategies defined.
- Context passed is the minimum required, not the full history.
- High-risk actions are gated by approval or a verifier.