AI Engineer World's Fair 2025

12-Factor Agents: Patterns of reliable LLM applications

Read the talk

12-Factor Agents: Patterns of Reliable LLM Applications

Dex Horthy reduces an agent to structured model output, deterministic execution, explicit state, and a controlled loop—then shows where small doses of model judgment outperform a free-running agent.

From a talk by Dex Horthy

At a glance

Ideas worth remembering

  • Use an agent only where model-driven judgment adds value. If the correct procedure is already an exact sequence, deterministic code may be faster to build and easier to trust.

  • Treat tool use as structured model output followed by application-controlled execution. Own the dispatcher, loop, branching, and termination rules.

  • Persist execution and business state outside the model so long-running workflows can pause, receive callbacks, and resume through ordinary APIs.

  • Context engineering means selecting and representing prompts, history, memory, retrieval, results, and errors—not filling the largest available context window.

  • Embed focused three-to-ten-step agent loops inside deterministic workflows, with explicit human clarification, correction, and approval paths.

  • Prefer tooling that generates inspectable, owned scaffolding and removes peripheral work without hiding prompts, context, state, or control flow.

The prototype works—until reliability matters

Agent frameworks can get a project to an exciting 70–80% quality bar quickly. The trouble begins when the remaining failures matter to customers. Horthy describes tracing through seven layers of a call stack just to discover how a prompt was assembled or how tools reached the model. At that point, the abstraction that accelerated the prototype can obstruct the work required to make it dependable.

Captures the Makefile example as Horthy contrasts two hours of agent prompting with a Bash script that could be written in roughly 90 seconds.
Captures the Makefile example as Horthy contrasts two hours of agent prompting with a Bash script that could be written in roughly 90 seconds.

His early DevOps agent supplied the cleanest warning. He gave it a Makefile and permission to run Make commands, but it executed the build steps in the wrong order. Two hours of prompt editing eventually specified the exact sequence. The resulting agent could follow the procedure, but the same procedure could have been a Bash script written in about 90 seconds. Once judgment has been designed out of a task, deterministic code is usually the simpler implementation.

Conversations with more than 100 founders, builders, and engineers led Horthy to a less theatrical model of production agents: they are mostly ordinary software with LLM decisions inserted where language understanding or flexible judgment earns its cost. Teams were not necessarily replacing their applications with new agent stacks. They were adding small patterns to existing code.

The resulting 12-Factor Agents guide is therefore neither a demand for greenfield rewrites nor an attack on frameworks. Horthy treats it as a wish list for tools that preserve development speed while exposing the prompts, state, context, and control flow builders need to improve reliability.

0:150:45
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

0:15 · section reference included

A tool call is JSON followed by ordinary code

The first useful primitive is natural language converted into structured data. A model receives a sentence and emits JSON describing an intended action. That conversion is separate from execution: the application still decides how to validate, dispatch, and run the requested operation.

Illustrates the naive agent loop: event, model-selected action, result appended to context, and repetition until completion.
Illustrates the naive agent loop: event, model-selected action, result appended to context, and repetition until completion.

This is the point behind Horthy’s deliberately provocative claim that “tool use” can be a harmful abstraction. He is not objecting to agents acting on external systems. He is objecting to language that makes the mechanism seem magical. The model emits JSON; deterministic code interprets it using a loop, switch statement, API client, or other familiar construct; the application may then return the result to the model.

The naive agent loop is compact: receive an event, ask the model for the next step, execute it, append the result to context, and repeat until the model says the task is done. The sequence generated during one run becomes a materialized graph, but the developer did not define that graph in advance.

Longer workflows expose the cost of that simplicity. Every result expands the context, and merely having room for a very large prompt does not guarantee a tight or reliable decision. Horthy’s claim is practical rather than benchmarked here: limiting and controlling the tokens sent to the model generally produces better results than indiscriminately accumulating history.

A useful working definition follows. An agent consists of four owned parts:

  • Prompt: instructions for choosing the next step.
  • Dispatcher: deterministic code that interprets the model’s structured output.
  • Context builder: the logic that selects and represents what has happened.
  • Loop controller: the rules for continuing, branching, summarizing, switching strategies, or stopping.

