make_claude_tools targets the anthropic Python package and returns (tool_specs, dispatch) for a manual tool_use loop. make_claude_agent_sdk_tools targets the higher-level claude-agent-sdk package and returns @tool-decorated async functions you pass directly to query(tools=...). Both factories expose the same CodebaseMemory and ImportGraph capabilities. A run_messages_agent_loop helper drives the Messages API tool-use loop end-to-end.
Unlike
make_langchain_tools and make_openai_tools, neither Claude factory exposes an enable_recall flag. recall_findings is always included whenever memory is set; only store_finding and impact_analysis are toggleable.- Anthropic Messages API
- Claude Agent SDK
make_claude_tools
(tool_specs, dispatch) — a list of JSONSchema tool-spec dicts and a callable that executes a named tool.Parameters
CodebaseMemory
required
The
CodebaseMemory instance the tools read from and write to. Required — unlike the LangChain factory, memory cannot be None.ImportGraph | None
default:"None"
Optional
ImportGraph. When provided and enable_impact=True, an impact_analysis spec is added.int
default:"5"
Maximum number of findings returned by
recall_findings.float
default:"0.25"
Minimum similarity score for recall results.
bool
default:"true"
Include the
store_finding spec.bool
default:"true"
Include the
impact_analysis spec when a graph is provided.Returns
list[dict]
A list of
{"name", "description", "input_schema"} dicts in the shape client.messages.create(tools=...) expects.Callable[[str, dict], str]
A callable
dispatch(tool_name, tool_input) -> str that executes the named tool and returns its string result. Raises KeyError for unknown tool names. Exceptions inside the handler are caught and returned as a (tool '<name>' raised: ...) error string rather than propagated.Manual tool-use loop
run_messages_agent_loop
run_messages_agent_loop runs the full Anthropic Messages tool-use loop, handling every tool_use / tool_result turn for you.Parameters
anthropic.Anthropic
required
A synchronous
anthropic.Anthropic client. The helper calls client.messages.create directly.str
required
The Anthropic model ID, e.g.
"claude-haiku-4-5-20251001" or "claude-sonnet-4-6".list[dict]
required
Initial message list in Anthropic format. The helper appends assistant and tool-result turns in place; pass a copy if you want to preserve the original.
list[dict]
required
The tool spec list returned by
make_claude_tools.Callable[[str, dict], str]
required
The dispatch callable returned by
make_claude_tools.str
default:"\"\""
Optional system prompt. Forwarded to
client.messages.create only when non-empty.int
default:"40"
Maximum number of
client.messages.create calls before the loop exits with stop_reason="max_steps".int
default:"4096"
max_tokens value forwarded to every client.messages.create call.Return value
str
Concatenated text from the last assistant turn that emitted text. Empty string when the loop exits via
max_steps with no text output.list[dict]
Full message history including assistant turns and tool-result turns appended during the loop.
str
Stop reason from the final API call, or
"max_steps" if the loop hit the step limit. Common values: "end_turn", "max_steps", "stop_sequence".list[tuple[str, dict, str]]
Every tool call as
(tool_name, tool_input, result) in execution order.
