Configure Agents
The Agent Server hosts the agent harness, which calls the model and routes tool calls. It does not run an LLM itself; it is orchestration code, and the harness uses a Model Server or calls an inference endpoint directly. Support for multiple tool calls per turn and for multi-turn conversations depends on the harness, its Gym integration, and the Environment Server. An Environment Server either orders the episode’s calls or relays the whole episode to the agent, as in the pseudocode below.
Rollout Lifecycle
The following pseudocode illustrates a typical agent rollout in three phases: initialize the episode, run the agent loop, and grade the result. During the agent loop, the agent sends the conversation to the model, gets back a response, and if the model makes any tool calls, it routes them to the Resources server and feeds the results back to the model. The loop repeats until stop criteria are met, such as model max sequence length or the agent reaching a defined max steps or turns. Once the loop completes, the agent calls the Resources server to verify the result and collect a reward.
The pseudocode is the legacy_agent path: rollout collection reaches the agent through a legacy_agent Environment Server that relays /run unchanged, and the agent runs the whole episode itself. Most agents, including Remote Agent, still run this way. Agents that implement agent sessions, such as SimpleAgent and the sandboxed harnesses, can instead run under an Environment Server that drives agent sessions, such as single_agent_turn. Most shipped SimpleAgent configurations do, through its flat-row adapter single_agent_turn_legacy. Such a server calls seed_session and verify on the Resources server itself and drives the agent through session endpoints, so the agent does not decide when to verify. The harbor Environment Server drives sessions the same way for task folders, which need no Resources server. See Design Agent-Environment Interactions.
Choose a Path
Start from what you have, and move to a deeper path only when you need what it adds.
Grow from a score to training
A common route for an agent that you already run:
- Score it. Drive the agent through a Remote Agent and get verifier rewards without rewriting it. Gym treats the agent as a black box.
- Evaluate it with Gym’s models, tools, and sandboxes. Build an Agent Server adapter so that Gym can show its model calls, tool use, and execution trace. These rollouts are not yet validated for training.
- Train it. Confirm that every policy-generating model call is captured with token IDs and logprobs, then run an end-to-end training job. This needs a model server that returns token information, such as the vLLM model server. See Choose the capabilities you need.
Server Configuration
To add conversations, tool timing, and model-call references to a custom harness, see Rollout Evidence.
An Agent Server runs with num_workers above 1 when its entrypoint module defines the module-level app that each Uvicorn worker serves, the same way as a Resources Server. An agent that cannot run in several processes overrides multiple_workers_unsupported_reason() instead, and refuses several workers at startup. Concurrency limits such as an agent’s concurrency semaphore apply per worker, so the server as a whole allows num_workers times the configured limit.
Agent Server Fields for server configuration syntax and fields.