Skip to content

Schema: agents

Part of the generated database reference.

agent_conversation_folders

  • Domain: agents Β· Feature gate: #[cfg(feature = "agents")] Β· Migration: 6.8.0-agent-vm-per-user
  • Rust source: botschema/src/agents.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
agent_session_id UUID no β€” FK agent_sessions.id
conversation_id VARCHAR(64) no β€” β€” β€”
folder_path VARCHAR(256) no β€” β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”

agent_runs

  • Domain: agents Β· Feature gate: #[cfg(feature = "agents")] Β· Migration: 6.8.5-run-events
  • Rust source: botschema/src/agents.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
schedule_id UUID yes β€” FK agent_schedules.id
bot_id UUID no β€” β€” β€”
trigger_kind VARCHAR(16) no β€” β€” β€”
status VARCHAR(24) no 'queued' β€” β€”
plan JSONB yes β€” β€” β€”
steps JSONB yes β€” β€” β€”
result_summary TEXT yes β€” β€” β€”
artifacts JSONB yes β€” β€” β€”
verdict JSONB yes β€” β€” β€”
delivery_status JSONB yes β€” β€” β€”
error TEXT yes β€” β€” β€”
started_at TIMESTAMPTZ yes β€” β€” β€”
finished_at TIMESTAMPTZ yes β€” β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”
session_id UUID yes β€” β€” β€”
thread_id TEXT yes β€” β€” β€”
user_id UUID yes β€” β€” β€”
parent_run_id UUID yes β€” β€” β€”

Indexes: idx_agent_runs_session(session_id, created_at DESC), idx_agent_runs_thread(thread_id, created_at DESC)

agent_schedules

  • Domain: agents Β· Feature gate: #[cfg(feature = "agents")] Β· Migration: 6.5.85-agent-schedules
  • Rust source: botschema/src/agents.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
org_id UUID yes β€” β€” β€”
branch_id UUID yes β€” β€” β€”
bot_id UUID no β€” β€” β€”
title TEXT no β€” β€” β€”
goal TEXT no β€” β€” β€”
cron_expr VARCHAR(64) no β€” β€” β€”
timezone VARCHAR(64) no 'UTC' β€” β€”
owner_user_id UUID no β€” β€” β€”
delivery JSONB no '{"email":true,"sms":false,"channels":[]}'::jsonb β€” β€”
enabled BOOLEAN no TRUE β€” β€”
max_runtime_secs INTEGER no 900 β€” β€”
tool_allowlist JSONB yes β€” β€” β€”
next_run_at TIMESTAMPTZ yes β€” β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”
updated_at TIMESTAMPTZ no NOW() β€” β€”

agent_sessions

  • Domain: agents Β· Feature gate: #[cfg(feature = "agents")] Β· Migration: 6.8.0-agent-vm-per-user
  • Rust source: botschema/src/agents.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
session_id VARCHAR(64) no β€” UQ β€”
user_id UUID no β€” β€” β€”
org_id UUID yes β€” β€” β€”
branch_id UUID yes β€” β€” β€”
bot_id UUID no β€” β€” β€”
vm_name VARCHAR(128) no β€” UQ β€”
status VARCHAR(24) no 'provisioning' β€” β€”
last_active_at TIMESTAMPTZ no NOW() β€” β€”
expires_at TIMESTAMPTZ yes β€” β€” β€”
metadata JSONB yes β€” β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”
active_conversation_id VARCHAR(64) yes β€” β€” β€”

agent_snapshots

  • Domain: agents Β· Feature gate: #[cfg(feature = "agents")] Β· Migration: 6.5.82-agent-sessions
  • Rust source: botschema/src/agents.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
agent_session_id UUID no β€” FK agent_sessions.id
label VARCHAR(200) yes β€” β€” β€”
incus_snapshot VARCHAR(160) no β€” β€” β€”
size_bytes BIGINT yes β€” β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”

agent_spans

  • Domain: agents Β· Feature gate: #[cfg(feature = "agents")] Β· Migration: 6.5.85-agent-schedules
  • Rust source: botschema/src/agents.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
run_id UUID no β€” FK agent_runs.id
parent_id UUID yes β€” β€” β€”
kind VARCHAR(24) no β€” β€” β€”
name TEXT no β€” β€” β€”
input_ref TEXT yes β€” β€” β€”
output_ref TEXT yes β€” β€” β€”
tokens_in INTEGER yes β€” β€” β€”
tokens_out INTEGER yes β€” β€” β€”
vm_seconds INTEGER yes β€” β€” β€”
status VARCHAR(24) no 'ok' β€” β€”
error TEXT yes β€” β€” β€”
started_at TIMESTAMPTZ yes β€” β€” β€”
finished_at TIMESTAMPTZ yes β€” β€” β€”

compute_usage_hourly

  • Domain: agents Β· Feature gate: #[cfg(feature = "agents")] Β· Migration: 6.5.85-agent-schedules
  • Rust source: botschema/src/agents.rs
Column SQL type Null Default Key References
org_id UUID no β€” PK β€”
hour TIMESTAMP no β€” PK β€”
resource VARCHAR(32) no β€” PK β€”
quantity DOUBLE PRECISION no 0 β€” β€”
updated_at TIMESTAMPTZ no NOW() β€” β€”

org_api_keys

  • Domain: agents Β· Feature gate: #[cfg(feature = "agents")] Β· Migration: 6.5.83-org-api-keys
  • Rust source: botschema/src/agents.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
org_id UUID no β€” β€” β€”
name VARCHAR(120) no β€” β€” β€”
key_hash VARCHAR(128) no β€” β€” β€”
key_prefix VARCHAR(16) no β€” β€” β€”
scopes JSONB no '[]'::jsonb β€” β€”
last_used_at TIMESTAMPTZ yes β€” β€” β€”
revoked_at TIMESTAMPTZ yes β€” β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”

sandbox_runs

  • Domain: agents Β· Feature gate: #[cfg(feature = "agents")] Β· Migration: 6.5.84-sandbox-runs
  • Rust source: botschema/src/agents.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
org_id UUID yes β€” β€” β€”
user_id UUID yes β€” β€” β€”
language VARCHAR(24) no β€” β€” β€”
status VARCHAR(24) no 'queued' β€” β€”
exit_code INTEGER yes β€” β€” β€”
stdout_ref TEXT yes β€” β€” β€”
stderr_ref TEXT yes β€” β€” β€”
duration_ms INTEGER yes β€” β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”