Skip to main content

Error Handling in Agents

Handle errors inside your agent logic and emit error events:
Ensure the client channel streams both response and error events so the UI can show errors.

Event Filtering

Stream only specific events to the client:

Observability Hooks

onRequest

Use onRequest to log, trace, or enrich before the start event is published:

Catch-All Logger Agent

Register a catch-all agent to log every event:

Event Meta

Every event has meta.runId, meta.contextId, meta.correlationId, meta.causationId, and meta.ts. Use these for distributed tracing and correlation.

NetworkTracer

Core exposes a pluggable NetworkTracer interface. Configure tracing when defining the network; network.expose() inherits those defaults. Agents receive a tracing scope in .logic():