Skip to main content
If your agent already runs on your own server, you can connect it to Calibrate. Calibrate then sends it messages to run tests, model comparisons and simulations. You do not rebuild the agent in Calibrate. This page connects a copy of the Maths homework tutor that runs at https://example.org/tutor/chat.
No agent of your own yet? See Build an agent in Calibrate.

How the connection works

Calibrate needs one web address on your server that follows these rules:
  • Request: Calibrate sends a POST request with the conversation so far as a messages list, in the OpenAI chat message format.
  • Response: your agent sends back JSON with its reply as a response text, its tool calls as a tool_calls list, or both.

Request format

Calibrate sends a POST request to your agent’s URL. The body holds the whole conversation, oldest message first:
The body can also hold a model field. Calibrate adds it only when you turn on benchmarking across models, so your agent knows which model to use for that request. If your agent cannot switch models, ignore it. Any Custom fields you add on the Connection tab are also sent in the body on every request, next to messages.

Request format for a Basic agent

If you chose Basic when you created the agent, Calibrate sends only the student’s latest message, as an input field:
A Basic agent can only run tests that have a single student message. Pick Conversation for tests with several turns and for simulations.

Response format

Your agent returns a response field with its text reply:
If your agent also calls tools, add a tool_calls list. Each item has a tool name and an arguments object:
Each tool call can also have an output field. This is what the tool gave back when your agent ran it, and it can be any JSON value. Calibrate shows it next to the tool call in the test results. It does not change whether a test passes or fails:
Your agent’s reply must include a response field, a tool_calls field, or both.

Report cost, speed and tokens

Your agent can also send a metrics object with each reply. Calibrate then shows the cost, speed and tokens for each test, and uses them when you compare models.
Every field in metrics is optional, and so is the whole object. For tokens, send total_tokens, or send prompt_tokens and completion_tokens and Calibrate adds them up. latency_ms is how long your agent took to reply. Calibrate shows latency only when you send it.

Add a route for Calibrate

Most agents already call a model somewhere inside their own code. Move that model call into its own function. Then add a route that Calibrate calls, which uses the same function. Before: the model call sits inside your request handler.
After: the model call is its own function, and a short Calibrate route uses it.
You give Calibrate the URL of the POST /calibrate/test route in the next steps.

Create the agent

  1. From the sidebar, click Agents → New agent.
  2. Under Agent name, type a name.
  3. Under Setup, select Connect your existing agent.
The New agent dialog with Connect your existing agent selected
  1. Click Next.
  2. Select Conversation, then click Create.

Fill in the connection details

On the agent page, click the Connection tab.
The Connection tab of the Maths homework tutor (connected), with its URL filled in and the connection check showing Verified
  1. Agent URL (required): the web address of your agent’s route, for example https://example.org/tutor/chat. Calibrate sends a POST request here.
  2. Headers (optional): headers your agent needs, such as a key it checks before it answers. Click Add header for each one.
  3. Custom fields (optional): extra fields Calibrate sends with every request. Click Add field for each one.
  4. Support benchmarking different models (optional): turn this on if your agent can switch models. See Enable benchmarking across models.
The Expected request & response format panel on the right shows the request Calibrate sends and the reply your agent must return. Click See an example for a full example. Click Save at the top right.

Verify your connection

Calibrate checks that it can reach your agent and that the reply has the right format. You must do this before you run tests or text simulations.
  1. In the Connection check panel, click Verify.
  2. A dialog opens. Under Messages, edit the sample conversation Calibrate sends. The Request body preview shows the exact JSON.
The Verify connection dialog, with one user message on the left and the request body preview on the right
  1. Click Send & Verify.
If it works, the panel shows Verified and the date. If it fails, the panel shows Failed, the error, and what your agent sent back, so you can fix it and try again. If you change your agent later, click Re-verify to check it again.

Enable benchmarking across models

Calibrate can run the same tests on several models so you can compare them. For a connected agent, your agent must read a model field from the request and use that model.
Calibrate sends the model field, but your agent decides which model it actually uses. If your agent ignores the field, every model in the comparison runs the same model.
  1. On the Connection tab, turn on Support benchmarking different models.
  2. Under Model provider, pick the provider your agent uses to call models.
Calibrate then adds a model field to each request:
The format of model depends on the provider you pick. For OpenRouter it includes the company name, such as openai/gpt-4.1. For OpenAI it is only the model name, such as gpt-4.1. When you click Start the comparison in the Compare models dialog, Calibrate first checks the connection for each model you picked that it has not checked before. The comparison starts once those checks pass.

Next steps

Evaluate your agent with unit tests

Write tests for your connected agent

Compare models on your tests

See which model does best on your tests

Run a text or voice simulation

Have simulated students talk to your agent. Connected agents run text simulations only.