Skip to content

feat: deepagents migration + plan/files side-panel#73

Open
nwadams wants to merge 2 commits into
mainfrom
na--deepagents-core
Open

feat: deepagents migration + plan/files side-panel#73
nwadams wants to merge 2 commits into
mainfrom
na--deepagents-core

Conversation

@nwadams

@nwadams nwadams commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Migrates the agent to deepagents and adds a UI panel surfacing the agent's plan (todos) and virtual filesystem. Scoped to the core deepagents setup — HITL approvals, the configurable sub-agent registry, and the tier2/tier3 sandbox work are intentionally left out.

What's included

Full switch to deepagents

  • Replace create_agent with deepagents.create_deep_agent; the inner agent gains write_todos + a virtual filesystem, wrapped in the existing outer StateGraph (which keeps the conditional chart_node).
  • Skills routed through SkillsMiddleware (progressive disclosure).
  • deepagents bumped to 0.6.8.
  • Runs with no sub-agents (the hardcoded datahub-explorer was dropped); DataHub tools remain directly available on the parent agent.

Prompt guidance

  • Teaches the agent about the per-turn scratch filesystem (ls/read_file/write_file/edit_file/glob/grep), the ~20K-token auto-eviction threshold (large tool results offloaded to /large_tool_results/<id>), and the grep-before-read pattern.

Plan & Files side-panel (hand-slimmed, HITL/subagent-free)

Backend

  • graph.py: compile with a per-request InMemorySaver. Since build_graph runs fresh per request, the checkpointer is per-turn — no cross-turn state leak (history still replayed from the DB), but it lets the streaming layer snapshot the files DeltaChannel, which doesn't reliably propagate to the outer graph mid-step.
  • streaming.py: emit TODOS from write_todos and FILES_UPDATE snapshots on write_file/edit_file and at end-of-turn (with change-dedup).
  • chat.py: new GET /conversations/{id}/files; FILES_UPDATE excluded from DB persistence (panel re-fetches on reload), TODOS persisted for history.

Frontend

  • DeepAgentsPanel.tsx: Plan tab (todo checklist) + Files tab (virtual-FS browser).
  • ChatView.tsx: header toggle with a done/total badge, TODOS/FILES_UPDATE handling in both live + reattach loops, restore on conversation load.
  • store/types/buildUiMessages: todos/files state, new event types, last-todos restoration from history.

Notes

  • Filesystem is per-turn here (consistent with the prompt's "lives for the duration of the turn"); the original migration branch accumulated files across turns via a durable HITL checkpointer — that is intentionally not carried over.

Verification

  • Backend imports + ruff clean; tsc --noEmit clean; 244/245 unit tests pass (the 1 failure is pre-existing env leakage — a real ANTHROPIC_API_KEY in the shell — unrelated to this change).
  • End-to-end test confirmed aget_state(subgraphs=True) surfaces a write_file'd virtual file through the StateGraph + InMemorySaver.
Screenshot 2026-06-04 at 4 11 32 PM

Switches the agent from langchain `create_agent` to
`deepagents.create_deep_agent`, giving the agent a `write_todos` planning
tool and a per-turn virtual filesystem, and surfaces both in the UI.

Backend
- graph.py: build the inner agent with `create_deep_agent` (no sub-agents),
  wrapped in the existing outer StateGraph that keeps the conditional
  chart_node. Compile with a per-request InMemorySaver so the streaming layer
  can snapshot the `files` DeltaChannel via aget_state(subgraphs=True); the
  saver is fresh per request, so no state leaks across turns and history is
  still replayed from the DB. Skill handling matches main: the
  _SKILL_TOOL_NAMES/_MUTATION_TOOL_NAMES constants and explicit system-prompt
  section injection (gated by enabled_mutations) are preserved.
- streaming.py: emit a TODOS event from write_todos and FILES_UPDATE snapshots
  on write_file/edit_file and at end-of-turn (catches auto-evicted
  /large_tool_results files). write_todos no longer renders as a tool bubble.
- chat.py: add GET /conversations/{id}/files reading the in-memory snapshot;
  skip persisting FILES_UPDATE (large/redundant — the panel re-fetches on
  reload), while TODOS is persisted for history.

Prompt
- Tell the agent to call write_todos to plan any non-trivial (>1-2 tool call)
  question, and document the working filesystem + auto-eviction threshold.

Frontend
- DeepAgentsPanel: Plan tab (todo checklist) + Files tab (virtual-FS browser).
- ChatView: header toggle, handle TODOS/FILES_UPDATE in the live and reattach
  stream loops, restore todos + files on conversation load.
- store/types/buildUiMessages: todos/files state, the new event types, and
  last-todos restoration from history.

Deps
- deepagents 0.6.8 (with matching langchain 1.3.4 / langgraph 1.2.4).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@nwadams nwadams force-pushed the na--deepagents-core branch from 603dec9 to 5fb7e93 Compare June 4, 2026 23:03
@nwadams nwadams requested review from askumar27 and shirshanka June 4, 2026 23:11
Stop unconditionally injecting search-business-context and improve-context
SKILL.md bodies into the system prompt on every request — that was ~180
lines of markdown burned per turn even when the agent never used those
skills. Mutation skill bodies were similarly inlined when enabled.

Now: SkillsMiddleware presents skill name + description always (cheap),
and the agent loads bodies on demand via a `Skill` tool. Skills moved
under skills/library/<name>/SKILL.md so the source dir contains only
SKILL.md directories. Frontmatter `name:` aligned to spec (must match
parent directory).

Tool wrappers for the three Python-impl skills (search_business_context,
publish_analysis, save_correction) keep their snake_case identifiers and
are still gated by enabled_mutations for the latter two.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
(cherry picked from commit 593676c)
@nwadams nwadams marked this pull request as ready for review June 4, 2026 23:18
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