How to Build a Streaming Decision Agent with Online Replanning in a Dynamic Environment
The tutorial explains how to build a streaming decision-making agent that adapts to a changing environment in real time. The agent operates on a grid with moving obstacles, uses A* in a receding-horizon mode, and replans its route on the fly. The architecture lets the agent broadcast intermediate reasoning: it does not wait for a final answer but streams its thinking as it works.
AI-processed from MarkTechPost; edited by Hamidun News
The tutorial describes the architecture of a streaming decision-making agent that operates in a constantly changing environment and broadcasts partial reasoning in real time, without waiting for a final answer before acting.
Environment and task
The demo uses a dynamic grid: obstacles move by their own rules, and the target point shifts randomly at a fixed interval. The agent does not know in advance what will change on the next step, which is the key difference from classic pathfinding problems.
Key environment parameters:
- An N×N grid with moving obstacles
- The goal shifts randomly every K steps
- The agent sees only a limited radius around itself
- The environment is non-deterministic: the same plan can fail twice
This setup is deliberately difficult. It models real scenarios: an autonomous robot navigating a warehouse, a self-driving car planning a route in traffic, a production line being managed through equipment failures.
A receding-horizon planner
The agent is built on the A* algorithm, but applied unconventionally. Instead of a full route to the goal, it uses a receding horizon: the agent plans only the nearest H steps, executes several of them, then replans from its new position using the updated state of the environment.
This fundamentally changes how it works. In a dynamic environment, a full plan goes stale faster than the agent can carry it out: an obstacle has moved, the goal has shifted, and the route is already obsolete. A short horizon keeps the agent from clinging to outdated data.
"The agent doesn't keep one big plan.
It constantly creates and discards small plans as it advances," is the essence of the receding-horizon approach.
The H parameter (horizon length) becomes the key tuning knob. Too short, and the agent moves myopically and gets stuck in local minima. Too long, and it wastes time planning routes it will have to throw away anyway.
Streaming partial reasoning
A standard agent stays silent until it finds a final answer. A streaming agent broadcasts intermediate states in real time, so every significant reasoning step becomes available immediately:
- New obstacle detected → signal sent immediately
- Goal moved → old plan discarded, new one started
- Intermediate path found → streamed, even if not yet optimal
- Horizon point reached and replan launched → status updated
This provides observability: an orchestrator system or a user always knows the agent's current intent. In production systems, this makes it possible to intervene before the agent hits a dead end.
Another effect is that an external system can correct behavior on the fly: if the streamed plan heads in an undesirable direction, an interrupt signal can be sent immediately.
Technically, streaming is implemented through Python generators: each yield broadcasts a reasoning step, which is compatible with the streaming APIs of modern LLMs.
Reactive adaptation
The third component is interrupting the current plan when the environment changes in the middle of executing a step. The agent does not wait for the next replanning cycle: an interrupt mechanism checks the state of the environment after every action and launches an emergency replan if needed.
The design introduces a severity level for changes: a small obstacle shift means continue the current plan; a blocked next step means immediate replanning; a complete change in goal position means a restart from a new horizon. This multi-level response increases computational load, but it is critical where the cost of error is high.
What this means
The architecture described is a practical template for developers of AI agents working under real uncertainty. Streaming reasoning, a short planning horizon, and reactive interrupts are three patterns that together provide a ready-made framework for robotics, industrial automation, and LLM-based agent systems.
As agent systems spread through industry, the gap between "thinking in a vacuum" and "acting in the real world" is becoming a key engineering challenge. This tutorial offers a concrete entry point.
- Dec 2, 2026Ai2 Releases MolmoWeb2 Web Agents: 27B Model Solves 75.3% of Tasks
- Dec 2, 2026Amazon Releases Ergo Open Weights for Coding: 1.1 Trillion Parameters and 2,200 Tokens per Second
- Dec 2, 2026OpenAI Opens Dots Agent to ChatGPT Plus Subscribers With 10,000+ Plugins
- Dec 2, 2026FSK Group Has Launched 395 AI Agents in Six Months, with a 97.7% Success Rate
Key Questions Answered
What are the key details on Environment and task?
The demo uses a dynamic grid: obstacles move by their own rules, and the target point shifts randomly at a fixed interval. The agent does not know in advance what will change on the next step, which is the key difference from classic pathfinding problems. Key environment parameters: An N×N grid with moving obstacles The goal shifts randomly every K steps The agent sees only a limited radius around itself The environment is non-deterministic: the same plan can fail twice This setup is deliberately difficult.
What are the key details on A receding-horizon planner?
The agent is built on the A algorithm, but applied unconventionally. Instead of a full route to the goal, it uses a receding horizon: the agent plans only the nearest H steps, executes several of them, then replans from its new position using the updated state of the environment. This fundamentally changes how it works. In a dynamic environment, a full plan goes stale faster than the agent can carry it out: an obstacle has moved, the goal has shifted, and the route is already obsolete.
What are the key details on Streaming partial reasoning?
A standard agent stays silent until it finds a final answer. A streaming agent broadcasts intermediate states in real time, so every significant reasoning step becomes available immediately: New obstacle detected → signal sent immediately Goal moved → old plan discarded, new one started Intermediate path found → streamed, even if not yet optimal Horizon point reached and replan launched → status updated This provides observability: an orchestrator system or a user always knows the agent's current intent.
Free 2-Day Vibecoding & AI Agents Intensive
Day 1: the autonomous Hermes + DeepSeek AI agent — vibecoding and development on par with Claude Code / Codex / Gemini. Led by Jemal Hamidun, Head of AI at Alpina Digital and academic supervisor at MIPT. Right after you register with our bot Nika: the recording + 11 materials from the previous intensive.
Daily 60-sec AI Voice Brief + Weekly Production AI Agent Playbook
Listen to a 60-second AI news brief every morning and get a weekly hands-on playbook for shipping AI agents to production — tools, MCP servers and patterns that work. Curated by Jemal Hamidun, Head of AI at Alpina Digital.
