Answers from the documentation; checking which model is on duty
Hi - I answer from the OpenSmartRoute documentation: routing, the API, plans and quotas, self-hosting. Ask away, or open a support ticket if you need a person.
Grounded in the docs - follow a source before acting on it.
Multi-turn agentic reinforcement learning with Tunix and Gemma 4 on Go - OpenSmartRoute
Introduction - announces multi-turn RL training with Tunix and Gemma 4 on TPUs
Google has developed a new way to train AI agents that can think over multiple steps. They use a system called Tunix combined with the Gemma 4 language model. This setup runs on Google Cloud TPUs, specifically the v6e-8 model. The goal is to improve how well AI agents perform in tasks that need reasoning across several turns. This method allows agents to call tools, observe feedback, and adapt their actions over time. It marks a step forward from simpler, single-turn models.
This new approach significantly boosts the performance of multi-turn, tool-using agents. It is designed to handle complex tasks that require reasoning, planning, and interaction. The training process involves a game environment and a reinforcement learning pipeline. The results show a large increase in success rates, from less than 10% to over 95%. This demonstrates the potential for more capable and reliable AI agents in real-world applications.
Background - explains the need for multi-turn reasoning in real-world agents
Many AI systems today are trained to respond in a single turn. They generate an answer based on a prompt or a question. However, real-world agents often need to think through multiple steps. They must reason over partial observations and decide what to do next. This is especially true when calling tools or interacting with environments.
Multi-turn reasoning allows agents to handle complex tasks better. They can gather information, interpret it, and plan their next move. For example, in a game or a navigation task, the agent needs to remember previous steps. It must also decide when to invoke tools or ask for more information. Single-turn models cannot easily manage these kinds of interactions.
Training agents for multi-turn reasoning is more challenging. It requires models that can remember context and adapt their responses. Reinforcement learning helps by rewarding agents for successful multi-step behavior. This approach encourages models to learn strategies that work across many turns, not just one. It is a key step toward building AI that can operate reliably in real-world scenarios.
Google's new open-source guide details how to design and optimize models for TPU hardware, focusing on shape alignment, architecture choices, and parallelism.
Environment setup - details defining the Plane Strike game environment
The environment used for training is a game called Plane Strike. It is played on a 6 by 6 grid, with columns labeled A to F and rows numbered 1 to 6. One plane is hidden in the grid, occupying 8 cells in one of four possible orientations. The agent’s goal is to find and hit all parts of the plane.
Each turn, the agent sees the result of its previous strike. The visible board shows which cells are untried, hit, or missed. The agent then thinks about where the plane might be and calls a tool to strike a specific cell. The game ends when the agent hits all 8 cells of the plane or after 23 strikes.
The environment provides feedback after each move. It updates the visible grid and calculates a reward based on the strike’s success. The environment is designed to be consistent across multiple runs by fixing the plane’s position with a seed value. This setup helps train the agent to develop effective strategies for searching and targeting.
Tool calling with Gemma 4 - describes how tools are integrated into model responses
Gemma 4 is a language model that can call tools during its responses. Tools are predefined functions that the model can invoke to get specific information or perform actions. In this setup, the tool is called "strike," which targets a cell on the grid.
The model’s responses include special tokens that indicate tool calls. For example, a response might contain "<|tool_call>call:strike{cell:C5}<|tool_call|>". When the model generates this, it pauses and waits for the tool to execute. The tool then returns a result, such as "hit" or "miss," which the model uses to continue thinking.
Tool schemas are declared in the system prompt using specific tags. The model recognizes these tags and knows when to call a tool. The responses from the tool are formatted as "<|tool_response>value:hit<|tool_response|>". The model then continues generating its next thought or action based on this feedback. This integration allows the agent to perform precise actions within the environment.
Building the conversation agent - explains translating observations to model actions
The conversation agent acts as a bridge between the environment and the language model. It translates environment observations into messages that the model can understand. When the environment provides a new observation, the agent creates a message with the current state of the game.
The agent also manages the model’s responses. When the model finishes a turn, the agent checks if the response contains a tool call or a final answer. If it calls a tool, the agent executes the call and updates the environment with the result. If the response is a final strike, the agent verifies its validity and applies it to the game.
The agent keeps track of the conversation history. It appends each observation and response to a message list. This history helps the model remember previous moves and reasoning steps. The agent ensures that only valid actions are taken and that the game progresses smoothly. This setup enables multi-turn reasoning and tool invocation within the reinforcement learning framework.
Training pipeline - covers configuring and running the RL training on Cloud TPU
The training pipeline uses Tunix’s modular components to run reinforcement learning on Cloud TPU v6e-8. It starts with defining the environment, tools, and the conversation agent. These components are connected to form a complete system for training the agent.
The pipeline configures a rollout engine that manages how the model interacts with the environment. It sets parameters like maximum prompt length, response length, and token caching. The engine runs multiple rollouts asynchronously, allowing the agent to learn from many simulated games at once.
The training process uses a method called Group Relative Policy Optimization (GRPO). This method rewards the agent for calling tools correctly and hitting the target. It also penalizes invalid actions and repeated moves. The pipeline adjusts the model’s parameters based on the success of its strategies over many steps.
The entire setup runs on a single Cloud TPU v6e-8 host. It shares resources among the actor model, reference model, and rollout workers. The system can perform hundreds of steps, each involving multiple game simulations. This setup makes training efficient and scalable for complex multi-turn tasks.
Results and benchmarks - presents performance improvements and metrics
After training for 100 steps, the agent shows dramatic improvements. Initially, the model called tools correctly only part of the time. Its tool call rate quickly reached nearly 100%, meaning it learned to invoke tools properly. Invalid calls dropped close to zero, and repeated moves decreased significantly.
The success rate of the agent hitting all parts of the plane within 23 steps rose from less than 10% to about 95%. This means the agent became very effective at solving the game. The average number of strikes per game also decreased from around 22 to 16. This indicates the agent became more efficient in its search and targeting.
The results demonstrate that multi-turn, tool-using reinforcement learning can significantly improve performance. The agent learned to reason over multiple steps, call tools accurately, and adapt its strategy. These benchmarks show the potential for deploying such agents in real-world tasks that require complex reasoning and interaction.
Why it matters - discusses implications for AI agent development
Training AI agents to operate over multiple turns is a key step toward more capable systems. It allows agents to handle tasks that need reasoning, planning, and tool use. This approach can be applied to many real-world scenarios, such as navigation, problem-solving, and decision-making.
The success of this method shows that reinforcement learning combined with large language models can produce highly effective multi-turn agents. It also highlights the importance of integrating tools and environment feedback into training. These techniques help build agents that are more reliable, adaptable, and efficient.
For developers, this progress means easier ways to train complex agents on cloud infrastructure. It opens the door to deploying AI that can perform multi-step reasoning in practical applications. As models improve, they will be better at understanding context, invoking tools, and making decisions in dynamic environments.
How OpenSmartRoute helps
OpenSmartRoute is an open-source router designed for AI requests. It manages how requests are sent to different models, agents, or tools from a catalog defined by the team. It scores each candidate based on quality, cost, speed, and safety. The team can set the importance of each factor for different requests.
Using OpenSmartRoute, teams can ensure that each request is routed to the most suitable model or agent. It enforces rules to keep personal data on-premises and avoid crossing regional or cost limits. The system learns from outcomes, giving more traffic to successful models and less to those that fail.
The platform also provides tools for measuring routing accuracy and managing costs. It keeps a catalog of models with their prices and rankings based on real traffic. This setup helps teams optimize their AI deployment for performance and efficiency, especially when training or running multi-turn agents like those described here.