Prerequisites
- A running instance of Coral Server
- An existing agent you want to onboard to Coral
Modifying your agent
Start with the Koog template when writing a new agent. It is also the reference when porting to another framework. Agent code is the place to control context management, memory, and execution flow. The prototype runtime is a smaller option for cases known to need only a simple LLM/tool loop. Agents interact with Coral sessions exclusively through a uniquely provided MCP server. All interaction with other agents is then done with the tools available through that MCP.Connect to Coral
Since each agent in a session is given its own MCP - your agent must receive the MCP’s connection url dynamically. When running the agent through Coral Server’s orchestrator, that is provided by theCORAL_CONNECTION_URL environment variable.
Here are some example snippets for popular Python frameworks:
The server provides a per-agent MCP connection URL via
CORAL_CONNECTION_URL. It may point to the Streamable HTTP endpoint (/mcp/v1/{agentSecret}/mcp) or the SSE endpoint (/mcp/v1/{agentSecret}/sse/). For SSE, a trailing slash is required. Do not hardcode this URL — always use the exact value provided.Agent Configuration
Agents have a lot of options that users would want to change. API keys, models, providers, and even sampling parameters (temperature, top_p) - are all things we want to accept dynamically. Coral’s orchestrator provides an ‘option’ system, that allows you - the agent developer - to expose specific typed options, and receive the values of those options as environment variables.This means you should not load
.env files by default, since environment
variables should only be provided by Coral Server. Packaging your agent
Now that your agent works with Coral, to make it work with orchestration - you need to package your agent. In the root of your agent repository/folder, create acoral-agent.toml file. Add its directory to registry.localAgents in the server’s config.toml, or use coralizer link .. There is no separate registry.toml.
An agent definition starts with basic metadata:
Agent Options
Coral’s orchestrator allows you to expose specific typed options, to be passed to your agent on instantiation as environment variables.options are a map of option names, to user configurable options you want to expose.
Each option has:
string
required
The type of the option (e.g.,
string, i32, f64, bool, list[string], etc.).string
A description of what this option configures in your agent.
any
The default value of this option if not provided. The type must match the specified
type.boolean
Whether this option is required.
false by default.boolean
If
true, the value is masked in configuration displays and server-generated option log entries. Agent stdout/stderr is not automatically redacted; the agent must avoid logging secrets.Example coral-agent.toml snippet
Example coral-agent.toml snippet
Agent Runtimes
Coral Server supportsdocker, executable (local subprocess), and prototype (a built-in LLM/tool loop). The function runtime is an in-process Kotlin API used by built-in debug agents and embedded applications; it cannot be defined as executable code in coral-agent.toml.
It’s recommended you support Docker if you intend to publish your
agent, or export it as a remote agent (closed beta).
Docker
Docker
Running your agent via docker naturally requires your agent to be containerized.How you containerize your agent depends a lot on how your agent is written - what language it uses, how it manages dependencies, etc. Feel free to browse our curated list of agents here for reference on packaging Python agents for Docker using uv.Once it is, you simply reference your image in the For agents only intended to be ran by your own local coral servers, just having the image built & present locally is enough.For public agents, you need to make sure the image is available on a registry like Docker Hub or Github’s Container registry
coral-agent.toml:Executable (local subprocess)
Executable (local subprocess)
This runtime is even more implementation dependent - since you are running a command/process directly on the same host as the server. It’s also not portable, since it’s hard to account for all possible system environments.For these reasons it’s recommended you use the Docker runtime whenever possible.A good pattern to maximise portability is writing wrapper scripts for each OS you want to support, that handles ensuring dependencies are present/downloaded (e.g. create/enter a python virtual environment, download dependencies)Here’s an example of a bootstrap script we use for our agents:
Adding this runtime to your
Bootstrap script
Bootstrap script
coral-agent.toml would look something like:Runtime transport (agent↔server)
Agents communicate with Coral Server using MCP over HTTP. Two transport modes are supported by all runtimes:streamable_http(default)sse(legacy Server‑Sent Events)
transport field in coral-agent.toml:
Orchestration Environment
Agents run under orchestration are provided with a set of “system” environment variables that are needed/useful to work with Coral:CORAL_SEND_CLAIMS, CORAL_REMOTE_AGENT, CORAL_STATE_RESOURCE_URI, and CORAL_INSTRUCTION_RESOURCE_URI are not emitted for local Docker/executable agents in public Server 1.5.0. Prototype runtimes consume configuration in-process instead of launching an environment-configured child process.
Local iteration tips
During development, we recommend:- Use the
executableruntime to iterate locally, or containerize early and use thedockerruntime for parity. - Make your agent discoverable to Coral Server with
coralizer link .so it appears in the local registry. - Create a session via the REST API at
POST http://localhost:5555/api/v1/local/sessionto launch and test your agent.