Traces the execution of an AI agent, recording steps, LLM calls, and tool usage.

const trace = new ExecutionTrace(agentId, new Date());

trace.addStep({ name: 'initialize', startTime: new Date() });
trace.addLLMCall({
provider: 'openai',
model: 'gpt-4',
messages: [...],
response: '...',
usage: { promptTokens: 100, completionTokens: 50, totalTokens: 150 },
cost: 0.01,
timestamp: new Date()
});
trace.complete();

Constructors

Methods

Properties

id: string
agentId: AgentId
startTime: Date
endTime?: Date
duration?: number