Manuscript Offprint

arXiv:2610.26845

Train An Imaginative Agent

Jiaxin Ge, Junyi Zhang, Tianning Chai, Hanjun Yoo, Chenyang Wang, Xiuyu Li, Weijia Shi, XuDong Wang, Sewon Min, Luke Zettlemoyer, Trevor Darrell, Haiwen Feng

ABSTRACT

A seemingly reasonable push in Sokoban can make the puzzle unsolvable. To avoid such mistakes, an agent has to anticipate the consequences of its actions before execution, especially when feedback from the real environment is sparse or actions are irreversible. We introduce Agentic Imagination (Agima), a training framework that trains an agent to imagine before acting, i.e. to be imaginative. Agima trains a single omni model to propose actions, generate images of their outcomes, and then reason over these imagined futures to decide what to execute in the real environment. Rather than committing to a single plan, the agent can simulate a sequence of actions, explore alternatives, and compare possible futures. We first use supervised fine-tuning (SFT) to unify policy and world modeling within a single omni model. This enables the agent to predict future outcomes and perform basic forms of imagination, such as forward thinking and counterfactual branching. We then use agentic reinforcement learning (RL) to teach the agent to reason with its imagined futures and use them effectively for planning. Across four environments spanning Maze2D, Sokoban, Pacman, and PushT, Agima generalizes to harder settings unseen during training. Trained with SFT alone on two-box Sokoban, Agima solves 40% of four-box puzzles while seeing the real board only once every five moves, compared with an action-only planner that only solves 2%. After RL, new behaviors emerge in how Agima uses its imagination: it learns a new unified format that was unseen during the SFT stage, learns to conduct forward thinking only when necessary, and branches more frequently at critical decision points. An agent that can picture where its actions lead can learn when and where to look ahead, that is, to plan. Project page: https://agima.net/.

1 INTRODUCTION

Agents take actions and receive observations from the environment (Sutton & Barto, 2018; Yao et al., 2023b), but making good decisions often requires anticipating the consequences of actions several steps ahead. When environment interactions are expensive or actions are irreversible, directly testing alternative actions through execution may not be feasible. For example, in Sokoban, a seemingly reasonable push can block another box and make the puzzle unsolvable. To avoid such failures, agents can predict and evaluate the consequences of possible actions before executing them (Racanière et al., 2017).

We introduce Agentic Imagination (Agima), a training framework that teaches an agent to imagine future observations of its actions and reason over them to plan before acting in the real environment. We build Agima on an omni model that unifies visual generation and language reasoning within the same multimodal context (Zhou et al., 2025; Deng et al., 2025). The same model serves as both the policy model that proposes actions and as the world model that imagines their visual states. These predictions become observations that the agent can use for further planning: it can extend a rollout, explore counterfactual actions, or compare longer candidate plans before execution (Figure 1). Importantly, imagined and real observations share the same interface and can be used interchangeably as inputs to the model. This allows the agent to use imagined observations in place of real

∗,†^{*},\dagger: Equal contribution.

(a)

Feedback after acting

Figure

(b)

Feedback through imagination (Agima)

(c) Planning with Agima

Counterfactual branching

Forward thinking

Figure 1: Planning with agentic imagination. (a) A conventional agent receives feedback only after acting in the environment. (b) Agima uses a single model to propose actions and predict the consequences of them. Each prediction serves as an internal observation for the next decision. (c) Planning with Agima in Sokoban: counterfactual branching rejects a deadlocking action, and forward thinking compares candidate plans before execution. The executed actions reach ot+Ko_{t+K}, which grounds the next round of imagination. In (c), o^j\hat{o}_j is the predicted outcome of a^j\hat{a}_j.

environment feedback to continue planning, while real observations can replace imagined ones after execution to ground the next round of planning.

To teach the agent to imagine futures and plan with them, we construct training trajectories that interleave action proposals, visual predictions, and outcome evaluation. This allows the agent to unify policy, world modeling, and reward modeling within a single omni model. We also teach the agent basic ways to reason over its imagined futures for planning. A linear rollout follows a single action sequence, predicting the state after each step. Counterfactual branching explores alternative actions at individual steps and rejects those that lead to failures. Forward thinking imagines and compares longer candidate plans before deciding which one to execute. Together, these trajectories teach the agent to generate imagined futures and use them to evaluate different actions before execution. We use these trajectories for supervised fine-tuning (SFT).

Once the agent can imagine futures, we want it to learn how to reason over them more effectively, rather than simply following predefined reasoning formats. Recent progress in reinforcement learning (RL) for reasoning and tool use in language models (Kumar et al., 2025; Jin et al., 2025) shows that models can learn new reasoning behaviors from outcome rewards. We adapt this idea to Agima using GRPO (Shao et al., 2024). During RL, the agent imagines and evaluates candidate plans, executes its selected actions in the real environment, and receives a binary reward based on task success. We optimize the agent's reasoning in language space and keeps its generated visual observations as context for planning. Unlike SFT, we do not provide additional expert demonstrations or supervise how the agent should organize its imagination. This allows the agent to internalize adaptive reasoning strategies. It learns from task success when to explore another plan, which alternatives to consider, and when to proceed with its current plan.

We evaluate Agima in Maze2D (Wang et al., 2026), Sokoban and Pacman (Racanière et al., 2017), and PushT (Florence et al., 2022; Chi et al., 2024), training on simpler instances and testing on harder settings excluded from training. With SFT alone, Agima directly generalizes from two-box to four-box Sokoban without further training. With real observations every five actions, it achieves 40% success, compared with 2% for an action-only planner fine-tuned from the same backbone. Forward thinking further improves long-horizon planning in Pacman using the same training instances as linear rollouts. Agentic RL further improves task success and leads to new behaviors in how Agima uses its imagination. For forward thinking, the agent learns a new reasoning format unseen during SFT: it first imagines a single plan and only explores another candidate when the first is predicted to fail. For counterfactual branching, the agent explores more alternatives and increasingly focuses

(a) Train / Test States

Figure

(b) Pacman Example Trace

Figure

Figure 2: Evaluation environments and imagined visual rollouts. (a) Training and test states in four environments. (b) Agima interleaves actions and predicted states, then executes the actions.

its branches on critical decisions where a wrong action could make the puzzle unsolvable. These behaviors emerge from task-level rewards without additional supervision on how to organize its imagination.

Our contributions are threefold. First, we introduce Agima, a training framework for agentic imagination that teaches agents to explore, evaluate, and revise plans using predicted visual observations before acting. Second, we show that agentic imagination generalizes to out-of-domain settings across four environments, with further gains from learning to compare imagined futures using the same underlying training instances. Third, we show that agentic RL teaches Agima to organize its own imagination through task-success rewards, eliciting adaptive reasoning strategies that determine when to explore another plan and where to examine alternative actions.

References (41)