Skip to content

feat(agent-builder): editable visual canvas for channels/sub-agents/skills/tools/MCP/schedules#264

Open
Weegy wants to merge 6 commits into
mainfrom
worktree-agent-builder-canvas-plan
Open

feat(agent-builder): editable visual canvas for channels/sub-agents/skills/tools/MCP/schedules#264
Weegy wants to merge 6 commits into
mainfrom
worktree-agent-builder-canvas-plan

Conversation

@Weegy

@Weegy Weegy commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Agent Builder — editable visual canvas

A LangChain-style visual builder at /admin/builder for wiring the orchestration layer: Channels → Agent → Sub-Agents → Skills → Tools/MCP, plus a Schedule trigger. Drawing a connection writes the wiring; deleting an edge removes it; node edits apply live without a restart via the existing pg_notify('agents_changed')registry.reload() path.

Backend (middleware)

  • Migration 0003_agent_builder_graph.sqlskills, mcp_servers, agent_subagents, agent_tool_grants, agent_schedules + agents.model_routing/canvas_position + notify triggers (auto-runs on boot).
  • AgentGraphStore (CRUD) + ConfigStore snapshot/diff awareness — graph changes rebuild the owning agent; schedules stay orthogonal (consumed by the cron worker).
  • Per-agent model routing — persisted JSON → runtime triage config; prefers per-agent routing, falls back to the platform default (keeps the Haiku-triage badge working).
  • MCP client (@modelcontextprotocol/sdk, stdio/http/sse) + adapters into native + sub-agent tools.
  • DB sub-agents → LocalSubAgent DomainTools, attached in onAgentBuilt (same seam plugin domain agents use).
  • REST router at /api/v1/operator — graph read, edge create/delete dispatcher, sub-agent/skill/mcp/schedule CRUD, model-routing, positions, mcp discover (requireAuth, ConfigValidationError → 409, inline reload()).
  • Cron schedule worker — 5-field matcher + per-minute-deduped poller firing headless chat() turns.

Frontend (web-ui)

  • @xyflow/react canvas — custom node types, palette, toolbox, inspector, optimistic edges with rollback, debounced position save. Admin dashboard card + en/de i18n.

Verification

  • typecheck + lint clean (middleware + web-ui), web-ui i18n parity OK.
  • 27/27 unit tests pass: cron matcher, model-routing mapping, sub-agent builder, MCP adapters, graph diff, registry hot-reload regression.

Testing

Local end-to-end flow documented in docs/plans/agent-builder-TESTING.md (needs DATABASE_URL + ANTHROPIC_API_KEY; without a DB the builder endpoints 503 and the scheduler is skipped, by design).

Notes / follow-ups

  • Channel-node canvas positions not persisted on GET (cosmetic; agent + sub-agent positions are).
  • Cron evaluated in UTC (per-timezone is a follow-up).
  • DB is source of truth (copy-on-write); file-defined plugin defaults aren't auto-migrated into the tables.

Weegy added 6 commits June 8, 2026 06:58
…kills/tools/MCP/schedules

Adds an editable node-graph Agent Builder at /admin/builder backed by the
existing live, hot-reloading config graph. Drawing a connection writes the
wiring; deleting an edge removes it; edits apply without a restart via
pg_notify('agents_changed') -> registry.reload().

Backend (middleware):
- migration 0003: skills, mcp_servers, agent_subagents, agent_tool_grants,
  agent_schedules + agents.model_routing/canvas_position + notify triggers
- AgentGraphStore (CRUD) + ConfigStore snapshot/diff awareness: graph changes
  rebuild the owning agent; schedules are orthogonal (cron worker consumes them)
- per-agent model routing: persisted JSON -> runtime triage config
- MCP client (@modelcontextprotocol/sdk) + adapters to native + sub-agent tools
- DB sub-agents materialised as LocalSubAgent DomainTools, attached in onAgentBuilt
- REST router at /api/v1/operator: graph read, edge create/delete dispatcher,
  sub-agent/skill/mcp/schedule CRUD, model-routing, positions, mcp discover
- cron schedule worker firing headless agent turns

Frontend (web-ui):
- @xyflow/react canvas: custom nodes, palette, toolbox, inspector, optimistic
  edges with rollback, debounced position save; admin dashboard card; en/de i18n

Tests: cron matcher, model-routing mapping, sub-agent builder, MCP adapters,
graph diff. Typecheck + lint clean (middleware + web-ui), 27/27 unit tests pass.

See docs/plans/agent-builder-TESTING.md for the local end-to-end test flow.
…r-canvas-plan

# Conflicts:
#	middleware/packages/harness-orchestrator/src/registry/applyDiff.ts
…string

@types/express 5 types req.params[x]/req.query[x] as string|string[]; route
handlers passed them straight into string-typed store methods (TS2345). Add a
str() helper and read every param/query through it.
… canvas

Addresses canvas feedback: (1) nothing could be removed, (2) the canvas did
not reflect the running system on load.

Deletion:
- wire onNodesDelete + an explicit Inspector "Delete" button to the existing
  backend DELETE endpoints (sub-agent / skill / mcp / schedule; channel + tool
  nodes map to channel_bind / tool_grant edge deletes)
- deleteKeyCode now also accepts Delete; agent + plugin nodes are non-deletable

Current-system representation:
- GET /graph now includes the agent's live enabled plugins (from the registry)
  as read-only `plugin` nodes wired into the agent, so the canvas shows the
  real capability surface instead of only the editable graph layer

web-ui: new plugin node type + graph mapping + en/de i18n. Typecheck, lint and
i18n parity clean (middleware + web-ui).
…r-agent plugin control

Closes the three canvas follow-ups so the builder is functional end-to-end.

1. Channel binding — the "Channel" palette now drops a draft node; the inspector
   takes channelType + channelKey and "Bind" persists a channel_bind to the
   agent (was a no-op before).
2. Native-tool baseline — GET /graph returns the agent's orchestrator-native
   tools; the canvas renders them as read-only nodes wired into the agent
   (current-system view, deduped against explicit grants).
3. Per-agent plugins — plugin nodes are actionable: detach a plugin from the
   agent (inspector) and enable installable plugins from the agent inspector.
   New endpoints: GET .../installable-plugins, POST/DELETE .../plugins[/:id]
   (ConfigStore.upsertAgentPlugin/removeAgentPlugin → registry reload).

web-ui: ChannelEditor + PluginEditor inspectors, agent plugin section, native
baseline nodes/edges, en/de i18n. Typecheck/lint/i18n clean (middleware + web-ui).
…cker, per-agent native tools

1. Timezone-aware cron — the matcher now projects into the schedule's IANA
   timezone via Intl (e.g. "0 9 * * *" in Europe/Berlin fires at Berlin 09:00,
   DST-correct); invalid tz falls back to UTC. Worker passes schedule.timezone.
2. Channel binding picker — the channel inspector loads the live channel
   directory (GET /channel-directory) and offers type + key suggestions
   (datalist) instead of blind free-text.
3. Per-agent native tools — agents can now restrict which plugin-contributed
   native tools they expose. The orchestrator filters its advertised native
   tools by an optional allow-list derived from agent-level native grants
   (kernel tools like memory/KG stay always-on); the agent inspector shows a
   checklist (all checked = no restriction). New PUT .../native-tools setter.
4. Plugin install is still managed centrally (signing/registry), but the agent
   inspector now deep-links to /admin/registries so it is not a dead-end.

Tests: cron timezone cases added. Typecheck/lint/i18n clean (middleware +
web-ui), 29/29 unit tests pass.
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.

1 participant