Migrate to deepagents' auto-added general-purpose subagent#265
Merged
Conversation
The live cascade hand-built the general-purpose `task` subagent as an explicit `subagents=[…]` spec, restating `interrupt_on` and the model/tools omissions. But deepagents already auto-adds a general-purpose subagent and derives its `interrupt_on` from the top-level `create_deep_agent(interrupt_on=…)` we pass — so the subagent inherits the write-gating, gateway-bound model, and sandboxed toolset without us declaring it. A delegated write still surfaces at the parent approval gate (the HITL invariant), now verified against the *auto-added* subagent. The only thing worth customizing is its prose: deepagents' default subagent prompt asks for a "complete answer", but a live voice turn wants a short, spoken-length summary. `subagents.py` now collapses to a harness profile (`GeneralPurposeSubagentProfile`) carrying just that prompt + description, registered under the gateway model's provider so the override survives a `--model` change. Drops the explicit subagent spec and the redundant per-subagent `interrupt_on`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LXmmmJ53yfuc3CKemRQi7x
…4th3 # Conflicts: # aai_cli/AGENTS.md
The origin/main merge added a two-line module-docstring note, nudging brain.py to 501 lines and failing the max-file-length gate in CI. Condense the _graph_kwargs docstring (no logic change) back to 500. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LXmmmJ53yfuc3CKemRQi7x
…4th3 # Conflicts: # aai_cli/AGENTS.md
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.
Summary
Refactor the general-purpose subagent from a manually-declared spec to leveraging deepagents' auto-added subagent, customized via a harness profile. This simplifies the code by removing explicit subagent declaration while maintaining all write-gating behavior and allowing prose customization for voice turns.
Key Changes
subagents.py: Replacedgeneral_purpose_subagent()function (which returned a subagent spec dict) withregister_gp_subagent_profile()that registers a harness profile to override the auto-added subagent's prompt and description. The subagent now inherits the gateway-bound model, sandboxed toolset, and top-levelinterrupt_onautomatically.brain.py:subagentskey from_graph_kwargs()— deepagents now auto-adds the general-purpose subagentregister_gp_subagent_profile()inbuild_graph()before creating the deep agentinterrupt_onso delegated writes still surface at the parent approval gatetest_agent_cascade_subagents.py: Rewrote tests to verify the new approach:test_register_gp_subagent_profile_overrides_prompt_and_description()— validates the harness profile registrationtest_build_graph_registers_the_gp_subagent_profile()— confirmsbuild_graph()calls the registrationtest_profile_override_lands_on_the_auto_added_subagent()— end-to-end verification that the profile reaches the auto-added subagenttest_graph_kwargs_on_gates_writes_without_declaring_a_subagent()— confirms no explicit subagent is declaredgeneral_purpose_subagent()function_delegating_graph()helper to remove the manual subagent spec, relying on auto-addition insteadImplementation Details
"openai"(not a fullprovider:modelidentifier) so the override applies regardless of which OpenAI model is selected via--modelcreate_deep_agent()callbuild_graph()call; the deepagents import stays lazy (off the startup path)interrupt_onhttps://claude.ai/code/session_01LXmmmJ53yfuc3CKemRQi7x