# Pętle działania agenta (myśl–działaj–obserwuj)

EN: **Agent control loops (reason–act–observe)** · id `agentloops` · aliases: agent loop patterns, pętla agenta

Path: [AI Atlas](https://aiatlasgraph.com/llms.txt) › [Aplikacje LLM i agenci](https://aiatlasgraph.com/t/applications.md) › [Agenci i orkiestracja](https://aiatlasgraph.com/t/agentsnode.md) › Pętle działania agenta (myśl–działaj–obserwuj)

## Description

- PL: Wzorce sterowania, w których model naprzemiennie rozumuje, wywołuje narzędzia i wczytuje obserwacje aż do spełnienia warunku stopu.
- EN: Control patterns in which a model alternates reasoning, tool calls and reading observations until a stopping condition is met.

## In one sentence

- PL: Podstawowy rytm pracy agenta: zastanów się, zrób jeden krok, zobacz skutek i dopiero wtedy zdecyduj, co dalej.
- EN: The basic rhythm of an agent: think, take one step, look at what happened, and only then decide what comes next.

## Problem it solves

- PL: Zadania z wieloma krokami rozsypują się, gdy model próbuje wszystko przewidzieć naraz, bez sprawdzania wyników po drodze.
- EN: Multi-step tasks fall apart when a model tries to foresee everything at once without checking results along the way.

## What it does

- PL: Działa jak kucharz, który próbuje potrawę po każdym dodanym składniku i na tej podstawie poprawia przepis.
- EN: It works like a cook who tastes the dish after each ingredient and adjusts the recipe accordingly.

## Everyday example

- PL: Prosisz asystenta o zarezerwowanie stolika; sprawdza wolne terminy, widzi brak miejsc o 19 i sam proponuje 20:30.
- EN: You ask an assistant to book a table; it checks availability, sees 7 pm is full and suggests 8:30 instead.

## This concerns you if you…

- PL: budujesz asystenta, który ma wykonywać zadania krok po kroku
- PL: chcesz zrozumieć, czym agent różni się od czatu
- PL: zastanawiasz się, czemu agent czasem kręci się w kółko
- EN: are building an assistant that carries out tasks step by step
- EN: want to understand how an agent differs from a chat
- EN: wonder why an agent sometimes goes round in circles

## Keywords

ReAct · plan-and-execute · ReWOO · agent loop · thought-action-observation · replanning · max iterations

## How it works

- PL: Środowisko wykonawcze wywołuje model z celem, historią i opisami narzędzi; model zwraca rozumowanie i akcję lub odpowiedź końcową. Wynik akcji wraca jako obserwacja do kontekstu. Warianty różnią się tym, czy plan powstaje z góry (plan-and-execute), czy krok po kroku (ReAct), oraz kiedy następuje ponowne planowanie.
- EN: A runtime calls the model with the goal, history and tool descriptions; the model returns reasoning plus an action or a final answer. The action's result is fed back into context as an observation. Variants differ in whether the plan is made upfront (plan-and-execute) or step by step (ReAct), and when replanning happens.

## Limits

- PL: Każdy krok to kolejne wywołanie modelu, więc koszt i opóźnienie rosną z długością zadania. Pętla może się zapętlić lub zakończyć przedwcześnie; potrzebne są budżety kroków, warunki stopu i obsługa błędów narzędzi.
- EN: Each step is another model call, so cost and latency grow with task length. Loops can cycle or stop too early; step budgets, stopping conditions and tool-error handling are needed.

## Key terms

- PL: **obserwacja**: Wynik działania narzędzia lub środowiska oddany modelowi do następnego kroku.
- PL: **warunek stopu**: Reguła mówiąca, kiedy agent kończy pracę i oddaje wynik.
- PL: **ponowne planowanie**: Zmiana planu, gdy wynik kroku nie zgadza się z oczekiwaniem.
- EN: **observation**: A tool or environment result handed back to the model for the next step.
- EN: **stopping condition**: A rule saying when the agent ends and returns its result.
- EN: **replanning**: Changing the plan when a step's result differs from what was expected.

## Know first

- [Łańcuch myśli (chain-of-thought) (Chain-of-thought prompting)](https://aiatlasgraph.com/t/cot.md)
- [Narzędzia i integracje (Tool use and integration)](https://aiatlasgraph.com/t/tools.md)

## Subtopics (2 direct, 2 in total)

- [Najpierw plan, potem wykonanie (plan-and-execute) (Plan-and-execute agents)](https://aiatlasgraph.com/t/planexecute.md): An agent architecture separating a planner that writes dependent steps upfront from a worker that executes them with tools and a module that combines the results.
- [ReAct: rozumowanie przeplatane z działaniem (ReAct (interleaved reasoning and acting))](https://aiatlasgraph.com/t/reactagents.md): A prompting pattern in which the model alternates reasoning traces and actions, with tool observations fed back into context.

## Related topics

Untyped, symmetric "see also" links.

- [Pętla samodoskonalenia (Reflection and feedback loops)](https://aiatlasgraph.com/t/reflection.md)

## Sources

- [ReAct: Synergizing Reasoning and Acting in Language Models](<https://arxiv.org/abs/2210.03629>) `yao-react-2022` · by Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik Narasimhan, Yuan Cao
- [ReWOO: Decoupling Reasoning from Observations for Efficient Augmented Language Models](<https://arxiv.org/abs/2305.18323>) `xu-rewoo-2023` · by Binfeng Xu, Zhiyuan Peng, Bowen Lei, Subhabrata Mukherjee, Yuchen Liu, Dongkuan Xu

---

AI Atlas revision 124 (2026-10-31) · HTML: https://aiatlasgraph.com/t/agentloops · index: https://aiatlasgraph.com/llms.txt · everything: https://aiatlasgraph.com/llms-full.txt · updated 2026-10-31
