12-factor-agents

What are the principles we can use to build LLM-powered software that is actually good enough to put in the hands of production customers?

24 articles 20.9k View on GitHub ↗
24 articles
How to Migrate from Framework-Based Agents to Custom Implementations: A 12-Factor Guide

Migrate from framework-based agents to custom implementations with this 12-factor guide. Extract agent loops, externalize prompts to BAML, and replace tool executors for full control.

migration-guide
May 19, 2026
How to Debug Agent Loops and Prevent Infinite Spinning in 12-Factor Agents

Debug agent loops and prevent infinite spinning in 12-Factor Agents. Implement step counters, validate LLM responses, and add structured logging to your agent code.

how-to-guide
May 19, 2026
How to Handle Rate Limiting in LLM Agent Frameworks: A 12-Factor Approach

Handle rate limiting in LLM agent frameworks with token buckets and exponential back-off. This 12-factor approach prevents API quota exhaustion and ensures predictable agent behavior.

how-to-guide
May 19, 2026
How to Implement DAG-Style Orchestration in Agent Systems

Master DAG-style orchestration in agent systems. Learn how to combine static task dependencies with LLM control for dynamic execution and resumable state management. Explore the humanlayer/12-factor-agents repository.

how-to-guide
May 19, 2026
How to Test and Evaluate LLM Agent Behavior Reliably: A 12-Factor Agents Guide

Learn to reliably test and evaluate LLM agent behavior using the 12-Factor Agents framework. This guide details a reproducible notebook workflow for isolated prompt execution and tool calls in sandboxed environments.

how-to-guide
May 19, 2026
How to Add Approval Gates in Agent Tool Execution: A 12-Factor Agents Guide

Learn how to add approval gates in agent tool execution using a Thread state checker. Pause agent loops, await human confirmation, and resume processing securely. Improve agent control and reliability.

how-to-guide
May 19, 2026
How to Manage LLM Context Window Size for Long-Running Agents: A 12-Factor Approach

Master LLM context window size for long-running agents. Learn to serialize events, implement token budget guards, and optimize context for enhanced performance.

how-to-guide
May 19, 2026
How to Implement RAG in Agent Context Windows: A 12-Factor Agents Guide

Learn to implement RAG in agent context windows by encoding documents as structured events for efficient LLM reasoning over current information. Explore the 12-Factor Agents guide.

how-to-guide
May 19, 2026
How to Build Multi-Step Agent Workflows with Deterministic Control

Learn to build multi step agent workflows with deterministic control by separating LLM reasoning from execution. Output JSON intents for a dispatch layer to route to functions. Enable interruptible loops with persistent state.

tutorial
May 19, 2026
How to Design Agent Memory and Context Persistence in 12-Factor Agents

Learn to design agent memory and context persistence by treating threads as the source of truth and persisting events to a ThreadStore. Ensure seamless state retention for your stateless LLMs.

how-to-guide
May 19, 2026
Agent Error Recovery and Retry Logic in 12-Factor Agents: A Complete Guide

Master agent error recovery and retry logic in 12-factor agents. Learn to treat tool failures as events for LLM self-correction and implement robust retry counters. Ensure agent resilience.

how-to-guide
May 19, 2026
How to Implement Schema-Aligned Parsing for Reliable LLM Outputs

Learn schema-aligned parsing to ensure LLM outputs are reliable JSON, validating against Zod schemas and preventing errors before they impact your business logic.

how-to-guide
May 19, 2026

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →