All articles

Developers

Let your agents run the dojo: training AI over MCP and REST

Training an agent is mostly orchestration, which is exactly what agents are good at. How Kojen exposes its whole training loop through an MCP server, a REST API and the Kojen Agent.

By Will Schulz6 min read
A ring of glass figures linked by red threads of light to a glowing central orb

Training an agent is mostly orchestration: create the project, import the data, start a run, wait, read the score, try something else, evaluate, deploy. It's the kind of multi-step, tool-heavy work that agents are now good at. So we made sure an agent can do all of it in Kojen.

One tool layer, four front doors

Everything you can do in the Kojen web app, from projects and datasets to Forge runs, evaluations, simulations, deployments, agents, katas and Sensei, is also exposed through the same set of tools in three other places:

  • An MCP server at https://kojen.ai/api/mcp, using streamable HTTP.
  • A REST API at https://kojen.ai/api/v1, with an OpenAPI spec at /api/v1/openapi.json.
  • The Kojen Agent, a chat assistant in the app (and at POST /api/v1/agent) that chains those tools for you.

Because it's one tool layer, there's no “API version” that lags the UI. A tool that works in one place works in all of them.

Why MCP

Anthropic introduced the Model Context Protocol in November 2024 as an open standard for connecting AI systems to data sources and tools, replacing a custom integration for every source with a single protocol.[1] The specification defines two standard transports: stdio for local servers, and streamable HTTP for remote ones like Kojen's.[2] That means any MCP-capable client (Claude Code, Claude Desktop, IDE assistants, your own agent) can pick up Kojen's tools with one line of config:

claude mcp add --transport http kojen https://kojen.ai/api/mcp \
  --header "Authorization: Bearer kojen_…"

For anything that isn't an MCP client, the REST API covers the same ground, described in a standard OpenAPI document[3] so code generators and agent frameworks can read it directly. We also publish a /llms.txt, following the llms.txt proposal, so models browsing the site get a concise map of what's where.[4]

Tools designed for agents, not just wrapped endpoints

Anthropic's engineering guidance on writing tools for agents argues that good agent tools aren't a thin skin over an API. They should return meaningful context, be economical with tokens, and come with clearly written descriptions, and you should evaluate how well agents actually use them.[5] We took that seriously:

  • Task-shaped tools. train_model, evaluate_model and deploy_model each do the whole job in one call, instead of making the agent assemble five low-level requests.
  • A way to wait. Training and evaluation take seconds to minutes, so wait_for_run lets an agent block on a run instead of polling in a loop.
  • Self-description. describe_resources and list_models tell an agent what exists and which model keys are valid, so it doesn't guess.
  • Honest labels. Tool descriptions say plainly that prompt tuning and model search run for real, and that LoRA, full fine-tuning and RLHF for text models are previews with simulated metrics, so an agent won't report a fake win as a real one.

What a session looks like

With Kojen connected, a single request to a coding agent can cover the whole loop:

> Create a Kojen project for routing support tickets to billing, bug or how-to.
  Import the 40 labelled tickets in tickets.csv as its test set, run model search,
  then prompt-tune the winner. Evaluate the result, red-team it, and if the trust
  score is above 85, deploy it to staging and give me the endpoint.
  1. create_project, then create_dataset from the CSV rows.
  2. train_model with model search, then wait_for_run.
  3. train_model again with prompt tuning on the winning base model.
  4. evaluate_model (comprehensive) and run_simulation (adversarial).
  5. If the gate passes, deploy_model, and the agent reports back the OpenAI-compatible endpoint URL.

Every step is a real record in your dojo. Open the web app afterwards and you'll find the project, runs, versions, scores and deployment exactly as if you'd clicked through it yourself.

Same permissions, no back doors

Letting an agent act for you only works if the boundaries are clear:

  • API keys are created in Settings → API Keys & MCP, shown once and stored only as a hash. You can set an expiry and revoke them at any time.
  • Everything runs as the key's owner, with the same row-level permissions as the web app. An agent can't see or touch anything you couldn't.
  • The Kojen Agent asks before deleting anything.

Get started

The developer docs list every tool and REST endpoint, with copy-paste examples for curl, Claude Code and any MCP client. Create a key, connect your agent, and point it at a task.

Go deeper in the Academy

Free lessons with quizzes, citations and a hands-on exercise.

Sources

  1. [1]Introducing the Model Context Protocol. Anthropic (2024).
  2. [2]Model Context Protocol specification: Transports. modelcontextprotocol.io.
  3. [3]OpenAPI Specification. OpenAPI Initiative.
  4. [4]The /llms.txt file. llmstxt.org.
  5. [5]Writing effective tools for agents — with agents. Anthropic Engineering (2025).

Put it into practice.

Kojen gives you the Forge, LLM-judged evaluations, red-team simulations and live endpoints in one place. Free to start, no card needed, then pay as you go.

Start training free

More reading

All articles →