
12-Factor Agents
github.com/humanlayer/12-factor-agents- Category
- AI Agents
- Rank
- No. 331Tools index
Previous survey · No. 326 ·
- Type
- APP
- Builder
- humanlayer
- GitHub
- 25.9k stars
- Date
About
A set of engineering principles for building reliable, production-grade LLM-powered software — the 12-factor methodology for agents.
What it does
12-Factor Agents explains an architecture for LLM applications where ordinary software owns prompts, context, state, control flow, tools, errors, and human handoffs. Its written factors are backed by TypeScript examples, a starter agent, command-line interaction, an HTTP server, workshop material, and walkthrough-generation utilities.
Why it's ranked here
This is strongest as an architecture checklist, not a drop-in agent framework. The guidance connects abstract concerns to working patterns: structured model outputs, explicit event history, deterministic tool execution, pause and resume behavior, approval gates, and compact agents. That combination makes it useful before a team commits to framework-specific abstractions.
What's good
The project treats model calls as controlled parts of a larger program. It keeps tool execution in deterministic code, makes prompts and context application-owned, joins execution history with business state, and models human approval as another structured interaction. The starter demonstrates both terminal and webhook-driven outer loops, with persisted threads supporting resumed work.
Tradeoffs
The principles require teams to build and own substantial orchestration code. The starter uses filesystem-backed thread storage and integrates with HumanLayer, so it is an example rather than a neutral production stack. Workshop examples also introduce BAML and external model credentials. The supplied material does not establish production storage, deployment, authentication, or operational monitoring.
How to use it well
Use it when designing or refactoring an LLM workflow that needs explicit state, controlled tools, human approval, and multiple entry points. Read the factors as design constraints, then use the starter and workshops to test those patterns in a small workflow. Bring separate infrastructure for production persistence, authentication, deployment, monitoring, and provider selection.
Technical notes+
README.md defines the twelve factors and positions agents as mostly deterministic software with selective LLM decisions. packages/create-12-factor-agent/template/src/cli.ts runs an outer loop, persists Thread state through FileSystemThreadStore, and routes approvals or human messages by intent. packages/create-12-factor-agent/template/src/server.ts exposes an Express POST endpoint, restores threads from webhook state, and creates HumanLayer contacts or function-call approvals. packages/walkthroughgen/src/cli.ts reads YAML walkthrough definitions, copies files, executes explicitly incremental commands, and emits Markdown with optional diffs. packages/walkthroughgen/jest.config.js configures TypeScript tests under test directories. workshops/2025-07-16/walkthroughgen_py.py converts YAML walkthroughs into Jupyter notebooks and includes BAML setup for Colab or local environments.
Observed
- Licenses
- Code is Apache 2.0; content is CC BY-SA 4.0.
- Primary language
- TypeScript drives the starter agent, server, CLI, workshops, and walkthrough generator; Python supports notebook and repository utilities.
- Install surface
- Project setup attempts npm install, then Bun or Yarn as fallbacks.
- Interfaces
- The starter provides a command-line interface and an Express HTTP POST endpoint.
- State model
- The starter persists event threads with a filesystem-backed store and carries thread identifiers through human-response state.
- Test configuration
- Jest uses ts-jest, a Node environment, and TypeScript tests located beneath test directories.
Read from README.md, Makefile, packages/walkthroughgen/jest.config.js, packages/walkthroughgen/src/cli.ts, packages/walkthroughgen/src/index.ts, packages/create-12-factor-agent/template/src/cli.ts, packages/create-12-factor-agent/template/src/index.ts, packages/create-12-factor-agent/template/src/server.ts, workshops/2025-07-16/walkthroughgen_py.py, hack/contributors_markdown/contributors_markdown.py, workshops/2025-05-17/walkthrough/01-cli.ts, workshops/2025-05-17/walkthrough/05-cli.ts, workshops/2025-05-17/walkthrough/00-index.ts, workshops/2025-05-17/walkthrough/01-agent.ts, workshops/2025-05-17/walkthrough/01-index.ts.
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.