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
The
CodebaseMemory instance the tools read from and write to. Required — unlike the LangChain factory, memory cannot be None.Optional
ImportGraph. When provided and enable_impact=True, an impact_analysis spec is added.Maximum number of findings returned by
recall_findings.Minimum similarity score for recall results.
Include the
store_finding spec.Include the
impact_analysis spec when a graph is provided.Returns
A list of
{"name", "description", "input_schema"} dicts in the shape client.messages.create(tools=...) expects.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
A synchronous
anthropic.Anthropic client. The helper calls client.messages.create directly.The Anthropic model ID, e.g.
"claude-haiku-4-5-20251001" or "claude-sonnet-4-6".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.
The tool spec list returned by
make_claude_tools.The dispatch callable returned by
make_claude_tools.Optional system prompt. Forwarded to
client.messages.create only when non-empty.Maximum number of
client.messages.create calls before the loop exits with stop_reason="max_steps".max_tokens value forwarded to every client.messages.create call.Return value
Concatenated text from the last assistant turn that emitted text. Empty string when the loop exits via
max_steps with no text output.Full message history including assistant turns and tool-result turns appended during the loop.
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".Every tool call as
(tool_name, tool_input, result) in execution order.Example
Tools available in both factories
| Tool | Always included? | Description |
|---|---|---|
recall_findings(query) | Yes (when memory is set) | Search CodebaseMemory for findings matching a query |
store_finding(content, file_path, finding_type) | When enable_store=True | Persist a finding |
impact_analysis(file_path) | When graph is set and enable_impact=True | Return dependents and dependencies |

