app.py, which monte env create writes from Gym’s template.
How an Attempt Runs
- The agent sends the task row to the server’s
seed_sessionendpoint, which opens a session for the attempt. - The agent sends the row’s
inputandtoolsto the model. - Each time the model calls a tool, the agent sends the arguments to the server endpoint with the same name and returns the result to the model.
- When the model stops, the agent sends the whole answer and the row’s grader fields to
verify.
simple_agent, which allows a set number of turns in each attempt. In training, the recipe key grpo.max_turns sets that limit. Monte records the answer, the tool calls, and the reward as a trace.
Add a Tool
A tool is a FastAPI endpoint thatsetup_webserver adds, plus a declaration with the same name in the task rows. The support_escalation server has two tools:
support_escalation server ranks articles with the open-weight embedding model Qwen/Qwen3-Embedding-0.6B, which runs in the server process. A tool can also call an outside API with a key from a team secret. A training environment calls open-weight models only.
Keep State for Each Attempt
Many attempts run at the same time on one server, so the server keys its state by the session ID. The same session ID reachesseed_session, each tool, and verify:
verify(self, request, body) clears the state of the attempt with self.tickets.pop(request.session[SESSION_ID_KEY], None). To start an attempt from a state that the row sets, override seed_session, which receives the whole row. A verify that scores this state, such as one that reads the categories it pops from self.tickets, cannot rescore, because the state ends with the attempt. The support_escalation grader reads the hand-off from the response, so its runs can rescore.
Server Config
configs/support_escalation.yaml names the server, sets its config fields, connects it to the agent and the model, and declares the training rows:
top_k, needs a new monte env add.
