Agent Data Model & Ontology
Status: Research (RFC) · Updated: 2026-07-05 · Tracks: AURA-744
This page defines a canonical data model and ontology for coding AI agents — the entities, relationships, states, and events that describe how an agentic coding system represents work, conversation, tools, sub-agents, artifacts, and deployment. It is the reference vocabulary the System Architecture runtime contract (§1.1), the control-plane job/agent store, and the management plane are designed against.
It is synthesized from three battle-tested reference models, each studied for what it models best:
- Claude Agent SDK (self-hosted loop) — the richest turn/tool/sub-agent/session model.
- Cloudflare vibesdk (agents-as-infrastructure) — agent-as-Durable-Object, code artifacts, sandbox preview, deploy lifecycle, tenancy.
- Claude Managed Agents (CMA) (hosted loop) — versioned agent config, an append-only event log as the source of truth, and a brain / hands / session decomposition.
Auraison's central-runtime harness is a CMA; its edge harness is Pi (see System Architecture §1.2 / §1.1). This ontology therefore doubles as the reconciliation between those two runtimes.
1. One axis separates the three models: who owns the loop state
Every coding-agent platform runs the same inner agent loop — prompt, model turn, tool calls, tool results, repeat until done. The three reference models differ on essentially one architectural question: where the loop/conversation state lives, and therefore who is the source of truth for resume and audit.
| Claude Agent SDK | Cloudflare vibesdk | Claude Managed Agents | |
|---|---|---|---|
| What it is | Library that runs the loop as a subprocess/in-process | Vibe-coding platform; agent is a Durable Object | Hosted, managed agent surface (beta managed-agents-2026-04-01) |
| Who runs the loop | The caller's process | The Durable Object (Cloudflare edge) | Anthropic orchestration layer ("harness"), stateless |
| Loop-state owner (source of truth) | Caller — a per-session .jsonl transcript replayed on resume | The Durable Object — setState() + per-DO SQLite | The platform — an append-only event log external to the harness |
| Conversation representation | Message stream, persisted to JSONL | full_conversations / compact_conversations SQLite tables | Event log (sevt_…), the atomic unit of the model |
| Resume | resume=<id> replays the transcript | DO rehydrates from AgentState after hibernation | wake(session) reboots a fresh harness, replays the log; sandbox restored from an idle checkpoint |
| Config model | AgentDefinition / Options per call | apps row + DO AgentState | Persisted, versioned Agent object; sessions pin a version |
| Where tools execute | Caller infra (or Anthropic server-tools) | Sandbox / Container per app | Per-session Container (or caller infra if self_hosted) |
This is the same gradient the System Architecture doc calls the locality model (§1.3). The edge runtime (Pi) is caller-owned loop state, close to hardware; the central runtime (CMA) is platform-owned loop state, durable and global. The canonical ontology below is deliberately loop-state-owner-agnostic so an entity means the same thing whether it is realized at the edge or centrally.
2. Source ontologies (condensed)
2.1 Claude Agent SDK
A single query() call is one agent loop yielding a stream of Messages until a terminal
ResultMessage.
- Session — persisted conversation (not the filesystem), one
.jsonlpersession_idunder~/.claude/projects/<encoded-cwd>/. Supportsresume(specific),continue(most recent), andfork_session(copy history into a newsession_id; file edits are real and shared). - Message / turn — union
UserMessage,AssistantMessage(model,usage,message_id),SystemMessage(subtype=init/compact_boundary/ …),ResultMessage. A turn is one model round-trip that may include tool calls;max_turnscounts tool-use turns. - ContentBlock —
TextBlock,ThinkingBlock,ToolUseBlock(id,name,input),ToolResultBlock(tool_use_id,content,is_error). TheToolUseBlock.idtoToolResultBlock.tool_use_idlink is the call to result join. - Tool — built-in, MCP (
mcp__<server>__<tool>), or custom in-process (@tool,input_schema/ handler).ToolAnnotations(readOnlyHint,destructiveHint, …) gate parallel execution. - Sub-agent —
AgentDefinition(descriptiondrives auto-delegation,prompt,tools,model,skills,permissionMode,background, …) or a markdown file in.claude/agents/. Invoked via theAgenttool; runs in its own fresh context; only its final message returns; child messages carryparent_tool_use_id; a resumableagentIdtrailer is returned; nesting up to 5 levels. - Hook — callbacks at lifecycle points (
PreToolUse,PostToolUse,SubagentStart/Stop,PreCompact, …) that can allow / deny / modify. - Skill —
.claude/skills/<name>/SKILL.md, loaded on demand. - Memory —
CLAUDE.md, re-injected every request (survives compaction). - Result —
ResultMessage(subtypesuccess /error_max_turns/ …,total_cost_usd,usage,num_turns,session_id,model_usage,permission_denials).
2.2 Cloudflare vibesdk
Two persistence layers that must not be conflated: a global D1 relational catalog and per-agent Durable Object state.
apps(D1) — the generated app/project:originalPrompt,finalPrompt,framework,userId,visibility,status(generating/completed),deploymentId,version,parentAppId(fork/version lineage),screenshotUrl,lastDeployedAt.users,cloudflareAccounts,aiGateways— tenant identity, the CF account deployments land in, and a per-account gateway with a credit budget.userModelConfigs— per-user, per-agent-action model routing (agentActionName,modelName,temperature,reasoningEffort,fallbackModel,providerOverride).CodeGeneratorAgent extends Agent<Env, AgentState>(Durable Object) — one per app. State is a discriminated unionAgentState=PhasicStateorAgenticStateorThinkStateoverBaseProjectState(query,sessionId,blueprint,generatedFilesMap,sandboxInstanceId,commandsHistory, …).Blueprint— the plan:title,description,views,userFlow,dataFlow,architecture,frameworks,implementationRoadmap,initialPhase,pitfalls.FileState(artifact) —filePath,fileContents,filePurpose,lastDiff.PhaseState—name,description,files,completed.CurrentDevState(live status machine) —IDLE,PHASE_GENERATING,PHASE_IMPLEMENTING,REVIEWING,FINALIZING(up toMAX_PHASES = 10).- Conversation — per-DO SQLite
full_conversations/compact_conversations, deduped byconversationId-role-tool_call_id. - Sub-agents are not separate DOs — they are behaviors / objectives inside the one DO.
- Deployment — packaged into a Workers for Platforms dispatch namespace (isolated Worker per app, unique URL, per-app D1 / KV / R2 bindings).
2.3 Claude Managed Agents
CMA virtualizes an agent into brain (Claude + harness loop, on Anthropic's orchestration layer), hands (a per-session sandbox container), and session (the append-only log). Design invariant: the brain shouldn't assume where the hands run, the hands shouldn't hold credentials, and the session shouldn't live inside the harness — so the harness is disposable.
- Agent (
agent_…) — persisted, versioned config:name,model,system,tools,mcp_servers,skills,multiagent. Each update mints a new immutable version; sessions pin{id, version}; archive is permanent. - Environment (
env_…) — reusable container template:config(cloudorself_hosted, networking, packages). - Session (
sesn_…) — a stateful running instance = one task/run.status=reschedulingtorunning(which alternates with)idletoterminated. Holdsagent(resolved snapshot),resources,vault_ids,usage,outcome_evaluations. - Event (
sevt_…) — the atomic unit; the append-only log is the conversation state. Typed with a dotted{domain}.{action}namespace: inbounduser.message,user.interrupt,user.tool_confirmation,user.custom_tool_result,user.define_outcome; outboundagent.message,agent.thinking,agent.tool_use,agent.tool_result,session.status_running/_idle/_terminated,span.model_request_start/_end(carriesmodel_usage). Communication is explicitly event-based. - Container — per-session sandbox where tools execute; the loop does not run here.
Checkpointed on
idleso a session resumes cleanly. - Vault / Credential (
vlt_…) — secrets Anthropic injects at egress; never enter the sandbox (mcp_oauth,static_bearer,environment_variable). - Memory Store (
memstore_…) / Memory (mem_…) / Memory Version (memver_…) — workspace-scoped documents that survive session death (durable cross-session state), with per-mutation actor attribution. - Skill (
skill_…), Thread (per-subagent isolated event stream,parent_thread_id), Deployment (depl_…, cron-scheduled autonomous sessions), Outcome (adefine_outcome- grader loop scoring iterations against a rubric).
3. Canonical Auraison agent ontology
The union of the three, normalized to loop-state-owner-agnostic entities. An Auraison agent is a configured identity (Agent) that, under a Role, executes Sessions; each Session is an append-only stream of Events (its source of truth) that projects into Turns, ToolCalls, Artifacts, and Usage.
3.1 Entity mapping
| Canonical entity | Claude Agent SDK | Cloudflare vibesdk | Claude Managed Agents |
|---|---|---|---|
| Agent (versioned config: LM(s), system prompt, tool grants, skills, sub-agent roster) | AgentDefinition / Options | apps config + CodeGeneratorAgent class | Agent (agent_…, versioned) |
| Role (deploy-time identity + permissions/credentials over resources) | permission mode + rules | userId / cloudflareAccounts binding | vault_ids + tools/permissions on the session |
| Session (Run) (one stateful execution against a task) | Session (.jsonl) | apps row + DO instance | Session (sesn_…) |
| Event (append-only record of everything) | Message stream (JSONL lines) | full_/compact_conversations | Event (sevt_…) |
| Turn / Message (one model round-trip; a projection over Events) | AssistantMessage / UserMessage | conversation rows | agent.message / user.message |
ContentBlock (text, thinking, tool_use, tool_result, image) | TextBlock / ThinkingBlock / ToolUseBlock / ToolResultBlock | message parts | content blocks (identical shape) |
| Tool (capability grant with I/O schema) | built-in / MCP / custom | agent tools/ | agent tools / mcp_servers |
ToolCall / ToolResult (tool_use paired to its result) | ToolUseBlock.id to ToolResultBlock.tool_use_id | tool-call rows | agent.tool_use to agent.tool_result |
| SubAgent / Thread (child execution, isolated context, linked to parent) | sub-agent + parent_tool_use_id, agentId | in-DO behaviors/objectives | Thread + parent_thread_id |
| Artifact (produced file/output) | file edits (checkpointed) | FileState (filePath, fileContents, filePurpose, lastDiff) | File output (scope_id) |
| Environment / Sandbox (compute tools run in; template + instance) | sandbox option | Sandbox / Container | Environment (env_…) + Container |
| Plan / Blueprint / Outcome (declared objective + acceptance rubric) | Plan agent | Blueprint | Outcome (define_outcome + grader) |
| Memory (durable cross-session state) | CLAUDE.md | (none durable) | Memory Store (memstore_…) |
| Vault / Credential (managed secrets, egress-injected) | env / settings | secret store / provider secrets | Vault (vlt_…) |
| Deployment (publish produced app to a runtime) | (n/a) | Workers for Platforms dispatch | Deployment (depl_…) |
| Usage (tokens, cost, turns, duration) | usage / model_usage / total_cost_usd | AI Gateway metrics + InferenceMetadata | Session.usage + span.model_request_end.model_usage |
Two entities have no clean equivalent in one source and are worth calling out: Memory as a
first-class durable store exists only in CMA (the SDK approximates it with CLAUDE.md; vibesdk
has none) — Auraison should adopt the CMA model. Deployment is central to vibesdk and CMA but
absent from the SDK — it belongs in the ontology because Auraison's user plane deploys workloads.
3.2 Entity–relationship view
3.3 Entity definitions
- Agent — a versioned configuration: which LM(s) it may use (large or small — see the System Architecture LM definition), system prompt, the set of Tools and Skills it may call, its sub-agent roster, and default permission posture. Versioning is immutable and append-only (CMA's model); a Session pins the exact version it ran, which is a hard requirement for reproducibility.
- Role — the deployment-time binding of an Agent to an identity and a permission/credential set over resources (the user's framing in System Architecture §intro). A general-purpose CMA and a domain-specific fine-tuned agent may run the same task under different Roles. Role governs Vault access, tool allow/deny, and tenancy.
- Session (Run) — one stateful execution of an Agent, under a Role, against a task. It owns a status lifecycle (§4), an Event log, produced Artifacts, and accrued Usage. Whether its loop state is caller-owned (edge/Pi), DO-owned, or platform-owned (central/CMA) is a deployment choice, not an ontological one.
- Event — the atomic, append-only, timestamped record of everything that happened in a
Session: user inputs, model messages, thinking, tool calls and results, sub-agent lifecycle,
status transitions, model-request spans (with usage), permission decisions, and deploys. The
Event log is the source of truth; Turns, ToolCalls, and Memory are projections over it. Events
carry a dotted
{domain}.{action}type (adopting CMA's taxonomy) and aprocessed_atmarker. - Turn / Message — a projection: one model round-trip. Useful for display and
max_turnsbudgeting; not itself the source of truth. - ContentBlock —
text,thinking,tool_use,tool_result,image. Identical across the SDK and CMA; adopt verbatim. - Tool / ToolCall / ToolResult — a Tool is a capability grant with an input/output schema
(built-in, MCP-served, custom in-process, or platform server-tool). A ToolCall (
tool_use) is joined to exactly one ToolResult by id. This pairing is universal across all three sources and is the backbone of provenance. - SubAgent / Thread — a child Agent execution with its own isolated context, linked to
the parent by
parent_tool_use_id(SDK) orparent_thread_id(CMA). Only its final result crosses back to the parent; its internal Events stay in its own stream. Auraison models this as a child Session/Thread so the same Event/Artifact machinery applies recursively. - Artifact — a produced file or output: path, contents (or a URI to bytes), purpose, diff,
and a version. Auraison versions Artifacts immutably in R2 via the data-plane versioning helper
(
lakehouse.versioning.version_dataset/version_checkpoint) so a produced artifact is a reproduciblevN. - Environment / Sandbox — the compute the Tools execute in, as a reusable template plus a per-Session instance. Checkpointed on idle for clean resume (CMA's model).
- Plan / Blueprint / Outcome — the declared objective and, optionally, an acceptance rubric
that a grader scores each iteration against. Unifies vibesdk's
Blueprint, CMA'sOutcome, and the SDK'sPlanagent. - Memory — durable, cross-session, workspace-scoped state that survives Session death, with per-mutation actor attribution and immutable version history (CMA's Memory Store). In the four-plane model this is the durable backing of the Memory domain, rebuilt as a projection of the Event log.
- Vault / Credential — managed secrets injected at egress and never exposed to Agent-authored code (CMA's model). A management-plane concern.
- Deployment — publishing a produced Artifact/app to a runtime (Workers for Platforms, a KubeRay workload, an edge device), with its own identity and lifecycle.
- Usage — tokens (
input,output,cache_creation,cache_read), cost estimate, turns, and durations, recorded per model-request span and aggregated per Session. The unit of cost attribution for the management plane.
4. Lifecycle & state machine
The canonical Session lifecycle, with each source's states mapped onto it.
| Canonical state | Claude Agent SDK | Cloudflare vibesdk (CurrentDevState) | Claude Managed Agents (Session.status) |
|---|---|---|---|
| Provisioning | SystemMessage(init) | initialize() | rescheduling |
| Planning | Plan mode | PHASE_GENERATING (blueprint) | first running (plan) |
| Running | assistant to tool to user loop | PHASE_IMPLEMENTING | running |
| Idle | (streaming input waits) | IDLE | idle (requires_action) |
| Reviewing | (re-prompt) | REVIEWING | outcome-eval loop |
| Deploying | (n/a) | FINALIZING + deploy | Deployment run |
| Terminated | ResultMessage | apps.status = completed | terminated |
The persisted event set (minimum, for replay / audit / resume — the AgentEvent schema of the
runtime contract): user.message / intent, agent.message, agent.thinking,
agent.tool_use, agent.tool_result, subagent.started / subagent.stopped,
artifact.written, span.model_request_end (usage), session.status_* transitions,
permission.decided, deployment.*. Recording exactly this set makes a Session fully
reconstructable and lets a stateless harness be rebooted (wake then replay), which is what
lets the central runtime survive harness crashes.
5. Four-plane placement
Every entity lands in one of the four planes (see System Architecture). This is the bridge from ontology to where each entity is stored and served.
| Plane | Entities | Rationale |
|---|---|---|
| User plane | Session/Run and Artifacts of the reference-app (edge) agents, near hardware | Latency-sensitive, domain-specific work close to the robot/app |
| Control plane | Agent registry, Role, Session/Run store, Event log, Tool/Skill registry, Plan, orchestration & permission policy | The "solve-once" coordination core; this is where the in-memory _jobs dict is replaced (§6) |
| Data plane | Artifact bytes, Memory stores/projections, Event history, datasets | DuckDB + DuckLake over RustFS/R2; Memory is a derived projection of the Event log |
| Management plane (v2) | Vault/Credential, Usage/cost attribution, quotas, tenancy on Role, Deployment governance | Billing, tenancy, and secrets — the CMA "never in the sandbox" model |
6. Reconciliation with the runtime contract
System Architecture §1.1 defines six typed primitives. The canonical ontology is a superset that grounds them in concrete, documented shapes from the three sources:
| Runtime primitive (§1.1) | Canonical entity | Concrete shape to adopt |
|---|---|---|
| Intent | inbound Event | CMA user.message / user.define_outcome; SDK query prompt |
| Skill | Skill | SDK / CMA Skill (SKILL.md + version) |
| ToolCall | ToolCall / ToolResult | tool_use to tool_result id linkage (identical in all three) |
| RunState | Session (Run) | CMA Session.status machine (§4) over the Event log |
| AgentEvent | Event | CMA Event (sevt_…, dotted {domain}.{action}, append-only, processed_at) |
| ProjectionEvent | Memory / Artifact / Turn projections | derived read models rebuilt from the Event log |
This resolves the open design item in System Architecture §1.2 ("the CMA agent loop is
event-based … reconcile it with the platform's AgentEvent / ProjectionEvent contract"). The
recommendation: adopt CMA's Event taxonomy as the concrete AgentEvent schema, have the edge
(Pi Session-Tree events) map onto the same shape, and define ProjectionEvent as the derived
Memory-domain read models. One event model then spans edge and central runtimes, which is exactly
the property the dual-runtime design needs.
7. Path to a control-plane persistence schema
The control-plane job store is currently an in-memory _jobs dict (api/jobs.py). The ontology
gives a direct target schema. The Event log is the source of truth; Jobs, Turns, and status
are projections over it.
| Table | Key columns | Notes |
|---|---|---|
agents | id, name, version, model, system, tools (jsonb), skills (jsonb), archived_at | Immutable versions; append-only history |
roles | id, agent_id, identity, permissions (jsonb), vault_refs (jsonb), tenant_id | Deploy-time binding |
sessions | id, agent_id, agent_version, role_id, environment_id, status, created_at, updated_at, usage (jsonb) | The Run; status per §4 |
events | id, session_id, seq, thread_id, type, payload (jsonb), processed_at | Append-only, source of truth; replaces _jobs semantics |
artifacts | id, session_id, path, purpose, version, uri, sha256, created_at | Bytes in R2 (immutable vN); row is the pointer |
deployments | id, artifact_id / session_id, target, identity, status, deployed_at | Workers for Platforms / KubeRay / edge |
A "Job" (the current API surface) becomes a thin projection over sessions + events, so the
existing POST /api/v1/jobs contract can be preserved while the store gains full provenance,
resume, and audit for free. usage rolls up from events (span.model_request_end) for
management-plane cost attribution.
8. Open questions
- Edge event mapping. What is the exact transform from Pi Session-Tree events to the
AgentEvent(CMA-shaped) schema? This is the concrete deliverable that unblocks a single event model across runtimes. - Artifact vs Memory boundary. vibesdk keeps generated files in agent state; CMA separates
Files (session-scoped) from Memory (cross-session). Auraison should draw the line at
reproducibility: reproducible outputs are Artifacts (immutable
vNin R2); evolving working state is Memory (a projection of the Event log). - Multiagent topology. CMA models sub-agents as Threads (own event stream); the SDK as isolated sub-agent contexts; vibesdk as in-DO behaviors. Confirm the recursive Session/Thread model holds for the Deep Evidence Agent's Planner / Researcher / Critic / Synthesizer roster.
- Fork/version lineage. Adopt vibesdk's
parentAppId+versionfor Session/Artifact lineage, or CMA's immutable Agent versioning, or both at different levels?
References
- Claude Agent SDK — Agent SDK overview ↗
- Cloudflare vibesdk — github.com/cloudflare/vibesdk ↗
- Claude Managed Agents — Managed Agents overview ↗ · Scaling Managed Agents (Anthropic Engineering) ↗
- Auraison — System Architecture (runtime contract §1.1, central runtime §1.2, locality §1.3) · AURA-744 ↗ · related AURA-743 ↗ (Cloudflare vibesdk assessment), AURA-544 ↗ (Aura orchestrator)