What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Twelve-Factor Agents is a practitioner’s framework for adding bounded, controllable LLM behavior to software—not a promise that following twelve rules makes an application production-ready. Its central idea is to let a model propose a structured next action while application code owns execution, state, control flow, and human approvals. That approach lets teams add agent behavior to existing products without handing an open-ended loop the keys to the whole workflow.

What Twelve-Factor Agents means for an application team

HumanLayer’s guide asks: “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?” Dex, the author of the April 3, 2025 article, frames the answer as modular design advice inspired by the Twelve-Factor App. It is a point of view for practitioners, not a formal specification, benchmark, or official extension of the original methodology.

The practical pattern is straightforward: the model interprets context and proposes a structured next step; deterministic software checks and performs the action; then the application records the result and decides what happens next. A model-produced tool call is therefore an intention to evaluate, not an instruction the application must execute blindly. An agent can be a bounded decision inside ordinary software rather than a free-running system that controls its own entire workflow.

Dex writes that, in his experience, “The fastest way I’ve seen for builders to get good AI software in the hands of customers is to take small, modular concepts from agent building, and incorporate them into their existing product.” The article also reports that he spoke with at least 100 SaaS builders seeking to make existing products more agentic; that is his anecdotal account, not a representative industry survey. See the HumanLayer Twelve-Factor Agents repository and Dex’s April 3, 2025 article.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The 12 factors, translated into design decisions

The names below follow the current repository. Read them as related principles, not as a checklist whose completion guarantees reliability.

1. Natural language to tool calls

Translate a user’s request into structured intent the application can inspect. HumanLayer illustrates this with a payment-link request represented as fields for a Stripe API call. The example shows a design pattern; it is not a report of a tested product. Validate the proposed fields and apply application-defined rules before making a consequential API call.

2. Own your prompts

Keep instructions visible and editable as application code rather than hiding them behind abstractions that make behavior difficult to inspect. Treat prompts as part of the software you test, evaluate, and revise. This makes it easier for a team to understand what the model was asked to do when its output is unexpected.

3. Own your context window

Design the model’s input as an application-controlled representation of what happened and what matters next. Depending on the task, context may include instructions, retrieved documents, relevant history, workflow state, and tool calls and results. The design problem is not simply to include more text: select useful information, filter unsafe or irrelevant material, preserve error-recovery details, and use tokens efficiently.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Tools are just structured outputs

Separate the model’s choice of an action from the software’s decision to execute it. Treat a tool call as structured data describing intended work. Application code can validate it, reject it, ask for clarification, require approval, or map it to an allowed operation. This distinction keeps model output from becoming an unchecked command.

5. Unify execution state and business state

Where it simplifies the workflow, represent business history and execution details—such as the current step, wait status, or retry count—in a common serializable state model. HumanLayer presents this as an option, not a universal requirement. Sensitive credentials or session-specific details may need separate storage and access controls.

6. Launch, pause, and resume with simple APIs

Make workflows easy to start and inspect, and give them a way to pause for long-running work and resume when an external event arrives, such as a webhook. Preserve the ability to interrupt between a model’s proposed tool call and its execution. That seam is useful when new information, policy checks, or approval requirements arise.

7. Contact humans with tool calls

Represent requests for clarification, information, or approval as structured workflow events. For example, a deployment workflow can stop for human approval before a production release and resume after the response arrives. A human handoff is part of the designed workflow, not merely an error case.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

8. Own your control flow

Application code should decide when to continue, wait, ask a person, approve, retry, compact context, log, trace, or apply rate limits. The model may recommend a next action, but it need not own the conditions and policies governing every execution step.

9. Compact errors into context

When a tool fails, include a useful description of the failure in the workflow context so the model can propose a recovery action. Put bounds around recovery: track attempts and escalate to a person after a threshold rather than allowing repeated attempts to spin indefinitely. The guide’s point is to make errors actionable without letting the model retry without limit.

