Graphorin API reference v0.4.0
Graphorin API reference / @graphorin/tools / code-mode
code-mode
Code-mode / programmatic tool calling (P1-2). Public surface:
- projectToolApi — project a resolved tool set as a typed code API (catalogue + per-tool signatures).
- createCodeExecuteTool / createCodeSearchTool — the two Graphorin-named meta-tools the agent advertises in code-mode.
The sandbox primitive these build on, runBridgedSource, lives in @graphorin/security/sandbox (sandbox isolation is a security concern); this module supplies the tool bridge + the model-facing projection. The agent runtime wires them behind the opt-in toolInvocation: 'code-mode' config.
Interfaces
| Interface | Description |
|---|---|
| CodeApiProjection | The projected code API for a set of tools. |
| CodeExecuteLimits | Tunable sandbox limits for createCodeExecuteTool. |
| CodeExecuteToolOptions | Configuration for createCodeExecuteTool. |
| CodeSearchMatch | A tool-search match code_search can fold in (deferred pool). |
| CodeSearchToolOptions | Configuration for createCodeSearchTool. |
| ProjectableTool | Structural view of a tool this module can project. |
Type Aliases
| Type Alias | Description |
|---|---|
| CodeExecuteBridge | Host bridge: run one bridged tool call and return its output. Receives the code_execute call's own ToolExecutionContext, so the agent can route the inner call through the real executor under the same runContext (same run / step / tracer / secrets scope). |
Functions
| Function | Description |
|---|---|
| createCodeExecuteTool | Build the code_execute meta-tool. Its output is the script's final value rendered as a string, so the executor's maxResultTokens / 'spill-to-file' pipeline bounds even a large final result (WI-10). |
| createCodeSearchTool | Build the code_search meta-tool. Returns matching tools.<name>(…) signatures as text (eager substring match + the deferred pool). |
| projectToolApi | Project a set of resolved tools as a typed code API. See the module docstring. |