feat: deepagents migration + plan/files side-panel#73
Open
nwadams wants to merge 2 commits into
Open
Conversation
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>
603dec9 to
5fb7e93
Compare
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
create_agentwithdeepagents.create_deep_agent; the inner agent gainswrite_todos+ a virtual filesystem, wrapped in the existing outerStateGraph(which keeps the conditionalchart_node).SkillsMiddleware(progressive disclosure).datahub-explorerwas dropped); DataHub tools remain directly available on the parent agent.Prompt guidance
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-requestInMemorySaver. Sincebuild_graphruns 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 thefilesDeltaChannel, which doesn't reliably propagate to the outer graph mid-step.streaming.py: emitTODOSfromwrite_todosandFILES_UPDATEsnapshots onwrite_file/edit_fileand at end-of-turn (with change-dedup).chat.py: newGET /conversations/{id}/files;FILES_UPDATEexcluded from DB persistence (panel re-fetches on reload),TODOSpersisted 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_UPDATEhandling in both live + reattach loops, restore on conversation load.todos/filesstate, new event types, last-todos restoration from history.Notes
Verification
ruffclean;tsc --noEmitclean; 244/245 unit tests pass (the 1 failure is pre-existing env leakage — a realANTHROPIC_API_KEYin the shell — unrelated to this change).aget_state(subgraphs=True)surfaces awrite_file'd virtual file through theStateGraph+InMemorySaver.