go-patterns
esc

Agentic patterns

Patterns for building AI agent systems in Go: reasoning loops, tool dispatch, memory, retrieval, and multi-agent coordination.

Agent Loop (ReAct)

unread

Drive an agent by alternating reasoning and acting steps inside a structured loop that terminates when the model signals a final answer.

Medium

Tool Use

unread

Register 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.

Low

Orchestrator-Subagent

unread

Decompose a complex task by having a root agent spawn and coordinate specialized subagents, each responsible for one concern, then aggregate their results.

High

Memory

unread

Give 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.

Medium

Retrieval-Augmented Generation

unread

Ground LLM responses in authoritative documents by retrieving relevant chunks before generation so the model can cite real data instead of hallucinating.

Medium

Human-in-the-Loop

unread

Pause 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.

Medium

Prompt Template

unread

Build prompts from versioned, parameterized templates so prompt logic stays separate from agent orchestration code and can be tested, diffed, and swapped independently.

Low

Multi-Agent Communication

unread

Enable agents to exchange typed messages through a shared message bus so they can collaborate without direct references to each other's implementations.

High