Repository navigation
Conversation
Strix Security ReviewWarning This pull request has 23 commits after the last Strix review ( ✅ No open security findings. PR summary: This PR fixes Anthropic LLM config handling so a `tool_search` value supplied as a dict (as YAML/JSON agent configs produce) is coerced into `AnthropicToolSearchConfig` by the pydantic field instead of being silently discarded; only `True` (default variant) and `False`/`None` (disabled) remain special-cased. It also adds tests for dict coercion, `False` disabling, and failure on invalid dicts. Review summaryNo security issues found. The change narrows a pre-validator so only Review 1 on this PR · Reviewed by Strix |
7b044b0 to
1d9939b
Compare
|
Friendly ping for a review when you have a moment. All bot checks are green and the PR is mergeable; happy to adjust anything. |
1d9939b to
9a249c9
Compare
Related issue
Fixes #8734
Summary
The Anthropic pre-validator discarded any
tool_searchvalue that was notTrueor anAnthropicToolSearchConfiginstance — including plain dicts, which is exactly what YAML/JSON agent configs produce when thellm:block is passed throughLLM(**value). Result:tool_search: {type: regex}silently disabled tool search instead of coercing.This keeps special-casing only
True(default variant) andFalse/None(disabled) and lets the pydantic field (annotatedAnthropicToolSearchConfig | None) coerce and validate dict inputs, so invalid values now fail loudly instead of silently disabling.Verification
lib/crewai/tests/llms/anthropic/test_anthropic.py(105 passed): new tests cover dict coercion,tool_search=False→None, and loud failure on an invalid dict.ruff checkclean on changed files.Disclosure: this PR was produced with AI assistance (ZCode agent) and human-reviewed — please apply the
llm-generatedlabel.Additional context
None
From ZCode
Note
Low Risk
Narrow change to Anthropic LLM config normalization with regression tests; behavior improves YAML configs without touching auth or runtime tool execution paths.
Overview
Fixes Anthropic
tool_searchhandling when the value comes from YAML/JSON agent configs as a plain dict (e.g.{"type": "regex"}).The
_normalize_anthropic_fieldspre-validator no longer clears every non-True, non-config value toNone. It still mapstool_search=Trueto the defaultAnthropicToolSearchConfigandtool_search=FalsetoNone, but leaves dicts and existing config instances for the Pydantic field to coerce and validate. That restores server-side tool search for configured agents and makes badtypevalues fail at construction instead of silently turning search off.Tests cover dict coercion, explicit
False, and invalid dict validation.Reviewed by Cursor Bugbot for commit 9a249c9. Bugbot is set up for automated code reviews on this repo. Configure here.