Skip to main content
make_langchain_tools wires a CodebaseMemory instance and an optional ImportGraph to a list of LangChain @tool-decorated callables. Pass the returned list directly into create_agent(tools=...) alongside your own tools. The factory shares the memory and graph objects you provide, so a finding stored in one step is available to the next recall in the same run.

Installation

The LangChain integration requires langchain-core:

make_langchain_tools

Returns a list of LangChain @tool callables. The list contains up to three tools (recall_findings, store_finding, impact_analysis) depending on which arguments and flags you provide.

Parameters

CodebaseMemory | None
default:"None"
The CodebaseMemory instance the tools read from and write to. When None, both recall_findings and store_finding are omitted from the returned list regardless of enable_recall and enable_store.
ImportGraph | None
default:"None"
Optional ImportGraph for the repository. When provided and enable_impact=True, an impact_analysis tool is added.
int
default:"5"
Maximum number of findings returned by a single recall_findings call.
float
default:"0.25"
Minimum similarity score (0–1) a finding must reach to be included in recall results.
bool
default:"true"
Include the recall_findings tool. Set to False to produce a write-only or impact-only tool set. Has no effect when memory is None.
bool
default:"true"
Include the store_finding tool. Set to False for read-only scenarios. Has no effect when memory is None.
bool
default:"true"
Include the impact_analysis tool when a graph is provided.

Returns

list
A list of LangChain @tool-decorated callables. Concatenate with your own tool list and pass to create_agent.

Tools

recall_findings(query)

Searches CodebaseMemory for findings relevant to query. The tool returns the same string that CodebaseMemory.format_recall() produces.

store_finding(content, file_path, finding_type)

Persists a finding to CodebaseMemory. Returns "stored (id=<fid>)" on success or "store failed" on transport error.

impact_analysis(file_path)

Calls ImportGraph.format_impact() and returns the rendered string of dependents and dependencies.
impact_analysis is only present when you pass a non-None graph and enable_impact=True. Check len(rb_tools) rather than assuming a fixed index if you build the list conditionally.

Complete example

Build the tool list once per agent run, not once per process. The closure over memory and graph is fine to share across calls inside the same run, but each run typically wants its own CodebaseMemory instance scoped to the right codebase_id.