Owning these pieces lets the application add explicit breaks, branches, summaries, and model-based checks instead of accepting an opaque loop.

How it fits togetherThe agent loop without the mystique

A user message, outage, or prior tool result supplies the current task state.

The model proposes a structured next action. Application code executes it, curates the resulting context, and decides whether another iteration should run.

3:444:14
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

3:44 · section reference included

Persist state so long-running work can disappear and return

Once the loop is explicit, execution state and business state can live together in application-owned storage. Execution state includes the current step, next step, and retry counts. Business state includes messages, user-visible data, and approvals the workflow is waiting to receive. Keeping both available makes the agent’s progress inspectable in the same terms as the product experience.

Useful state-model frame distinguishing execution state—steps and retries—from business state such as messages, displayed data, and approvals.
Useful state-model frame distinguishing execution state—steps and retries—from business state such as messages, displayed data, and approvals.

That state also enables ordinary launch, pause, and resume APIs. Put the agent behind a REST API or MCP server. When it starts a long-running operation, interrupt the loop and serialize its context into a database. The external operation eventually calls back with a state ID and result. The application reloads the stored state, appends the result, and invokes the model again.

The model does not need to remain alive or remember that asynchronous work occurred. From its perspective, the next invocation simply contains the prior state plus a new result. Durability belongs to the application, not to the model process.

How it fits togetherPause and resume a long-running agent operation

A REST or MCP request launches the workflow.

Application-owned state lets the model loop stop while external work runs, then resume from a callback without relying on model memory.

7:147:44
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

7:14 · section reference included

Reliability is largely a context-construction problem

Prompt-generating abstractions can provide an excellent starting point, but Horthy expects teams pushing beyond an initial quality threshold to inspect and edit the prompt directly. His argument is about experimental control: if model output depends on the input tokens, builders need enough access to vary those tokens, compare alternatives, and evaluate which construction works best.

Provides the concrete error-handling lesson: do not blindly accumulate failures or full stack traces in the context window.
Provides the concrete error-handling lesson: do not blindly accumulate failures or full stack traces in the context window.

Context deserves the same ownership. A standard messages array is one representation, not a law. An application can model events, conversation history, retrieved material, memory, and business state however it wants, then serialize the relevant information into one or more model messages. The goal is to communicate what happened so far with high density and clarity.

This folds several commonly separated mechanisms into one engineering problem:

  • Prompt instructions define the decision the model should make.
  • History records relevant prior actions and outcomes.
  • Memory carries selected information across interactions.
  • Retrieval inserts external material needed for the present decision.

All four ultimately become tokens in the current model input. The architecture may distinguish them for storage and maintenance, but the model receives a constructed context.

Errors show why indiscriminate history is dangerous. Returning a failed tool call and its error can help the model repair an invalid API request or respond to a temporary outage. Continually appending failures, however, can trap the loop in stale error context. Horthy recommends clearing pending errors after a valid action, summarizing prior failures when useful, and omitting entire stack traces unless their details actually help select the next step.

8:148:44
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

8:14 · section reference included

Put people in the control flow, then keep autonomy small

Human contact should be a first-class action rather than an exceptional escape hatch. Horthy recommends giving the model distinct intents such as completion, clarification, or escalation. Expressing that intent in natural language also moves an important choice to the beginning of generation, where the model decides what kind of interaction it needs before producing the rest of the action.

Shows the deployment example returning to deterministic production tests or handing failure to a separate rollback agent.
Shows the deployment example returning to deterministic production tests or handing failure to a separate rollback agent.

The interface should meet people where they already work. Email, Slack, Discord, and SMS can carry approvals and corrections without forcing every user to keep another ChatGPT-style tab open. This does not make channel delivery trivial, but it treats human participation as part of the workflow rather than a handoff outside it.

The architectural companion is the small, focused agent: a loop of roughly three to ten steps embedded inside a mostly deterministic directed graph. Conventional code handles the predictable pipeline. The model handles a bounded region where natural-language interpretation, reprioritization, or recovery is useful.

