Open Agent Loops
API Reference

editTool

@open-agent-loops/core


function editTool(backend): Tool;

Defined in: tools/builtin/file-write.ts:78

Build an edit tool bound to a backend.

Parameters

ParameterTypeDescription
backendFileWriteBackendThe FileWriteBackend that actually edits the host.

Returns

Tool

A Tool named edit ready to pass to the agent loop or a ToolRegistry.

Remarks

Runs sequentially (ExecutionMode.Sequential): like write, edits mutate the host and ordering matters. Results are shaped by formatEditResult, which surfaces a missing target string in the content (model-recoverable) rather than as a thrown error.

See

Example

const tool = editTool(myFileWriteBackend);
await runAgent({ ...opts, tools: [tool] });
// The model can now call: edit({ path: "app.ts", oldString: "v1", newString: "v2" })

On this page