Patterns
Patterns Overview
Pre-built agent patterns composed from Noetic's 7 primitives -- from simple ReAct loops to multi-agent task trees.
Overview
Patterns are ready-made compositions of Noetic's 7 primitives (step.run, step.llm, step.tool, branch, fork, spawn, loop). Each pattern solves a common agent architecture problem without sacrificing the ability to customize.
Every pattern returns a Step (usually a StepLoop), which means you can nest patterns inside other patterns, wrap them in additional loops, or use them as children in spawn and fork steps.
Available Patterns
| Pattern | Function | What It Does |
|---|---|---|
| ReAct | react() | Observe-Think-Act loop with tools |
| Ralph Wiggum | ralphWiggum() | Self-refining agent with verification |
| Task Trees | compilePlan() | Tree-structured multi-agent workflows |
| Adaptive Plans | adaptivePlan() | Dynamic planning with error-driven revision |
| Recursive LLM | spawn() with contextIn: 'fresh' | Recursive sub-task delegation |
| Thread Weaving | fork(mode: 'all') | Parallel analysis with merged results |
| Dual Agent | spawn() + channel() | Two agents communicating via channels |
| A2A Remote | ExternalChannel | Inter-process agent communication |
How Patterns Compose
Patterns are not special. They return plain Step objects:
import { react, ralphWiggum, fork } from '@noetic/core';
// Use a pattern as a fork path
const parallel = fork({
id: 'parallel-research',
mode: 'all',
paths: () => [
react({ model: 'gpt-4o', tools: [searchTool] }),
react({ model: 'gpt-4o', tools: [analyzeTool] }),
],
merge: (results) => results.join('\n\n'),
});
// Wrap a pattern in verification
const verified = ralphWiggum({
model: 'gpt-4o',
system: 'Write unit tests.',
tools: [codeTool],
verify: async (output) => ({
pass: String(output).includes('expect('),
feedback: 'Tests must use expect() assertions.',
}),
});Choosing a Pattern
- Single task with tools: Start with ReAct.
- Quality matters: Use Ralph Wiggum to add self-verification.
- Multi-step plan: Use Task Trees for static plans or Adaptive Plans for dynamic ones.
- Parallel work: Use Thread Weaving via
fork. - Sub-tasks: Use Recursive LLM via
spawn. - Agent collaboration: Use Dual Agent for in-process or A2A Remote for cross-process.