Open Agent Loops
API Reference

ToolResult

@open-agent-loops/core


Defined in: tools/tools.types.ts:55

What a tool hands back to the loop.

Remarks

There is deliberately no error field here. A tool signals a hard error by throwing from execute, not by returning — the loop catches the throw and produces a tool result with isError: true and the error's message as content (see Tool.execute). Returning a normal result is for success and for soft outcomes the model should read but not treat as a failure (e.g. a non-zero shell exit, an "already up to date" note).

Abstraction over — nothing on the wire; this is a purely in-process handoff. The loop folds content into a ToolMessage (that message is the wire shape — { role: "tool", tool_call_id, content }), reads terminate for its own stop logic, and never sends details to the model. OpenAI has no ToolResult counterpart.

Example

A handler's return value (in-process only — never serialized as-is)

{ "content": "72°F and sunny", "terminate": false }

Properties

PropertyTypeDescriptionDefined in
contentstringText content folded back into the conversation as the tool result.tools/tools.types.ts:57
details?unknownOptional structured payload (not sent to the model, useful for hooks).tools/tools.types.ts:59
terminate?booleanWhen true, the loop stops after this tool result (a "final answer" tool).tools/tools.types.ts:61

On this page