Observability¶
Every action the agent takes — LLM calls, tool invocations, connector queries, workflow steps — is recorded as a structured TraceEntry on the agent's ActionTracer. Traces can be inspected programmatically or exported to JSONL files via the JSONLExporter.
For narrative coverage of trace shape, cost tracking, and operational use see Action Traces and Cost Tracking. For the parallel mechanism that protects LLM-visible payloads from filesystem leaks see Security.
ActionTracer¶
ActionTracer ¶
Records and stores agent action traces.
Example
subscribe ¶
Register a callback invoked on every new entry.
trace ¶
trace(action: str, *, connector: str = '', asset_id: str = '', operation: str = '', conversation_id: str = '', **metadata: Any) -> _TraceContext
Context manager that records timing and outcome.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
action
|
str
|
Action category (e.g. |
required |
connector
|
str
|
Connector name involved. |
''
|
asset_id
|
str
|
Asset context. |
''
|
operation
|
str
|
Specific operation name. |
''
|
conversation_id
|
str
|
Conversation/session identifier. |
''
|
**metadata
|
Any
|
Extra metadata to attach. |
{}
|
Returns:
| Type | Description |
|---|---|
_TraceContext
|
A context manager yielding a :class: |
_TraceContext
|
be finalised and recorded on exit. |
TraceEntry¶
TraceEntry ¶
Bases: BaseModel
A single traced action performed by the agent.
redacting_dump_json ¶
Serialize to JSON with secret redaction and summary truncation.
Unlike model_dump_json(), this method:
- Redacts metadata keys matching sensitive patterns
- Truncates input_summary and output_summary
JSONLExporter¶
Subscribes to an ActionTracer and writes one redacted JSON object per line to a daily-rotated file. Secrets are stripped automatically — see the _REDACT_PATTERNS constant in the source for the exact key set.
JSONLExporter ¶
Write trace entries as redacted JSONL with daily file rotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Directory where JSONL files are written. |
required |
rotate_daily
|
bool
|
If True (default), each day gets a separate file. |
True
|
max_summary_chars
|
int
|
Truncation limit for summary fields. |
2000
|
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If |
attach ¶
Subscribe to a tracer so entries are written automatically.