Expand description
Agent subsystem — definitions, instances, and their lifecycle CRUD.
Covers agent_def_* methods (template + user-clone definitions),
instance_* methods (per-launch instance rows, named-agent
continuation, identity-bound active-for-block resolution), the
AgentDefinition / AgentInstance structs, and the InstanceStatus enum.
db_agents is the authoritative consolidated read table; db_agent_definitions
and db_agent_instances remain the write targets with dual-write mirrors.
Structs§
- Agent
Definition - A user-defined AI agent in the user’s agent-definition catalog.
- Agent
Instance - One row per running/historical execution of an agent definition.
block_id/session_id/github_contextare modelled as empty strings on the wire rather thanOption<String>to match the existing schema conventions (NOT NULL DEFAULT ''). Callers that need structured absence can use.is_empty(). - GitHub
Context - Optional context describing which GitHub-side unit of work a specific
instance is operating on. Stored as JSON in
db_agent_instances.github_context(empty string when unset). - Instance
Update - Partial-update payload for
Store::instance_update_partial. EachSomefield is written;Noneleaves the column untouched. Mirrors the mutable subset ofCommandUpdateAgentInstanceData(block_id/session_id/status/github_context/ended_at) — the only columnsinstance_updateever wrote.Some("")for a string field explicitly clears it.
Enums§
- Instance
Status - Instance lifecycle status. Serialised lowercase to match the DB text.
Functions§
- default_
agent_ 🔒type - default_
container_ 🔒volumes - derive_
slug - Derive a filesystem-safe slug from a display name. Lowercase,
ASCII alphanumeric + dash/underscore, consecutive dashes collapsed,
trimmed to 64 chars. Returns
"agent"if the input has no valid characters (defensive fallback). - map_
agent_ 🔒definition_ row - Row mapper for
db_agentsrows projected back into theAgentDefinitionshape. The column order MUST match the SELECT inagent_def_list.parent_template_idmaps toparent_idbecause the consolidated table renamed the field to clarify its semantics (template lineage), but the wire shape kept the old name. - map_
instance_ 🔒row