Skip to content

Commit b1883f2

Browse files
authored
Merge pull request #78 from vstorm-co/issue/77
fix: Hardcoded web_search and web_fetch in _default_deep_agent_factory
2 parents 389ab9c + 71b2500 commit b1883f2

5 files changed

Lines changed: 48 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.3.14] - 2026-04-16
9+
10+
### Fixed
11+
12+
- **Subagents ignored parent `web_search`/`web_fetch` settings** — the default subagent factory in `create_deep_agent` hardcoded `web_search=True` and `web_fetch=True`, overriding the parent agent's configuration. On Bedrock and Vertex Anthropic models this produced a 400 error (`web_fetch_20250910` not accepted), because the beta web tools are not supported there. The factory now propagates the parent agent's `web_search` and `web_fetch` flags to spawned subagents. ([#77](https://github.com/vstorm-co/pydantic-deepagents/issues/77), reported by [@SvdR82](https://github.com/SvdR82))
13+
814
## [0.3.13] - 2026-04-13
915

1016
### Fixed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,8 @@ make all # lint + typecheck + test
516516
| **[pydantic-ai-subagents](https://github.com/vstorm-co/pydantic-ai-subagents)** | Declarative multi-agent orchestration with token tracking. | [![Stars](https://img.shields.io/github/stars/vstorm-co/pydantic-ai-subagents?style=flat&logo=github&color=yellow)](https://github.com/vstorm-co/pydantic-ai-subagents) |
517517
| **[pydantic-ai-summarization](https://github.com/vstorm-co/pydantic-ai-summarization)** | Smart context compression for long-running agents. | [![Stars](https://img.shields.io/github/stars/vstorm-co/pydantic-ai-summarization?style=flat&logo=github&color=yellow)](https://github.com/vstorm-co/pydantic-ai-summarization) |
518518
| **[pydantic-ai-backend](https://github.com/vstorm-co/pydantic-ai-backend)** | Sandboxed execution for AI agents. Docker + Daytona. | [![Stars](https://img.shields.io/github/stars/vstorm-co/pydantic-ai-backend?style=flat&logo=github&color=yellow)](https://github.com/vstorm-co/pydantic-ai-backend) |
519+
| **[content-skills](https://github.com/vstorm-co/content-skills)** | Claude Code content studio — blog, social, slides, video, infographics — all brand-aware. | [![Stars](https://img.shields.io/github/stars/vstorm-co/content-skills?style=flat&logo=github&color=yellow)](https://github.com/vstorm-co/content-skills) |
520+
| **[production-stack-skills](https://github.com/vstorm-co/production-stack-skills)** | Claude Code skills for production-grade FastAPI, PostgreSQL, Docker, and observability. | [![Stars](https://img.shields.io/github/stars/vstorm-co/production-stack-skills?style=flat&logo=github&color=yellow)](https://github.com/vstorm-co/production-stack-skills) |
519521

520522
> **Want the full stack?** Use [full-stack-ai-agent-template](https://github.com/vstorm-co/full-stack-ai-agent-template) — it ships pydantic-deep integrated with FastAPI, Next.js, auth, WebSocket streaming, and RAG out of the box.
521523

pydantic_deep/agent.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -559,17 +559,19 @@ def _set_toolset_retries(toolset: AbstractToolset[DeepAgentDeps], max_retries: i
559559
_sub_context_discovery = context_discovery
560560
_sub_memory = include_memory
561561
_sub_memory_dir = memory_dir
562+
_sub_web_search = web_search
563+
_sub_web_fetch = web_fetch
562564

563-
def _default_deep_agent_factory(cfg: dict[str, Any]) -> Any: # pragma: no cover
565+
def _default_deep_agent_factory(cfg: dict[str, Any]) -> Any:
564566
"""Create a deep agent for subagent execution."""
565567
return create_deep_agent(
566568
model=cfg.get("model", _sub_model),
567569
instructions=cfg["instructions"],
568570
include_filesystem=True,
569571
include_execute=True,
570572
include_todo=True,
571-
web_search=True,
572-
web_fetch=True,
573+
web_search=_sub_web_search,
574+
web_fetch=_sub_web_fetch,
573575
thinking=False, # Save tokens on subagents
574576
include_subagents=False,
575577
include_skills=False,

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "pydantic-deep"
3-
version = "0.3.13"
3+
version = "0.3.14"
44
description = "Batteries-included agent harness for Python — tool-calling, sandboxed execution, multi-agent teams, and unlimited context on Pydantic AI"
55
readme = "README.md"
66
keywords = [

tests/test_agent.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,40 @@ def test_create_with_subagent_configs(self):
6565
agent = create_deep_agent(model=TEST_MODEL, subagents=subagents)
6666
assert agent is not None
6767

68+
def test_default_subagent_factory_propagates_web_flags(self):
69+
"""Regression for #77: default subagent factory must inherit parent's
70+
``web_search`` and ``web_fetch`` flags. Otherwise Bedrock/Vertex
71+
Anthropic models error out on unsupported beta tools.
72+
"""
73+
from pydantic_ai.capabilities import WebFetch, WebSearch
74+
75+
def _sub_caps(parent_web_search: bool, parent_web_fetch: bool) -> list[type]:
76+
subagents: list[SubAgentConfig] = [
77+
SubAgentConfig(
78+
name="researcher",
79+
description="A research agent",
80+
instructions="You research topics",
81+
),
82+
]
83+
create_deep_agent(
84+
model=TEST_MODEL,
85+
subagents=subagents,
86+
web_search=parent_web_search,
87+
web_fetch=parent_web_fetch,
88+
)
89+
factory = subagents[0]["agent_factory"]
90+
assert factory is not None
91+
sub_agent = factory({"instructions": "sub instructions", "model": TEST_MODEL})
92+
return [type(c) for c in sub_agent._root_capability.capabilities]
93+
94+
off_types = _sub_caps(parent_web_search=False, parent_web_fetch=False)
95+
assert WebSearch not in off_types
96+
assert WebFetch not in off_types
97+
98+
on_types = _sub_caps(parent_web_search=True, parent_web_fetch=True)
99+
assert WebSearch in on_types
100+
assert WebFetch in on_types
101+
68102
def test_create_with_interrupt_on(self):
69103
"""Test creating an agent with interrupt_on config."""
70104
agent = create_deep_agent(

0 commit comments

Comments
 (0)