使用动态过滤的代理程序运行(代码执行中的 web_search_20260209)被拒绝,原因是"code_execution 工具使用 ... 但没有对应的 code_execution_tool_result 块"
作者: neel004创建于 2026年9月28日更新于 2026年9月28日
标签bugcorelangchainanthropicexternal
from future import annotations import os from collections.abc import Sequence from dotenv import load_dotenv from langchain_core.messages import AIMessage, BaseMessage, HumanMessage from langchain_anthropic import ChatAnthropic from LangChain.agents import create_agent load_dotenv()
Official upgrade / Cloud Exchange documentation root (search is constrained to this host).
ALLOWED_DOMAIN = "" # some domain for web-search to traverse
Built-in Anthropic web search tool (passed through to the API unchanged by ChatAnthropic).
See: https://docs.Anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool
WEB_SEARCH_TOOL: dict = { "type": "web_search_20260209", "name": "web_search", "max_uses": 5, "allowed_domains": [ALLOWED_DOMAIN], } SYSTEM_PROMPT = """""" # system prompt for the agent to when to go and hit the web search.
内容来源: langchain-ai/langchain