Quick Start
How It Works
The Protocol
Your sink must implement 3 methods. That’s it!
- Protocol
- Methods
ContextTraceSink is a backward-compatible alias for ContextTraceSinkProtocol.Example Sinks
HTTP Sink
HTTP Sink
Send events to a remote HTTP endpoint with batching.
Database Sink
Database Sink
Store events in SQLite database for later analysis.
Console Sink
Console Sink
Print events to console for debugging.
Event Types
| Event | Description |
|---|---|
session_start | Session begins |
session_end | Session ends |
agent_start | Agent starts |
agent_end | Agent finishes |
agent_handoff | Agent hands off |
message_added | Message added |
tool_call_start | Tool starts |
tool_call_end | Tool finishes |
llm_request | LLM request sent |
llm_response | LLM response received |
memory_store | Memory stored |
memory_search | Memory searched |
knowledge_add | Knowledge added |
knowledge_search | Knowledge searched |
Event Data
Architecture
Best Practices
Buffer Events
Batch events before sending to reduce network calls
Handle Errors
Sink errors are caught silently - tracing never crashes agents
Use trace_context
Automatic cleanup even if exceptions occur
Thread Safety
Use locks if your sink is accessed from multiple threads
Zero Overhead
When tracing is disabled, there’s zero performance impact:API Reference
ContextTraceEmitter
trace_context
Built-in Sinks
| Sink | Purpose |
|---|---|
ContextNoOpSink | Does nothing (zero overhead) |
ContextListSink | Collects events in memory (testing) |
ContextTraceWriter | Writes to JSONL files (in praisonai) |
CLI Commands
Use the CLI to manage traces:Related
Context Replay
Debug agent execution step-by-step
Observability
20+ provider integrations
Observability Hooks — Third-party sink plugins
Register sinks via the
praisonai.observability_sinks entry-point group
