Skip to content

feat(orchestrator): add built_in flag to agent schema and storage layer#1146

Merged
geoffjay merged 21 commits intoepic-1144from
issue-1137
Apr 17, 2026
Merged

feat(orchestrator): add built_in flag to agent schema and storage layer#1146
geoffjay merged 21 commits intoepic-1144from
issue-1137

Conversation

@geoffjay
Copy link
Copy Markdown
Owner

Add a built_in boolean field to distinguish programmatically-created system agents from user-created ones. This is the foundational schema change that all subsequent built-in agent work depends on.

Changes

  • New migration m20260415_000013_add_builtin_to_agents adds built_in INTEGER NOT NULL DEFAULT 0 to the agents table (idempotent, existing rows default to 0)
  • agent_entity::Model gains built_in: i32
  • Agent struct gains built_in: bool (default false)
  • AgentResponse gains built_in: bool and the From<Agent> impl maps it through
  • AgentStorage::add() and model_to_agent() persist/read the field
  • CreateAgentRequest intentionally does not expose built_in — only the system may set it
  • TypeScript Agent interface gains built_in?: boolean with JSDoc explaining the UI contract

Closes #1137

- Add m20260415_000013_add_builtin_to_agents migration (INTEGER NOT NULL DEFAULT 0)
- Add built_in: i32 field to agent entity
- Add built_in: bool field to Agent struct and AgentResponse
- Update model_to_agent() and storage add() to persist/read the field
- Add built_in?: boolean to TypeScript Agent interface
- CreateAgentRequest intentionally omits built_in (system-only field)
…-agents endpoint

- GET /agents now excludes built_in agents by default
- ?include_builtin=true opts in to seeing all agents
- Add GET /system-agents returning only built_in=true agents
- list_paginated() gains built_in_filter: Option<bool> parameter
- AgentStorage::list_system_agents() fetches only system agents
- AgentManager::list_system_agents() delegates to storage
- OrchestratorClient::list_system_agents() hits GET /system-agents
- debug_agents endpoint unchanged (shows all agents)
- Add system_agents.rs with SYSTEM_AGENT_NAME constant and build_system_agent_config()
- System agent uses sonnet model, AllowList tool policy (read-only), joins 'system' room
- Includes inline system prompt covering agentd architecture and services
- AgentManager::bootstrap_system_agents() spawns/restarts system agent after reconcile
- spawn_agent() gains built_in: bool parameter; API always passes false
- terminate_agent() guards against deleting built_in agents (returns error)
- bootstrap_system_agents() called from main.rs after reconcile()
@geoffjay geoffjay linked an issue Apr 17, 2026 that may be closed by this pull request
10 tasks
geoffjay and others added 14 commits April 16, 2026 21:13
- system_agent_prompt covers: service inventory with ports, agent lifecycle,
  status/activity states, built-in agent concept, CLI operations, communicate
  rooms, memory service, diagnostics guide, metrics/observability, tool policy
- version prepended dynamically via env!(CARGO_PKG_VERSION) at build time
- tool policy documented with rationale for each allowed category
- AllowList entries align with prompt documentation (update both in tandem)
- prompt targets <6000 tokens
- Add 'agent system-agents list' — fetch from GET /system-agents
- Add 'agent system-agents get <id|name>' — resolve by UUID or name
- Add 'agent system-agents message <id> <text>' — send prompt to system agent
- Add 'agent system-agents status' — compact table of name/status/model/activity
- All subcommands support --json output mode
- Add --include-builtin flag to 'agent list' (passes ?include_builtin=true)
- OrchestratorClient::list_agents_filtered() added for include_builtin support
- system_agents command registered in Commands enum and dispatched via orchestrator URL
- AgentsPage renders SystemAgentList above AgentList
- SystemAgentList fetches from GET /system-agents with 10s auto-refresh
- Shows name (with 'system' badge), status, model, rooms columns
- Collapsible panel with refresh button; distinguishes loading/error/empty states
- Clicking a row navigates to /agents/{id} detail page (same as user agents)
- No create/delete actions exposed (built-in agents are not user-managed)
- useSystemAgents hook follows same pattern as useAgents
- OrchestratorClient.listSystemAgents() added (GET /system-agents)
- AgentConfig TS interface gains rooms?: string[]
Adds 10 HTTP integration tests covering the full system-agent feature
surface via tower::ServiceExt::oneshot (no real TCP). Includes a
NullBackend to avoid external dependencies.

Also fixes terminate_agent handler to return 403 Forbidden (not 500)
when attempting to delete a built-in system agent.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
test(orchestrator): integration tests for system agent lifecycle
feat(ui): add system agents section to agents page
feat(cli): add system-agents subcommand
feat(orchestrator): finalize system agent system prompt and tool policy
feat(orchestrator): define system agent config and spawn at startup
feat(orchestrator): filter built-in agents from list API, add /system-agents endpoint
@geoffjay geoffjay merged commit f39c521 into epic-1144 Apr 17, 2026
@geoffjay geoffjay deleted the issue-1137 branch April 17, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add built_in flag to Agent schema and storage layer

1 participant