Skip to main content
A test made from a production trace runs your agent for real, but its tools must not reach production. The wrappers send each tool call to Ancha during a test, and call your function as before everywhere else.

Outside a test

A wrapper checks for ANCHA_TOOLS_URL. Without it, the wrapped tool is your function: the same arguments, the same result, no network call. Nothing changes in production.

In a test

ancha run sets ANCHA_TOOLS_URL and ANCHA_TOOLS_TOKEN for your agent. Each call goes to Ancha, which answers it: Arguments compare by value, whatever order your agent writes their keys in. Results come back in your function’s types: Python restores a pydantic return type.

TypeScript

wrapTools takes an object or an array of functions and tool objects with execute. Pass { names: { lookupOrder: 'lookup_order' } } when the trace knows a tool by another name.

Python

@ancha.tool works on sync and async functions. Parameters the model never sees, such as a framework’s context, are left out of the arguments. Wrap at module level, so the wrappers exist before ancha.entry runs.

entry

entry is the command ancha.yaml runs in a test. It tells Ancha which tools your agent wraps, hands your function the input production’s run started with, and returns your function’s answer to Ancha, which checks it. If the trace holds a tool your agent neither wraps nor reaches over MCP, the test stops at entry, before your agent runs, and says which tool. The attempt is invalid, never a pass or a fail. An agent without entry is checked at its first tool call. To run a test anyway with a tool that may call its real backend, a sandbox for example, pass ancha run --allow-unwrapped <tool>. ancha doctor checks the wiring before you run.

Tools over MCP

An agent that reaches some tools over MCP needs no wrapper for them. Answer tools.mcp with their names when you import the trace, and point the MCP client at the test’s tool server in ancha.yaml:
ancha.yaml
The server lists the tools with the descriptions and schemas from the trace, and returns production’s own MCP results.