HumanLayer’s deployment bot illustrates the pattern. Deterministic CI/CD code waits until a GitHub pull request is merged and development tests pass. A focused deployment agent then proposes the next action. If it proposes the front end first, a human can respond that the back end should go first. The model converts that correction into structured workflow state, proposes the back-end deployment, waits for approval, executes it, and then returns to the front end.

After successful deployment, deterministic code resumes and runs end-to-end tests against production. If deployment fails, a separate rollback agent can take over its own bounded responsibility. Horthy characterizes the resulting system as manageable even when the overall product has many tools and steps, because each agent receives a limited context and a clear job.

More capable models may gradually absorb larger parts of these pipelines. Horthy expects the boundary to move: start with deterministic software, insert LLM decisions, and expand their scope as reliability improves. The durable skill is learning to operate near the boundary of what a model can do consistently, then using prompts, context, state, control flow, and human judgment to make that difficult capability dependable.

How it fits togetherA focused deployment agent inside deterministic CI/CD

Deterministic CI/CD reaches the deployment decision point.

The model handles a bounded sequencing decision and accepts human correction; conventional code owns the surrounding pipeline and production tests.

11:1311:43
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

11:13 · section reference included

Keep the model stateless and make the scaffolding yours

Horthy’s last factor describes the agent as effectively stateless: the application owns and supplies the state required for each step. He notes that the reducer terminology is imperfect for a multistep process, but the implementation lesson survives the naming dispute. Durable memory, workflow progress, and business records should not depend on an in-memory model session.

That preference shapes his desired tooling. Rather than a wrapper around hidden internal behavior, he wants generated scaffolding that developers can inspect, modify, and keep. The team was working on Create Twelve-Factor Agent with this model: generate an understandable starting structure, then let the developer own the resulting code.

The ending sharpens the division of labor. Supporting tools should remove peripheral operational work, leaving builders time for the difficult AI-specific decisions: prompt construction, context selection, control flow, and human collaboration. A framework that hides those decisions may remove precisely the controls needed to cross the production reliability gap.

Horthy also points to work on an A2H Protocol intended to consolidate how agents contact humans. That proposal remains only briefly described in the recording. The supported design principle is narrower: people improve agents when clarification, approval, and intervention are available through explicit actions and familiar communication channels.

The practical conclusion is intentionally ordinary. Use a model where converting language into a structured decision creates value. Keep state and execution in software you control. Build the smallest useful loop, let people participate, and expand autonomy only when the surrounding system can preserve reliability.

14:1314:44
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

14:13 · section reference included

Resources

From the talk

  • The public guide containing all twelve factors, examples, and project materials discussed in the talk.

  • The speaker profile supplied with the recording.

