Replay & Simulation Kit

Record, replay, and debug agent conversations step by step.

Speed:1x
Step 1 / 90ms / 4250ms
💬

User Message Received

"What are the latest developments in quantum computing?"

Typeuser input
Duration0ms

Metadata

userIduser-42
sessionIdsess-abc
turn3

Integration Code

import { createRecorder, createReplayer } from 'agent-tools-kit/observability'

// Record an agent session
const recorder = createRecorder({
  capture: ['inputs', 'outputs', 'tool_calls', 'reasoning', 'timing'],
  storage: new S3Adapter({ bucket: 'agent-replays' }),
})

agent.use(recorder.middleware())

// Later: replay the session step-by-step
const replayer = createReplayer({
  recording: await recorder.load('session-abc123'),
})

// Step through the recording
for await (const step of replayer) {
  console.log(`[${step.type}] ${step.label} — ${step.durationMs}ms`)
  console.log('  Detail:', step.detail)
  console.log('  Metadata:', step.metadata)
}

// What-if scenarios: modify inputs and re-run
const whatIf = replayer.fork({
  modifyAt: 4,  // step index
  newInput: { query: 'quantum computing applications in healthcare' },
})
const alternateResult = await whatIf.run()