morph-warp-grep-v2.1). Use it to build a custom harness in any language. The API follows the OpenAI chat completions format with native tool calling. The model has its tools built in, so you do not pass a tools array. The model returns structured tool_calls, you execute them locally, and you send results back as tool messages. The tool schemas below are for reference so you know what to implement locally.
For a complete implementation, see the Python Guide or the Python agent example. For TypeScript SDK wrappers, see Agent Tool.
Message Flow
The agent runs a multi-turn conversation with max 6 turns using OpenAI-compatible tool calling:Initial User Message
The first user message contains two parts:- Repository structure — flat list of absolute paths (depth 2)
- Search query — what the agent needs to find
The repo structure must be flat absolute paths, one per line. First line is the repo root. No indentation, no tree characters. Directories have no trailing
/.API Call
The model has its tools built in — you do not need to pass atools array. Just send the messages and the model returns structured tool_calls.
Logged in? Your API key will auto-fill above. Otherwise, get it from your dashboard.
Agent Response Format
The model responds with a standard OpenAItool_calls array. No XML parsing needed.
The
content field is null on tool-call turns. Read only the tool_calls array. The finish_reason will be "tool_calls" when the model wants you to execute tools.tool messages:
Tool Definitions
The model calls these tools internally — you don’t need to pass them in the request. However, you need to implement each tool locally to execute the calls the model returns:Executing Tools
When the model returnstool_calls, execute each one locally and return the output as a tool message. Here’s a minimal Python implementation:
Turn Counter
After tool results, add auser message with a turn counter and context budget:
If the model does not call
finish within 6 turns, the search failed. Return an empty result to your caller.