# How the Work Gets Done

In the previous note, we looked at how to distinguish an AI assistant from an AI agent.

An assistant helps us do something. An agent is entrusted with doing something.

But once we hand over a task, what actually happens?

A request doesn't simply go into a model and come back as a completed result. Something has to manage the execution, run operations, collect their results and decide what happens next.

I wanted to look more closely at how this works.

## Looking inside the loop

Developer tools are a good place to start because they make the execution process relatively easy to observe.

Consider a coding agent such as mini-SWE-agent. Give it a software issue and ask it to make the necessary changes. It can inspect the repository, execute commands, examine the output, make changes and run tests.

What makes mini-SWE-agent interesting is how little is hidden behind the experience.

The model receives the task and the available context. It proposes a Bash command, the execution environment runs it, and the resulting output is added back to the conversation. The model then decides what to do next.

This continues until the model submits a result or the execution reaches one of its configured limits. <sup>[1]</sup>

There are a few distinct responsibilities here.

The model decides which operation to perform. The runtime manages the execution loop and keeps track of limits such as the number of steps, accumulated cost and elapsed time. The execution environment actually runs the commands and returns their output.

The feedback loop is relatively straightforward. The model proposes a command, observes what happened and decides whether to continue, change its approach or stop.

A test suite can provide a useful signal here. If a test fails, the model can inspect the output and try another change. If it passes, the result provides some evidence that the change worked.

But even here, there is a distinction between the agent deciding that it has finished and establishing that the task was completed correctly. A submission signal tells the runtime to stop. It doesn't guarantee that the underlying fix is correct.

There are other ways to arrange this loop too. Pi, for example, describes itself as a minimal and extensible agent harness. It deliberately leaves some capabilities, such as planning and subagent coordination, to extensions rather than making them mandatory parts of the core. <sup>[2]</sup>

The interesting part isn't necessarily how much functionality a particular harness contains. It is how the responsibilities are divided between the model and the software running around it.

## When business rules enter the loop

Now move away from a local codebase and consider a customer asking a business to cancel a subscription.

The work might involve identifying the customer, retrieving subscription details, checking eligibility, making a change in an external billing system and communicating the result.

Intercom's Fin Procedures provide an example of how such work can be organised.

A business can define a procedure using instructions, conditions and connections to external services. Fin interprets the instructions and handles the conversation, while the procedure determines which steps are available and when they should run.

One detail I find particularly interesting is how Intercom handles conditions.

A business might need to check whether an order is within a particular period, whether it has already been fulfilled or whether a customer meets the requirements for a refund.

These rules can be evaluated using Python code conditions rather than relying on the model to interpret a natural-language instruction every time.

The code condition evaluates a boolean result. It determines which branch should be followed, but it doesn't perform the actual operation itself. That is handled by the configured procedure steps and data connectors. <sup>[3]</sup>

Data connectors provide access to external APIs. A procedure might retrieve a customer's subscription details, make a request to cancel it, or update information in another system.

The response from a connector becomes available to subsequent steps in the same procedure. Fin can use that information as context without having to retrieve it again at every step. <sup>[4]</sup>

There are also points where execution can pause.

A procedure can wait for an external system to send a webhook or ask a teammate to review and approve something before continuing. <sup>[5]</sup>

The model still has a role in interpreting the customer's request and working through the procedure. But some decisions have been moved into deterministic code, and access to external systems is provided through configured connectors rather than an unrestricted execution environment.

The execution arrangement has changed because the environment has changed.

## When the customer stays in the loop

DoorDash provides another interesting example, this time from consumer software.

Consider asking Ask DoorDash to build a grocery list for two people, with a vegetarian preference and a budget of $60.

Behind what looks like a simple conversational request, the agent retrieves consumer preferences, looks for suitable stores, examines available products and prices, and assembles a shopping list.

DoorDash describes a representative grocery request that involves 6 to 8 LLM calls and several tool calls against its live catalogue. The process can take around 20 to 30 seconds. <sup>[6]</sup>

But what happens after the list is generated is just as interesting.

DoorDash describes the shopping list as an artifact with three different readers: the service that stores it, the agent that works with it and the customer who interacts with it.

