make_openai_tools wraps a CodebaseMemory instance and an optional ImportGraph in @function_tool-decorated callables for the openai-agents SDK. Pass the returned list directly to Agent(tools=[...]).
Installation
make_openai_tools
@function_tool-decorated callables (recall_findings, store_finding, impact_analysis) depending on which arguments and flags you provide.
Parameters
The
CodebaseMemory instance the tools read from and write to. When None, both recall_findings and store_finding are omitted regardless of the enable flags.Optional
ImportGraph. When provided and enable_impact=True, an impact_analysis tool is added.Maximum number of findings per
recall_findings call.Minimum similarity score for recall results.
Include
recall_findings. Has no effect when memory is None.Include
store_finding. Has no effect when memory is None.Include
impact_analysis when a graph is provided.Returns
A list of
@function_tool-decorated callables. Spread into the Agent tool list: tools=[*rb_tools, *your_tools].Tools
recall_findings(query)
Searches CodebaseMemory and returns the formatted recall string.
| Parameter | Type | Description |
|---|---|---|
query | str | Natural-language description of what you are looking for |
store_finding(content, file_path, finding_type)
Persists a finding. Returns "stored (id=<fid>)" on success or "store failed" on transport error.
| Parameter | Type | Default | Description |
|---|---|---|---|
content | str | — | The finding text (truncated to 8000 chars) |
file_path | str | "" | Repo-relative path (truncated to 512 chars) |
finding_type | str | "note" | Short tag (truncated to 64 chars) |
impact_analysis(file_path)
Calls ImportGraph.format_impact() and returns the rendered string.
| Parameter | Type | Description |
|---|---|---|
file_path | str | Repo-relative path, e.g. "pydantic/main.py" |
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
Telemetry: openai_hooks
make_openai_tools handles tool wiring only. Run telemetry — run_start, per-step events, and run_finish — is provided separately by rb.openai_hooks(), which returns a RunHooks adapter you pass to Runner.run(hooks=...).
For the full openai_hooks reference and lifecycle details, see the OpenAI Agents integration guide.
