LumiqTrace provides a first-class API for tracing multi-agent systems. TheDocumentation Index
Fetch the complete documentation index at: https://docs.lumiqtrace.com/llms.txt
Use this file to discover all available pages before exploring further.
withAgent function creates an agent span and gives you an AgentContext object to log planning steps, instrument tool calls, and record handoffs to other agents. All LLM calls made inside the withAgent block automatically inherit the agent’s trace context — no additional wiring is required.
The withAgent function
withAgent(options, fn) starts an agent trace, runs your workflow function with an AgentContext, and automatically links any nested LLM calls to the same trace.
AgentOptions
Display name for this agent. Appears in the trace view and the agent registry.
Role label for this agent. Common values:
"coordinator", "specialist", "planner". Used to distinguish orchestrators from workers in multi-agent traces.Framework powering this agent. Examples:
"custom", "langchain", "google-adk", "openai-assistants".Tool definitions available to this agent. Each object should have a
name and a description. These appear in the tool discovery view and are linked to tool call spans.Arbitrary key-value metadata attached to the agent span. Use this for model parameters, configuration versions, or any context you want to query later.
AgentContext methods
The agent object passed to your function exposes three methods:
agent.logPlan(steps)
Records a planning span with the list of steps the agent intends to take. Call this after deciding what to do and before executing.
agent.traceTool(name, args, fn)
Wraps an async or sync function call and records a tool span containing the tool name, input arguments, and return value.
status: "error" and the error is re-thrown.
agent.delegateTo(targetName, reason?)
Records a handoff span indicating that this agent is delegating work to another agent. The reason string is stored as delegation_reason on the span.
Span kinds emitted
withAgent and its methods produce four distinct span kinds, each visible as a separate row in the trace flame graph:
| Span kind | Emitted by | What it represents |
|---|---|---|
agent | withAgent entry | The agent’s overall execution scope |
planning | agent.logPlan() | The planned steps before execution |
tool | agent.traceTool() | A single tool invocation |
handoff | agent.delegateTo() | A delegation to another agent |
Nested agents
Agents can be nested inside each other. The outerwithAgent sets a trace context that is automatically inherited by the inner withAgent. The inner agent span records the outer agent’s ID as parent_agent_id, building a parent-child hierarchy visible in the agent registry.