Enabling Debug Mode
- TypeScript
- Python
Code APIEnvironment variable
What Gets Logged
All output is prefixed with[LEMMA:trace-wrapper] or [LEMMA:processor] so you can filter it easily.
wrapAgent / wrap_agent
| Event | When it fires |
|---|---|
span started | A new root span is opened for a run, with agent name, run ID, and autoEndRoot value |
span ended via onComplete | onComplete / on_complete was called and ended the span (only when autoEndRoot: false) |
onComplete called but span not ended | onComplete was called but autoEndRoot is active or the span was already ended |
span auto-ended after fn returned | The wrapped function returned and the span was ended automatically |
span ended on error | An uncaught exception ended the span, with the error message |
RunBatchSpanProcessor
| Event | When it fires |
|---|---|
onStart: top-level run span | A new ai.agent.run root span was started, with span ID, run ID, and whether auto-end is on |
onStart: child span | A child span was started and attributed to a run |
onEnd: span ended | Any span ended, with span name, run ID, whether it’s the top-level span, and whether it was skipped for export |
onEnd: direct child ended | A direct child of a root span ended, with remaining child count |
onEnd: triggering auto-end of top-level span | All direct children finished and the root span is being auto-ended |
exporting batch | A batch of spans is being sent to the exporter, with run ID and span count |
force_flush called | forceFlush was called |
shutdown called | shutdown was called |
Example Output
Running a simple agent with debug mode enabled produces output like this:Checking Debug Mode State
- TypeScript
- Python
Debug mode is off by default and intended for local troubleshooting. It writes directly to stdout — avoid leaving it enabled in production.

