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 modelParse to {thought, tool, args}. Thoughts never execute.
Loop
- Prompt with goal + tool docs + format
- Parse
- Run tool or reject
- Append observation
- Repeat until finish / max_steps / parse budget
Stop
| Event | Result |
|---|---|
| valid finish | answer |
| cannot_answer | abstain |
| max_steps | abstain budget |
| parse budget | error 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.