observe in atlanai SDK traces a function without restructuring it, and handles sync functions, async functions, and generators. Use it when you want a span per function call with input and output captured automatically. To control the span yourself, use Create spans for agent run.
Before you begin
Before you start, make sure you have:- SDK: atlanai SDK installed with tracing, as in Install atlanai SDK.
- Tracing:
initconfigured and exporting, as in Trace first agent run.
1
Wrap function
Decorate a function in Python, or wrap it in TypeScript. The span name comes from the function unless you set
name, and the observation type defaults to task.- Python
- TypeScript
2
Limit captured payload
Input and output are captured by default. Turn either off per function when the payload is large or sensitive.For one rule across every span, use
- Python
- TypeScript
trace_content instead, as in Control trace privacy.3
Verify span
Call the function, flush, and open the trace in Agent Registry. Confirm a span named for the function with the expected type, and input and output present unless you turned them off.If no trace appears, see
init() disables tracing and no traces are exported.Troubleshooting
If traces do not appear, see Install and setup errors.Next steps
- Group runs into sessions: tie spans to a session, user, and tags.