Skip to content

refactor(sdk): harness profiles for provider/model config#2484

Merged
Mason Daugherty (mdrxy) merged 36 commits intomainfrom
mdrxy/sdk/rfc-profile
Apr 10, 2026
Merged

refactor(sdk): harness profiles for provider/model config#2484
Mason Daugherty (mdrxy) merged 36 commits intomainfrom
mdrxy/sdk/rfc-profile

Conversation

@mdrxy
Copy link
Copy Markdown
Member

@mdrxy Mason Daugherty (mdrxy) commented Apr 6, 2026

Calling refactor since this has no user-facing impact.

Consolidate provider-specific logic (hardcoded if model.startswith(...) branches, per-provider kwargs, prompt tweaks) into a declarative, internal-only HarnessProfile registry. No user-facing API changes.

Each provider or exact model spec can register a profile that customizes init kwargs, system prompts, tool descriptions, tool exclusions, and middleware — eliminating scattered conditionals. Subagents resolve their own profile from their model, so mixed-provider setups get correct behavior automatically.

Changes

  • Add private HarnessProfile dataclass and a registry with exact-spec -> provider-prefix -> empty-default lookup and merge semantics
    • (dict fields merge, callables chain, middleware deduplicates by type, excluded_tools unions)
  • Wire profiles into create_deep_agent: apply tool_description_overrides to user tools, FilesystemMiddleware, and SubAgentMiddleware; assemble system prompt from base_system_prompt + system_prompt_suffix; inject extra_middleware into all three middleware stacks (main, general-purpose subagent, per-subagent)
  • Add internal _ToolExclusionMiddleware that strips excluded_tools from request.tools before the model sees them — placed late in the stack so it catches both user-supplied and middleware-injected tools

@github-actions github-actions Bot added deepagents Related to the `deepagents` SDK / agent harness internal User is a member of the `langchain-ai` GitHub organization size: L 500-999 LOC labels Apr 6, 2026
@mdrxy Mason Daugherty (mdrxy) changed the title (WIP) profiles feat(sdk): (WIP) profile based adjustments Apr 7, 2026
@github-actions github-actions Bot added the feature New feature/enhancement or request for one label Apr 7, 2026
@github-actions github-actions Bot added the cli Related to `deepagents-cli` label Apr 7, 2026
@github-actions github-actions Bot added size: XL 1000+ LOC and removed size: L 500-999 LOC labels Apr 7, 2026
@mdrxy Mason Daugherty (mdrxy) changed the title feat(sdk): (WIP) profile based adjustments feat(sdk): (WIP) provider profile registry for model-specific config Apr 7, 2026
Comment thread libs/deepagents/deepagents/_profiles.py Outdated
@mdrxy Mason Daugherty (mdrxy) changed the title feat(sdk): (WIP) provider profile registry for model-specific config refactor(sdk): (WIP) harness profiles Apr 10, 2026
@github-actions github-actions Bot added refactor Code change that neither fixes a bug nor adds a feature and removed feature New feature/enhancement or request for one labels Apr 10, 2026
@mdrxy Mason Daugherty (mdrxy) changed the title refactor(sdk): (WIP) harness profiles refactor(sdk): harness profiles Apr 10, 2026
@mdrxy Mason Daugherty (mdrxy) changed the title refactor(sdk): harness profiles refactor(sdk): harness profiles for provider/model config Apr 10, 2026
@mdrxy Mason Daugherty (mdrxy) marked this pull request as ready for review April 10, 2026 18:38
@mdrxy Mason Daugherty (mdrxy) merged commit d6fa568 into main Apr 10, 2026
31 checks passed
@mdrxy Mason Daugherty (mdrxy) deleted the mdrxy/sdk/rfc-profile branch April 10, 2026 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli Related to `deepagents-cli` deepagents Related to the `deepagents` SDK / agent harness internal User is a member of the `langchain-ai` GitHub organization refactor Code change that neither fixes a bug nor adds a feature size: XL 1000+ LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants