A span is one step inside a run. UseDocumentation Index
Fetch the complete documentation index at: https://docs.trodo.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
withSpan to wrap any block of code; the dashboard shows it in the run’s waterfall.
Kinds
| Kind | For | Required fields |
|---|---|---|
llm | Model calls | model, inputTokens, outputTokens (auto for supported providers) |
tool | Functions the agent invokes (search, DB, API) | toolName |
retrieval | Vector search, KB lookup, RAG retriever | — |
agent | A nested sub-step rendered as an agent stage | — |
chain | A chain / graph step (LangChain, LangGraph) | — |
function | Generic instrumented function | — |
Example — all fields
- Node.js
- Python
Field reference
| Setter | DB column | Auto-captured for supported frameworks? |
|---|---|---|
setInput(value) | input | no — always manual |
setOutput(value) | output | no — always manual |
setLlm({ model }) | model | yes |
setLlm({ provider }) | provider | yes |
setLlm({ inputTokens }) | input_tokens | yes |
setLlm({ outputTokens }) | output_tokens | yes |
setLlm({ cost }) | cost | yes (computed from tokens + model) |
setLlm({ temperature }) | temperature | yes |
setTool(name) | tool_name | yes (LangChain, LlamaIndex tool calls) |
setError({ type, message }) | error_type, error_message, status='error' | yes (on thrown exceptions) |
setAttribute(key, value) | attributes.<key> | no — always manual |
span.name | name | yes (from the instrumented method name) |
span.kind | kind | yes |
span.status | status | yes (ok on success, error on throw) |
Errors
A thrown exception insidewithSpan sets status='error' plus error_type and error_message from the exception, then re-raises. Wrap with try/catch if you want to recover; the span is recorded either way.
Next
- Spans outside wrapAgent — emit spans from files / workers / services that run outside the callback.
- Patterns — helpers (
tool/llm/trace),trackLlmCall, feedback, custom attributes.