The service holds the complete list as structured JSON. A typical list can be 40–60 KB in size.

The agent doesn't need all of that information on every turn. It receives a much smaller summary, around 240 characters, containing the store and the contents of the list.

The customer sees something different again: an interactive shopping interface with products, prices, quantities and alternatives. <sup>[7]</sup>

The same list is represented differently depending on who needs to use it.

There's another detail worth noticing.

A customer can remove an item, change its quantity or swap it for another product directly through the interface. These changes update the underlying artifact without requiring another model call.

When the customer later asks the assistant to add something to the list, the agent works with the updated version rather than relying on an older conversation message.

The model doesn't have to perform every operation simply because it was responsible for creating the list in the first place.

The customer also retains control over the transition from a proposed list to an actual shopping cart. They review the list and explicitly choose to add it to the cart before proceeding to checkout. <sup>[7]</sup>

DoorDash has also found opportunities to move some of the work out of the live model loop altogether.

Reordering groceries is a good example. Historical purchasing patterns change relatively slowly, while prices and inventory need to be checked against the live catalogue.

Rather than reconstructing all of that information every time someone asks to reorder their usual items, DoorDash moved some of the historical reasoning into an offline process. The remaining work can then resolve those preferences against current inventory.

For that particular reorder path, DoorDash reports reducing the time required to produce a list from roughly 16 seconds to roughly 2 seconds. <sup>[8]</sup>

A free-form request might require several rounds of model reasoning. A routine reorder can take a more deterministic path. A simple change to an existing list might not require the model at all.

## Where the responsibilities sit

In mini-SWE-agent, the model decides which commands to execute, while the runtime manages the loop and the environment executes those commands.

In Intercom, the model works within business-defined procedures, deterministic conditions and configured connections to external systems.

In DoorDash, the model can assemble a shopping list, but the application owns the underlying artifact, the interface handles simple edits, and the customer decides when to commit the result to a cart.

The responsibilities are distributed differently in each case.

The same is true of verification. A coding agent can run tests and inspect their results. A customer support procedure has to rely on business rules and responses from external systems. A shopping assistant needs to work with current product information and give the customer a meaningful way to review its suggestions.

What counts as a successful result depends on the work being performed and the environment in which it happens.

Perhaps that is the more useful way to look at AI agents. Not as models that independently do everything, but as systems that organise work across models, software, services and people.

An agent may decide what needs to happen next, but that doesn't mean it has to execute every operation itself. Nor does it mean it owns all the state involved in completing the task.

---

Once we start looking at the execution this way, another set of questions emerges.

Where does the runtime live? How does state survive when an execution is interrupted? Whose permissions are used when an agent interacts with an external service? And what happens when something fails halfway through?

Those are questions worth looking at separately.

## References

<sup>1</sup> mini-swe-agent - [Github](https://github.com/SWE-agent/mini-swe-agent)

<sup>2</sup> Pi - [Github](https://github.com/earendil-works/pi)

<sup>3</sup> How to write code conditions for Fin Procedures - [Intercom](https://www.intercom.com/help/en/articles/13459814-how-to-write-code-conditions-for-fin-procedures)

<sup>4</sup> How to use Data Connectors in Fin Procedures - [Intercom](https://www.intercom.com/help/en/articles/13459820-how-to-use-data-connectors-in-fin-procedures)

<sup>5</sup> Building Fin Procedures - [Intercom](https://www.intercom.com/help/en/articles/13449439-building-fin-procedures)

<sup>6</sup> Building DoorDash Assistant: An Engineering Overview - [DoorDash](https://careersatdoordash.com/blog/building-doordash-assistant-an-engineering-overview/)

<sup>7</sup> Building Ask DoorDash (Part 5): A Grounded Interface for Shopping Agents - [DoorDash](https://careersatdoordash.com/blog/building-ask-doordash-part-5-a-grounded-interface-for-shopping-agents/)

<sup>8</sup> Building Ask DoorDash (Part 6): A Grocery Reorder Case Study - [DoorDash](https://careersatdoordash.com/blog/building-ask-doordash-part-6-grocery-reorder-case-study/)
