Trace LLM calls
Record every model call with tokens, latency, errors and cost.
Tracing records model calls. To govern what an agent does, also govern its tool calls.
Wrap your provider's client
The second argument names the agent. It groups traces in the console and is the name used for the kill switch and policies.
import OpenAI from 'openai';
import { Leap360 } from 'leap360';
const leap = new Leap360({ apiKey: process.env.LEAP360_API_KEY });
const openai = leap.wrapOpenAI(new OpenAI(), 'search-agent');Use the client that the wrap call returns. Calls made on the original client are not traced.
Zero config
import { autoInit } from 'leap360';
await autoInit(); // reads LEAP360_API_KEYAny other provider
Wrap the call with traceCall. It times the call, captures errors and sends the trace.
const result = await leap.traceCall({
model: 'mistral-large',
provider: 'mistral',
serviceName: 'mistral-agent',
fn: async () => mistralClient.chat({ model: 'mistral-large', messages }),
});Python
from leap360 import Leap360
leap = Leap360() # reads LEAP360_API_KEY
leap.trace(
model="amazon.nova-micro-v1:0",
provider="bedrock",
service_name="my-agent",
latency_ms=312,
usage={"prompt_tokens": 80, "completion_tokens": 50, "total_tokens": 130},
)See the Python SDK reference for provider wrappers.