10. Small, focused agents

Give each agent a narrow responsibility and manageable context, then compose it with a larger, mostly deterministic system. Dex suggests “3–10, maybe 20 steps max” as a working scale for focused agents. That is his rule of thumb, not a benchmark or universal cutoff; choose scope based on the task and the controls it needs.

11. Trigger from anywhere, meet users where they are

Allow suitable work to start from user channels such as Slack, email, or SMS, as well as from non-human triggers such as events, scheduled jobs, or outages. Design how results and questions return to the user, including a human handoff when needed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

12. Make your agent a stateless reducer

This is the final factor named in the repository and the article’s table of contents, but the publisher article marks its discussion as “mostly just for fun” and offers little implementation detail. The title signals an interest in stateless, state-transforming design; the available explanation does not establish a fuller prescription, so teams should not infer a specific architecture from this factor alone.

Honorable mention: pre-fetch context

The repository also lists “Pre-fetch all the context you might need” as an honorable mention, not a numbered factor. It is a reminder to consider retrieving likely relevant information before a model step needs it, while still deciding what belongs in the actual context sent to the model.

How to apply the principles to an existing product

The factors are modular concepts, not a mandate to replace an application or adopt a particular agent framework. A team can start with one workflow where language understanding helps, while keeping authorization, side effects, and workflow progress in existing application code.

  1. Choose a bounded task. Pick a user need with a clear input, a limited set of possible actions, and a way to tell whether the result is useful.
  2. Define structured intent. Specify the fields the model may propose and the valid actions the application may carry out. Validate output before execution.
  3. Make prompts and context inspectable. Keep instructions editable and decide what relevant state, history, documents, and tool results the model receives.
  4. Keep execution under application control. Implement authorization, validation, side effects, retries, and rate limits in deterministic code. Decide explicitly where a human must clarify or approve.
  5. Persist what is needed to recover. Record enough state to inspect progress, handle a pause, and resume after an event or failure. Separate secrets where appropriate.
  6. Observe and refine the workflow. Log or trace decisions and outcomes, then use prompt tests and evaluations to find where context, validation, or control flow needs adjustment.

This sequence is an application of the guide’s principles rather than a prescribed implementation recipe. The sources do not report controlled performance comparisons or measured outcome statistics proving that the approach outperforms alternatives.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choosing between an open-ended loop and a controlled workflow

A long “loop until solved” can obscure where decisions, side effects, and retries occur. The Twelve-Factor Agents perspective instead makes the application responsible for the workflow and uses model steps where interpretation or generation is useful. The choice is not simply “agent framework versus no framework”; judge an architecture by how it handles the control points that matter to your product.

Design question What to examine
Prompt and execution control Can the team inspect and change prompts, validate model output, and control when proposed actions execute?
Workflow shape Does the system run an open-ended loop, or bounded model steps inside application-owned workflow logic?
Context and state How are relevant context and workflow state represented, persisted, inspected, and resumed?
Human intervention Can the workflow pause between a proposed action and its execution for clarification or approval?
Agent scope Is each task narrow enough for its context and responsibilities to remain manageable?

Workflow and DAG orchestrators can be adjacent building blocks for deterministic scheduling, retries, observability, and administration. HumanLayer names Apache Airflow, Prefect, Dagster, Inngest, and Windmill as examples, but does not provide a current feature or product comparison. These tools should not be assumed to implement all twelve factors or to be interchangeable; evaluate their current capabilities against the workflow you need.

How this relates to the original Twelve-Factor App

The original Twelve-Factor App describes a methodology for service software, with principles including explicit dependencies, environment configuration, stateless processes, portability, and logs as event streams. Its site names Adam Wiggins as author and gives 2017 as its last update. HumanLayer borrows the “factor” framing to discuss LLM application architecture; the sources do not describe Twelve-Factor Agents as an official extension of that methodology.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.