feat: add agent_profiles support for delegate_task (closes #9459)#32630
Closed
davidgut1982 wants to merge 3 commits into
Closed
feat: add agent_profiles support for delegate_task (closes #9459)#32630davidgut1982 wants to merge 3 commits into
davidgut1982 wants to merge 3 commits into
Conversation
…egate_task Implements NousResearch#9459. Allows named agent profiles in config.yaml with per-profile model, toolsets, max_iterations, and system_prompt overrides. The profile= parameter in delegate_task() selects a profile as the baseline for a child agent; explicit call parameters override profile values. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ride Pyright flags direct attribute assignment on AIAgent for undeclared attrs. Replace `child.ephemeral_system_prompt = _profile_prompt` with setattr() to match the read-side pattern (getattr) already used at line 1265 and suppress the one new type error introduced by the agent_profiles feature. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…opy; type validation Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Collaborator
23 tasks
Contributor
Author
|
Closing in favor of #18522 which is a superset of this implementation. See comment there for details. |
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
Implements named agent profile presets for
delegate_task(), resolving Issue #9459.Profiles are defined in
config.yamlunderagent_profiles:and can be referenced per-delegation or per-task. Each profile supports:model— override the child agent modeltoolsets— restrict the child agent's available tools (MCP scoping)max_iterations— cap the child agent's turn depthsystem_prompt/system_prompt_file— replace the child's default prompt (leaf workers)Usage
Implementation Notes
_load_profiles()reads fromload_config()— no new config file, just a new root key_resolve_profile()handlessystem_prompt_fileexpansion,max_iterationsint coercion, and deep-copies the profile dict to prevent mutationmax_iterationsis applied at both top-level and per-task call sites (top-level was a dead assignment in the naive implementation — fixed)system_promptin a profile replaces the entire child prompt (including orchestrator delegation instructions); documented in schema with WARNING; intended for leaf workers onlysetattr(child, "ephemeral_system_prompt", ...)used consistently with the existing pattern at line ~1265Tests
152 tests passing (147 original + 5 regression tests for the Code Critic findings).
New test class:
TestAgentProfileswith 17 tests covering:Checklist
All checks passed!Closes #9459
Packaging Note
During production testing on 0.14.0 (installed via PyPI),
hermes_cli/secret_prompt.pywas found to be absent from the installed package. This caused anImportErrorwhen thetools → configimport chain was triggered after deploying the modifiedconfig.py. The file exists in the repository but was not included in the PyPI distribution.If a related issue exists, this PR's testing surfaced the same root cause. If not, it may be worth filing separately against the 0.14.0 release packaging.