Agentic patterns
Patterns for building AI agent systems in Go: reasoning loops, tool dispatch, memory, retrieval, and multi-agent coordination.
Agent Loop (ReAct)
unreadDrive an agent by alternating reasoning and acting steps inside a structured loop that terminates when the model signals a final answer.
Tool Use
unreadRegister typed tools by name so an agent can dispatch LLM-selected function calls to the right handler without embedding dispatch logic in the agent itself.
Orchestrator-Subagent
unreadDecompose a complex task by having a root agent spawn and coordinate specialized subagents, each responsible for one concern, then aggregate their results.
Memory
unreadGive an agent a pluggable memory store — short-term context buffer, episodic session history, and optional long-term semantic store — through one interface so the storage backend can be swapped.
Retrieval-Augmented Generation
unreadGround LLM responses in authoritative documents by retrieving relevant chunks before generation so the model can cite real data instead of hallucinating.
Human-in-the-Loop
unreadPause agent execution at defined checkpoints to request human approval or input, then resume with the human's decision injected back into the agent's context.
Prompt Template
unreadBuild prompts from versioned, parameterized templates so prompt logic stays separate from agent orchestration code and can be tested, diffed, and swapped independently.
Multi-Agent Communication
unreadEnable agents to exchange typed messages through a shared message bus so they can collaborate without direct references to each other's implementations.