> ## Documentation Index
> Fetch the complete documentation index at: https://icrl.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# ReAct Loop

> Execution model used by ICRL agents

## Execution Order

For each episode:

1. `env.reset(goal)`
2. Generate initial plan
3. For each step until done or `max_steps`:
   * retrieve step examples
   * generate reasoning
   * generate action
   * call `env.step(action)`
4. record retrieval outcome for curation

## Prompt Variables

Prompt templates can use:

* `{goal}`
* `{plan}`
* `{observation}`
* `{reasoning}`
* `{history}`
* `{examples}`

## Python-Specific Behavior

* Supports both sync and async `env.step` return values.
* Supports unified XML tool-loop prompt mode when XML markers are present.
* Applies environment-variable caps for prompt field length.

## TypeScript-Specific Behavior

* Environment methods can be sync or async.
* Prompt field caps are configured via `ReActLoopOptions`.
* Uses model helper formatters (`formatExamples`, `formatHistory`).
