---
title: "Multi-Turn Agentic Reinforcement Learning with Tunix and Gemma 4 on Google TPUs"
description: "Training real-world AI agents requires reasoning over multiple turns with tool use and environment feedback in a multi-step loop. This post presents a method to train a multi-turn tool-using LLM agent on Cloud TPU v6e-8 using Tunix’s agentic reinforcement learning pipeline. The agent plays the Plane Strike board game on a 6x6 grid with a hidden eight-cell plane in one of four orientations, using Gemma 4 E2B in thinking mode. The pipeline includes a custom environment, Gemma 4 native tool calling via tool declarations and in-turn tool responses, a conversation agent for observation-to-message translation, and GRPO with multi-turn rollouts using vllm-tpu and prefix caching. After 100 training steps, the win rate on held-out boards jumps from 9.4% to 95% while average game length drops from 22.44 to about 16 strikes."
---

# Multi-Turn Agentic Reinforcement Learning with Tunix and Gemma 4 on Google TPUs

[Google](https://yomu.fyi/company/google) · Wei Wei · Nov 19, 2026

**Type:** Tutorial

## Summary

Training real-world AI agents requires reasoning over multiple turns with tool use and environment feedback in a multi-step loop. This post presents a method to train a multi-turn tool-using LLM agent on Cloud TPU v6e-8 using Tunix’s agentic reinforcement learning pipeline. The agent plays the Plane Strike board game on a 6x6 grid with a hidden eight-cell plane in one of four orientations, using Gemma 4 E2B in thinking mode. The pipeline includes a custom environment, Gemma 4 native tool calling via tool declarations and in-turn tool responses, a conversation agent for observation-to-message translation, and GRPO with multi-turn rollouts using vllm-tpu and prefix caching. After 100 training steps, the win rate on held-out boards jumps from 9.4% to 95% while average game length drops from 22.44 to about 16 strikes.

## Context

Multi-turn agentic RL for tool-using LLMs is complex due to variable-length rollouts and credit assignment. The post addresses this by using Tunix’s agentic RL pipeline on TPUs.

## Approach / What changed

Implement a multi-turn RL pipeline in Tunix with four components: TaskEnvironment (PlaneStrikeEnv), Tool and Chat Template Parser (StrikeTool and Gemma4ToolChatTemplateParser), ConversationAgent (PlaneStrikeAgent), and TrajectoryCollection with GRPOLearner, using vllm-tpu and prefix caching for efficient rollouts on Cloud TPU v6e-8.

## Takeaways

- After 100 steps of agentic GRPO, the Gemma 4 E2B agent’s win rate on Plane Strike increases from 9.4% to 95% while average game length decreases from 22.44 to about 16 strikes.
- The training uses GRPO with loss\_algo=‘gspo-token’ and advantage\_estimator=‘rloo’ and exact\_token\_continuity=True to preserve token IDs across multi-turn rollouts.
- Setting rollout\_vllm\_server\_mode to true and enable\_prefix\_caching to true enables continuous asynchronous multi-turn rollouts, addressing the variable-length bottleneck.

## FAQ

### How does the agent handle multi-turn tool calling?

After each tool call, the model pauses at the native stop token like <tool\_response> and waits for the environment response; then the model continues generating its next thought and tool call within the same assistant turn.

### What config settings are important for multi-turn rollouts?

Set rollout\_vllm\_server\_mode to true for continuous asynchronous rollouts and enable\_prefix\_caching to true to cache growing conversation history. Also use exact\_token\_continuity=True to avoid retokenization drift across turns.

### What initial win rate does the base model achieve and how much does training improve it?

The base Gemma 4 E2B model wins only 9.4% of games with about 22.44 strikes average. After 100 training steps, win rate reaches 95% and average game length drops to about 16 strikes.

**Tags:** [Agentic RL](https://yomu.fyi/topic/agentic-rl), [Gemma 4](https://yomu.fyi/topic/gemma-4), [Reinforcement Learning](https://yomu.fyi/topic/reinforcement-learning), [Tunix](https://yomu.fyi/topic/tunix)

- Source: [Google](https://developers.googleblog.com/multi-turn-agentic-reinforcement-learning-with-tunix-and-gemma-4-on-google-tpus)
- Source URL: https://developers.googleblog.com/multi-turn-agentic-reinforcement-learning-with-tunix-and-gemma-4-on-google-tpus
- Ingested by Yomu: 2026-11-19T18:00:18.659Z

[Read original post](https://developers.googleblog.com/multi-turn-agentic-reinforcement-learning-with-tunix-and-gemma-4-on-google-tpus)