Read the complete timestamped transcript
  1. 0:00

    [upbeat music] Who here is building agents?

  2. 0:17

    Who here is-- leave your hand up if you built, like, ten plus agents. Anyone here built, like, a hundred agents? All right, we got a few. Awesome. Love it.

  3. 0:26

    Um, so I think a lot of us have been on this journey of building agents. Um, and what happened with me was, you know, I decided I wanted to build an agent.

  4. 0:33

    We figured out what we wanted it to do. Uh, we wanna move fast. We're developers, so we use libraries. We don't write everything from scratch. Um, and you get it to, like, seventy, eighty percent.

  5. 0:41

    It's enough to get the CEO excited and get six more people added to your team. But then you kinda realize that seventy, eighty percent isn't quite good enough, and that if you wanna get past that seventy, eighty percent quality bar, you're seven layers deep in a call stack trying to reverse engineer how does this prompt get built

  6. 0:57

    or how do these tools get passed in? Where does this all come from? Uh, and if you're like me, you eventually just throw it all away and start from scratch.

  7. 1:03

    Um, or you maybe even find out that this is not a good problem for agents. I remember one of the first agents that I tried to build was, uh, a, a DevOps agent.

  8. 1:11

    I was like, "Here's my Makefile. You can run make commands. Go build the project." Couldn't figure it out. Did all the things in the wrong order. I'm like, "Cool, let's fix the prompt."

  9. 1:18

    And I-- Over the li-- next two hours, had more and more detail about what everything was and every single step and the exact-- And it's like I got to the point where I was like, "This is the exact order to run the build steps."

  10. 1:27

    It was a cool exercise, but at the end of it, I was like, "You know, I could have written the bash script to do this in about ninety seconds."

  11. 1:33

    Not every problem needs an agent. Um, and so I've been on this journey. I think a lot of you have been on similar journeys. Um, and what happened was is I went and talked, um, in trying to help people build better, more reliable agents.

  12. 1:46

    I talked to a hundred plus founders, builders, engineers, um, and I started to notice patterns. One was that most production agents weren't that agentic at all. They were mostly just software.

  13. 1:58

    But that there were these core things that a lot of people were doing. There were these patterns that were making their LLM-based apps really, really good. Um, and none of them were doing kind of a greenfield rewrite.

  14. 2:08

    Rather, they were taking these small modular concepts that didn't have names and didn't have definitions, and they were applying them to their existing code. Um, and what's really cool about this is I don't think you need an AI background to do this.

  15. 2:18

    This is software engineering 101. Well, probably not 101. But just like Heroku cr-- needed to define what it meant to build cl-- We didn't even call them cloud native back then, but this was how you built applications that could run in the cloud ten years ago.

  16. 2:32

    Um, I decided to put together what I thought would be the twelve factors of AI agents, um, from everything that I've seen working in the field. Um, so we put up this GitHub repo.

  17. 2:42

    You can go read it. Um, turns out a lot of other people agreed and felt the same thing. Um, so we were on the front page of Hacker News all day, two hundred K impressions on social.

  18. 2:51

    Uh, I'm just gonna put this one up and no comment.

  19. 2:55

    Um, and just for context, we got to, like, four thousand stars in, like, a month or two. Uh, there's fourteen active contributors. Um, it's very easy to read that thing and, and hear the talk and say like, "Oh, we're here.

  20. 3:06

    This is the anti-framework talk." I am not here to bash frameworks. I would think of this as much as anything as a wish list, a, a list of feature requests, is how can we make frameworks serve the needs of really good builders who need a really high reliability and wanna move fast still?

  21. 3:23

    Um, so what am I here to do? Uh, I want you to kind of forget everything you know about agents and kind of rethink from first principles how we can apply everything we've learned from software engineering to the practice of building really reliable agents.

  22. 3:36

    Um, so we're gonna mix the order up a little bit. If you want all twelve factors in order, that's a thirty-minute talk, so we're gonna bundle some stuff together.

  23. 3:41

    There will be a QR code at the end. You can go dig through it, uh, at your leisure. Um, factor one, the most magical things that LLMs can do has nothing to do with loops or switch statements or code or tools or anything.

  24. 3:53

    It is turning a sentence like this into JSON that looks like this. Doesn't even matter what you do with that JSON. Uh, those are what the other factors are for.

  25. 4:01

    But if you're doing that, that's one piece that you can bring into your app today. Um, factor four, this leads right to, uh... Did anyone read this paper, uh, "GOTO Considered Harmful," or maybe just heard about it?

  26. 4:11

    I never actually read it. Uh, but it was all about we had this abstraction in the C programming language and a bunch of other programming languages at the time that said, "This thing GOTO, it makes code terrible.

  27. 4:21

    It's the wrong abstraction. It-- No one should use it." I'm gonna go ahead and go out on a limb here and say tool use is harmful. And I put it in quotes because I'm not talking about giving an agent access to the world.

  28. 4:31

    Obviously, that's super badass. But what I think is making things hard is the idea that tool use is this magical thing where this ethereal alien entity is interacting with its environment.

  29. 4:42

    Because what is happening is our LLM is putting out JSON. We're gonna give that to some deterministic code that's gonna do something, and then maybe we'll feed it back.

  30. 4:50

    But again, those are other factors. So if you have structures like this and you can get the LLM to output something that generates them, then you can pass it into a loop like this or a switch statement like this.

  31. 5:00

    There's nothing special about tools. It's just JSON and code. Uh, that's factor four. Factor eight, and these are-- we're gonna do a couple kind of bundled together here. Owning your control flow.

  32. 5:11

    Um, and I wanna take a step back and kinda talk about how we got here. Um, we've been writing DAGs in software for a long time. If you've written an if statement, you've written a directed graph.

  33. 5:20

    Uh, code is a gr-graph. You may also be familiar with DAG orchestr-- Anyone ever use, like, Airflow or Prefect or any of these things? Um, so, like, this kind of concept of breaking things up into nodes gives you certain reliability guarantees.

  34. 5:32

    But what agents were supposed to do, and I think a lot of people talk about this, and I think in some cases this is realized, is you don't have to write the DAG.

  35. 5:39

    You just tell the LLM, "Here's the goal," and LLM will find its way there. And we model this as a really simple loop. You know, your LLM is determining the next step.

  36. 5:48

    You're building up some context window until the LLM says, "Hey, we're done."

  37. 5:53

    Um, so what this looks like kind of in practice is, you know, you have an event come in, you pass it into your prompt, uh, it says you wanna call an API, and you get your result, put that on the context window, pass the whole thing back into the prompt.

  38. 6:05

    This is like the most naive, simple way of building agents. And the LLM's gonna call a couple steps, and then eventually it's gonna say, "Cool, we've done all the tasks from the initial event," which maybe was a user message asking it to do something, maybe it's an outage, um, but then we get our final answer.

  39. 6:20

    And our materialized DAG is just these three steps in order. Um,

  40. 6:25

    turns out this doesn't really work, uh, especially when you get to longer workflows. Mostly it's long context windows. There's o- other reasons you could poke at as well. Um, and people say, "Oh, like even as...

  41. 6:34

    Like anyone put like two million tokens into Gemini before and like tried to see what happens?" Like you can do it. You'll get an answer. The API will return you something.

  42. 6:42

    But I don't think anyone will argue with you that you will always get s- like tighter, better, higher reliability results by controlling and limiting the number of tokens you put in that context window.

  43. 6:52

    Um, so it doesn't quite work, but we're gonna use that as our abstraction to build on. What's an agent really? You have your prompt, which gives instructions about how to select the next step.

  44. 7:01

    You have your switch statement, which takes whatever the mo- model output JSON, uh, and does something with it. You have a way of building up your context window, and then you have a loop, uh, that determines when and where and how and why you exit.

  45. 7:13

    Um, and if you own your control flow, you can do fun things like break and switch and summarize and LLM-as-judge and all this stuff. Um, and this leads right into kind of how we manage execution state and business state of our agents.

  46. 7:25

    Um, a lot of tools will give you things like current step, next step, retry counts, all these like DAG orchestrators. They'll have these kind of concepts in them. Um, but you also have your business state.

  47. 7:32

    What are the messages that have happened? What data are we displaying to the user? What things are we waiting on approval for? Um, and we wanna be able to launch, pause, resume these things like we do for any standard APIs.

  48. 7:43

    Um, this is all just software. And so if you can put your agent behind a REST API or an MCP server, um, and manage that loop in such a way that normal request comes in and we load that context window to the LLM, um, we're gonna allow our agent to call long-running tool.

  49. 8:00

    So we can interrupt the workflow, serialize that context window straight into a database, 'cause we own the context window. We'll get into that. Um, and then when we launch the workflow, um, eventually it's gonna call back with that state ID and the result.

  50. 8:12

    We use the state ID to load the state back out of the database, and then we can append the result to the prompt and then send it right back into the LLM.

  51. 8:19

    The agent doesn't even know that things happened in the background. Um, agents are just software, so let's build software. Um, and building really good ones ne- requires a lot of flexibility, and so you really wanna own that inner loop of, of how all that stuff is fitting together.

  52. 8:33

    Um, that's unifying. That's pause and resume. Uh, factor two, this one is I think most people find first, is like you really wanna own your prompts. There's some good abstractions that if you don't wanna spend a lot of time handwriting a prompt, you can put stuff in and you'll get out, um, a really good set of primitives,

  53. 8:51

    um, and a really good prompt. Like this will make you a banger prompt that like you would have to go to prompt school for like three months to build a prompt this good.

  54. 8:58

    But eventually, if you wanna get past some quality bar, you're gonna end up writing every single token by hand. Um, because LLMs are pure func- functions, and the only thing that determines the reliability of your agent is how good of tokens can you get out.

  55. 9:11

    And the only way-- The only thing that determines the tokens you get out other than like retraining your own model and something like that is being really careful about what tokens you put in.

  56. 9:20

    Um, I don't know what's better. I don't know how you want to build your prompt, but I know the more things you can try and the more knobs you can test and the more things you can evaluate, the more likely you are to find something really, really good.

  57. 9:29

    Um, owning your prompts. You also wanna own how you build your context window. Um, so you can do the standard OpenAI messages format, or in this moment where you're telling the LLM, pick the next step, your only job is to tell it what's happened so far.

  58. 9:41

    You can put all that information however you want into a single user message and ask, "Hey, what's happening next?" Or put it in the system message. So you can model your event state, your thread model however you want, um, and stringify it however you want, and some of the traces that we use and some of the agents

  59. 9:55

    we build internally, I'll get into that in a sec, um, might look like this. Um, but if you're not looking at every single token and if you're not optimizing the density and the clarity of the way that you're passing information to an LLM, you might be missing out on upside on quality.

  60. 10:11

    So LLMs are pure functions. Token in, tokens out, and everything, everything in making agents good is context engineering. So you have your prompt, you have your memory, you have your RAG, you have your history struct.

  61. 10:22

    It's all just how do we get the right tokens into the model so it gives us a really good answer and solves the user's problem. Solves my problem mostly.

  62. 10:28

    Um, I don't know what's better, but I know you wanna try everything, um, so that's own your context building. Um, this one's a little controversial. Uh, that's why it's a, it's a standalone factor, and the way you make it good is by integrating it with other factors.

  63. 10:42

    But you could, um, when the model screws up and it calls an API wrong or it calls an API that's down, um, you could take the tool call that it made and grab the error that was associated with it, put that on the context window, and have it try again.

  64. 10:56

    Anyone ever had a bad time with this?

  65. 10:59

    Seeing like this thing just like kinda spin out and like go crazy and lose context and just get stuck? Um, that's why you need to own your context window.

  66. 11:07

    Don't just blindly put things on. If you have errors and then you get a valid tool call, clear all the error-- pending errors out. Summarize them. Don't put the whole stack trace on your context.

  67. 11:15

    Figure out what you wanna tell the model so you get better results. Um, contacting humans with tools. This one's a little subtle, um, but I've seen... This is just like what I've seen in the wild.

  68. 11:24

    Almost everybody is like avoiding this very important choice at the very beginning of output where you're deciding between tool call and message to the human. Um, if you can push that emphasis to a natural language token, you can, one, give the model different ways.

  69. 11:38

    You can be, "I'm done," or, "I need clarification," or, "I need to talk to a manager," or whatever it is. And two, you push the intent on that first token generation and the sampling to something that is natural language that the model understands.

  70. 11:51

    Um, so your traces might look like this if you're pulling in human input here. Um, this lets you build outer-- outer loop agents. I'm not gonna talk about this.

  71. 11:57

    If you go on the site, there's a link to this, this post. I've written a lot about this. Um, I don't know what's better, but you should probably try everything.

  72. 12:05

    Um, that's contacting humans with tools. It goes right along with trigger things from anywhere and meet users exactly where they are. People don't wanna have seven tabs open of different ChatGPT-style agents.

  73. 12:15

    Just let people email with the agents you're building and let them Slack with the agents you're building, Discord, SMS, whatever it is. We see this taking off all over the place.

  74. 12:23

    Um, and you should have small focused agents. So we talked about this structure and why it doesn't really work. So what does work? Um, the things that people are doing that work really well are micro agents.

  75. 12:33

    So you still have a mostly deterministic DAG, and you have these very small agent loops with like three to ten steps. We do this at HumanLayer. We have a bot that ran- manages our deployments.

  76. 12:42

    Most of our deploy pipeline is deterministic CI/CD code. But when we get to the point where the GitHub PR is merged

  77. 12:50

    and the tests are passing on development, excuse me,

  78. 12:55

    we send it to a model and say, "Get this thing deployed." It says, "Cool, I'm gonna deploy the front end." Uh, and then you can send that to a human.

  79. 13:00

    A human says, "Actually, no, do the back end first." This is taking natural language and turning it into JSON. That is the next step in our workflow. Um, back end gets proposed, that gets approved, it gets deployed.

  80. 13:10

    Then the agent knows, okay, I have to go back and deploy the front end. Once that's all done and it's successful, we go right back out into deterministic code.

  81. 13:17

    So now we're gonna run the end-to-end test against prod if it's done. Otherwise, we hand it back to a little rollback agent that is very similar on the inside.

  82. 13:25

    Um, I'm not gonna go into it, but here's it working in our Slack channel. Um, yeah, hundred tools, twenty steps, easy, um, manageable context, clear responsibilities. Um, a lot of people say, "What, what, what if LLMs do keep getting smarter?

  83. 13:37

    What if I can put two million tokens in and it can do it?" Um, and I think we very much will see something like this where you start with a mostly deterministic workflow and you start sprinkling LLMs into your code, into your back end, into your logic.

  84. 13:51

    Over time, the LLMs are able to do bigger, more complex tasks until this whole API endpoint or pipeline or whatever it is, is just run by an agent. That's great.

  85. 14:00

    Uh, but you still wanna know how to engineer these things to get the best quality. This is someone from NotebookLM, and it's basically their take, and I think they did this well, is find something that is right at the boundary of what the model can do reliably, like that it can't get right all the time.

  86. 14:13

    And if you can figure out how to get it right reliably anyways because you've engineered reliability into your system, then you will have created something magical, and you will have created something that's better than what everybody else is building.

  87. 14:25

    So that's small focused agents. There's a meme here about stateless reducers. I guess someone actually tweeted at me, it's not a reducer, it's a transducer because there's multiple steps.

  88. 14:33

    Um, but basically, agents should be stateless. You should own the state, manage it however you want. Um, so we're all still finding the right abstractions. Um, there's a couple blog posts I link in the paper, um, w- frameworks versus libraries.

  89. 14:45

    There's a really old one from RubyConf about like, do we want duplication or is like, do we wanna fi- try to figure out these abstractions? Um, if you wanna make a Twelve-Factor agent, we are working on something called Create Twelve-Factor Agent because I believe that what agents need is not Bootstrap.

  90. 15:00

    You don't need a wrapper around an internal thing. You need something more like shadcn, which is like scaffold it out, and then I'll own it, and I'll own the code and I'm okay with that.

  91. 15:09

    So in summary, agents are software. You all can build software. Anyone ever written a switch statement before? [laughing]

  92. 15:16

    While loop? Yeah. Okay, so we can do this stuff. LLMs are stateless functions, which means just make sure you put the right things in the context, and you'll get the best results.

  93. 15:23

    Own your state and your control flow and just do it and just understand it 'cause it's gonna give you flexibility. And then find the bleeding edge. Find ways to do things better than everybody else by really curating what you put into the model and how you control what comes out.

  94. 15:38

    Um, and my take, agents are better with people. Find ways to let agents collaborate with humans. Um, there are hard things in building agents, but you should probably do them anyways, at least for now, and you should do most of them.

  95. 15:49

    Um, I think a lot of frameworks try to take away the hard AI parts of the problem so that you can just kinda drop it in and go, and, uh, I think it should be the opposite.

  96. 15:59

    I think the tools that we get should take away the other hard parts so that we can spend all our time focusing on the hard AI parts, on getting the prompts right, on getting the flow right, on getting the tokens right.

  97. 16:09

    So the reason why I'm here is like I do run a small business. Um, we have a startup where we try to help you do... A lot of what we do, we do in the open is open source, and I think it's really important, and we need to work on it together.

  98. 16:21

    There's some other things that are hard but not that important and not that interesting, so that's what we're solving at HumanLayer. Um, working on something called A2H Protocol. Come find me if you wanna talk about this, but this is a way to get like consolidation around how agents can contact humans.

  99. 16:36

    Um, but mostly I just love automating things. I've built tons and tons of agents internally for my personal stuff, for finding apartments, for all kinds of internal business stuff we do at HumanLayer.

  100. 16:45

    Um, so thank you all for watching. Let's go build something. I'll see you in the hallway track. Uh, I'd love to chat if you wanna riff on agents or building or control flow or any of this stuff.

  101. 16:56

    That's Twelve-Factor Agents. [audience clapping] [upbeat music]