Skip to main content
The Audit Log UI and replay feature are planned. The database schema (audit_log, run_events) exists but the dashboard UI is not yet built.

Overview

Every agent run is automatically recorded. You can view full audit logs and replay sessions for debugging, compliance, or training.

Viewing Audit Logs

// Get run with full audit log
const run = await rt.runs.get('run-abc123', {
  include: ['auditLog'],
});

console.log(run.auditLog);
// [
//   { time: '2025-01-21T10:00:00Z', type: 'start', message: 'Run started' },
//   { time: '2025-01-21T10:00:01Z', type: 'thinking', content: '...' },
//   { time: '2025-01-21T10:00:02Z', type: 'tool_call', tool: 'bash', input: {...} },
//   ...
// ]

Audit Log Events

Event TypeDescription
startRun started
thinkingAgent reasoning
tool_callTool invoked
tool_resultTool returned
read_fileFile was read
edit_fileFile was edited
file_editFile was edited
user_inputUser sent input mid-run
pauseRun was paused
resumeRun was resumed
errorError occurred
completeRun completed
cancelRun was cancelled

Session Replay

Replay a session step-by-step:
// Start replay
const replay = await rt.runs.replay('run-abc123');

// Step through events
for await (const event of replay) {
  console.log(event.timestamp, event.type);
  
  // Pause replay
  await replay.pause();
  
  // Resume at any time
  await replay.resume();
  
  // Jump to specific time
  await replay.seekTo('2025-01-21T10:00:30Z');
}

Replay Controls

const replay = await rt.runs.replay('run-abc123');

// Speed control
replay.setSpeed(2);    // 2x speed
replay.setSpeed(0.5);  // Half speed

// Jump to event
replay.seekToEvent(15);  // Go to 15th event

// Get current state at any point
const state = await replay.getStateAt('2025-01-21T10:00:30Z');
console.log(state.files);      // Files at that moment
console.log(state.context);    // Agent context at that moment

Dashboard Replay

In the dashboard, you can:
  • View timeline of all events
  • Click on any event to see details
  • See file diffs at each point
  • Watch agent “thinking” in real-time replay
  • Export replay as video or transcript

Filtering Logs

// Filter by event type
const toolCalls = run.auditLog.filter(e => e.type === 'tool_call');

// Filter by time range
const filtered = await rt.runs.get('run-abc123', {
  include: ['auditLog'],
  auditLog: {
    from: '2025-01-21T10:00:00Z',
    to: '2025-01-21T10:05:00Z',
    types: ['tool_call', 'tool_result'],
  },
});

Export

// Export as JSON
const log = await rt.runs.exportAuditLog('run-abc123', {
  format: 'json',
});

// Export as transcript
const transcript = await rt.runs.exportAuditLog('run-abc123', {
  format: 'transcript',
});

// Export as video (coming soon)
const video = await rt.runs.exportAuditLog('run-abc123', {
  format: 'video',
});

Compliance Features

For enterprise compliance needs:
// Set retention policy
await rt.settings.update({
  auditLogRetention: '90d',  // Keep for 90 days
});

// Enable immutable logs
await rt.settings.update({
  immutableAuditLogs: true,  // Cannot be deleted
});

// Enable encryption
await rt.settings.update({
  auditLogEncryption: true,
});

CLI Usage

# View audit log
runtools runs log run-abc123

# Replay in terminal
runtools runs replay run-abc123

# Export
runtools runs export run-abc123 --format json > log.json

Use Cases

Debugging

Understand what went wrong in a failed run

Compliance

Maintain audit trail for regulated industries

Training

Learn from successful agent interactions

Quality Assurance

Review agent behavior before production