Database schema
Database schema
Otonix stores agent state, infrastructure state, and payment receipts in PostgreSQL.
Drizzle ORM is used for typed, parameterized access.
agents
id
varchar (UUID)
Primary key
name
text
Agent name
status
text
active, inactive, terminated
survivalTier
text
full, conservation, critical, terminated
credits
real
USDC credit balance
walletAddress
text
EVM wallet address
genesisPrompt
text
Initial system prompt
model
text
AI model (default: claude-opus-4-6)
heartbeatInterval
integer
Seconds between heartbeats (default: 60)
lastHeartbeat
timestamp
Last heartbeat received
apiKeyId
varchar
Linked API key ID
vpsIp
text
VPS IP address
totalActions
integer
Total actions executed
childrenCount
integer
Number of child agents
createdAt
timestamp
Creation timestamp
sandboxes
id
varchar (UUID)
Primary key
name
text
Sandbox name
status
text
running, stopped, deploying, error
os
text
Operating system
cpu
integer
vCPU count
memory
integer
Memory in MB
disk
integer
Disk in GB
region
text
Datacenter region
ipAddress
text
Public IP
ports
jsonb
Open ports array
agentId
varchar
Linked agent ID
createdAt
timestamp
Creation timestamp
domains
id
varchar (UUID)
Primary key
name
text
Domain name (unique)
status
text
active, expired, pending
registeredAt
timestamp
Registration date
expiresAt
timestamp
Expiry date
dnsRecords
jsonb
Array of DNS record objects
sandboxId
varchar
Linked sandbox ID
agentId
varchar
Linked agent ID (auto-renewal)
autoRenew
boolean
Auto-renew enabled
apiKeys
id
varchar (UUID)
Primary key
key
text
Masked API key
keyHash
text
SHA-256 hash for validation
keyPrefix
text
Display prefix
name
text
Key name
ownerWallet
text
Owner wallet address
agentCount
integer
Number of linked agents
status
text
active, revoked
createdAt
timestamp
Creation timestamp
agentActions
id
varchar (UUID)
Primary key
agentId
varchar
Agent ID
action
text
Action description
category
text
system, compute, domain, payment
details
text
Additional details
status
text
completed, failed, pending
autonomous
boolean
Was this autonomous?
createdAt
timestamp
Creation timestamp
transactions
id
varchar (UUID)
Primary key
type
text
debit, credit
amount
real
Amount in currency
currency
text
Currency (default: USDC)
description
text
Transaction description
status
text
pending, completed, failed
fromAddress
text
Sender wallet address
toAddress
text
Recipient address
txHash
text
On-chain transaction hash
metadata
jsonb
Metadata (protocol, orderId, etc.)
createdAt
timestamp
Creation timestamp
computeLogs
id
varchar (UUID)
Primary key
model
text
AI model used
tokensIn
integer
Input tokens
tokensOut
integer
Output tokens
cost
real
Cost in USDC
agentId
varchar
Agent ID
createdAt
timestamp
Creation timestamp
Relationships (typical)
agents.apiKeyId -> apiKeys.idagentActions.agentId -> agents.idcomputeLogs.agentId -> agents.iddomains.agentId -> agents.iddomains.sandboxId -> sandboxes.idsandboxes.agentId -> agents.id
Last updated