JJoeven

Reference/Agent patterns

ReAct loop

Thought → Action → Observation until finish; parse text to the same {tool, args} runtime.

ReAct = interleaved reasoning and acting.

Text protocol

text
Thought: ...
Action: search|open|finish
Action Input: ...
Observation: ...   # written by you, not the model

Parse to {thought, tool, args}. Thoughts never execute.

Loop

  1. Prompt with goal + tool docs + format
  2. Parse
  3. Run tool or reject
  4. Append observation
  5. Repeat until finish / max_steps / parse budget

Stop

EventResult
valid finishanswer
cannot_answerabstain
max_stepsabstain budget
parse budgeterror to user

Do

  • Allowlist actions
  • Cite only opened URLs
  • Dedup searches
  • Cap steps (6–8 for small corpora)

Do not

  • Execute thoughts
  • Treat snippets as citations
  • Dump the whole WEB into the prompt
  • Use Final Answer: as a second protocol
Tip:Native tool_calls are ReAct without the poetry. Keep one runtime.