Event System API

Event System

LeafMesh automatically generates events as agents execute, sessions progress, and mesh calls route between agents. You do not need to subscribe to or publish events manually — everything happens automatically based on your YAML configuration.

Observing Events

Events are emitted in real time and are visible through Studio's Activity tab (live feed, agent-, and session-filtered views).

Programmatic access

Use the Python SDK for aggregated statistics:

Aggregated analytics, cache metrics, and per-session event streams are available in Studio's Dashboard and session inspector — operator UI, not part of the customer Python or HTTP surface.

Aggregated analytics, cache metrics, and per-session event streams are available in Studio's Dashboard and session inspector — operator UI, not part of the customer Python or HTTP surface.

For raw events, subscribe via the SSE endpoint exposed by the API server and filter on event.type.

Event Types

LeafMesh generates events across several categories. These are emitted automatically — you observe them through the SSE endpoint or activity feed.

Session Events

EventWhen
session.createdNew session created
session.updatedSession data updated
session.completedSession completed
session.expiredSession TTL expired

Agent Events

EventWhen
agent.registeredAgent registered during startup
agent.activatedAgent activated
agent.deactivatedAgent deactivated
agent.call.startedAgent begins processing a request
agent.call.completedAgent finishes processing
agent.call.failedAgent execution failed
agent.yields.storedAgent yields stored in Redis

Mesh Events

EventWhen
dispatch.dedup_suppressedA duplicate work unit was suppressed (exactly-once collapse) — the claimed execution's result is the authoritative reply
session.result_droppedA completed agent's result was discarded because the session was already escalated/stopped — carries the agent and the discarded keys
manager.degradationA super-agent completed with degraded steps; the Manager reviewed without re-running
EventWhen
mesh.call.startedAgent-to-agent call initiated
mesh.call.completedAgent-to-agent call completed
mesh.call.failedAgent-to-agent call failed

LLM Events

EventWhen
llm.requestLLM call initiated
llm.responseLLM response received
llm.cache.hitModel text served from cache (the agent pipeline still runs fresh)
llm.cost.trackedToken + USD cost recorded at the provider gate (every call: tool loops, reflection, streaming)
media.generatedAn image-generation call produced media (metadata only — no base64 in the event)
reflection.doomed_skippedReflection retry skipped: every failure was a null the agent's own prompt mandates — fix is nullable: true or the prompt, not a retry

Workflow Events

EventWhen
workflow.step.startedWorkflow step begins
workflow.step.completedWorkflow step finishes
workflow.pausedWorkflow paused (e.g., human-in-the-loop)
workflow.resumedWorkflow resumed
workflow.completeEntire workflow finished

Human-in-the-Loop Events

EventWhen
human.input.requestedHuman agent triggered
human.input.receivedHuman responded
human.input.timeoutHuman did not respond in time

System Events

EventWhen
system.startedPlatform started
system.stoppedPlatform stopped
config.loadedConfiguration loaded

Self-Healing Events

EventWhen
healing.triggeredHealth issue detected
healing.action.takenRecovery action executed
healing.completedRecovery completed

How It Works

All events are emitted automatically as your agents execute. LeafMesh manages event routing and delivery internally. You interact with events through:

  1. Studio's Activity tab — live feed and paginated history
  2. Studio's Dashboard — aggregated statistics from Python
  3. SSE endpoint — real-time stream for custom integrations

No manual event subscription or publishing is needed.

Next Steps


LeafMesh — Event system reference

Last updated: 11/10/2026