@zack/react-loop
Portable ReAct loop for reasoning over context, taking actions, reflecting on results, and iterating until completion or handoff.
Install
agentpm install @zack/react-loop@0.1.0Load
import { loadLoop } from '@agentpm/sdk';
const loop = await loadLoop('@zack/react-loop@0.1.0');Weekly installs
0
0%
Last publish
Today
v0.1.0
agent.json
{
"name": "react-loop",
"version": "0.1.0",
"description": "Portable ReAct loop for reasoning over context, taking actions, reflecting on results, and iterating until completion or handoff.",
"loop": {
"archetype": "react",
"entry_phase": "reason",
"limits": {
"max_steps": 10
},
"phases": [
{
"id": "reason",
"access": {
"tools": false,
"memory": {
"read": true,
"write": true
},
"knowledge": true
},
"outcomes": [
{
"id": "act",
"description": "The next step is clear enough to move into execution."
},
{
"id": "reason-more",
"description": "The loop should continue reasoning because the next action plan is not yet strong enough."
},
{
"id": "handoff",
"description": "The work should hand off because the current runtime lacks authority, context, or the right surface to continue."
}
],
"objective": "Assess the current context, form the next action plan, and decide whether to proceed into execution, continue reasoning, or hand off."
},
{
"id": "act",
"access": {
"tools": true,
"memory": {
"read": true,
"write": true
},
"knowledge": true
},
"objective": "Execute the current plan, gather the new observations, and update working state so the next reflection pass has concrete results to inspect."
},
{
"id": "reflect",
"access": {
"tools": true,
"memory": {
"read": true,
"write": true
},
"knowledge": true
},
"outcomes": [
{
"id": "complete",
"description": "The loop has enough result quality and evidence to finish cleanly."
},
{
"id": "reason-more",
"description": "The loop should return to reasoning because another plan/action pass is needed."
},
{
"id": "handoff",
"description": "The work should hand off because reflection surfaced a boundary another owner should resolve."
}
],
"objective": "Evaluate the latest action result, decide whether the work is complete, needs another reasoning pass, or should hand off."
}
],
"transitions": [
{
"from": "reason",
"on": "act",
"to": "act"
},
{
"from": "reason",
"on": "reason-more",
"to": "reason"
},
{
"from": "reason",
"on": "handoff",
"to": "$handoff"
},
{
"from": "act",
"on": "complete",
"to": "reflect"
},
{
"from": "reflect",
"on": "complete",
"to": "$end"
},
{
"from": "reflect",
"on": "reason-more",
"to": "reason"
},
{
"from": "reflect",
"on": "handoff",
"to": "$handoff"
}
],
"checkpoints": [
{
"id": "approve-next-action",
"type": "approval",
"on_reject": "reason",
"before_phase": "act"
}
],
"error_policy": {
"tool_failure": {
"action": "retry",
"max_retries": 2,
"on_exhausted": "fail_phase"
},
"phase_failure": {
"action": "handoff"
}
}
},
"readme": "README.md",
"license": {
"spdx": "MIT"
}
}Loop graph
3 phases7 transitions6 explicit outcomes
Archetype
react
Entry phase
reason
Max steps
10
Terminal targets
$handoff$end
EntryCheckpointed phaseTerminal targets
Checkpoints
approve-next-action
approvalBefore
act, reject routes to reason.Error policy
Tool failure
Retry up to 2 time(s), then fail_phase.
Phase failure
On phase failure: handoff.