Summarize with AI:
As an AI engineer (the new full-stack developer), you need to understand an agent’s components through task execution, plus how the system retains progress and coordinates the work.
An AI agent is a system that uses a model to choose actions toward a goal and adjust its next steps based on the results. The model is one component of the agent, supported by tools and software that manage execution and keep track of progress.
In What Makes an Application Agentic?, we explored what changes when a model can direct part of a task. In this article, we’ll look at an agent’s components and follow a task through execution, including how the system retains progress and coordinates the work.
Consider the project management application from the previous article, where a support feature investigated failed data exports. The same application could also prepare release status reports.
A team lead asks what work remains for an upcoming release and whether anything is blocked. An agent checks the task records and drafts a report with links to the relevant tasks for the team lead to review.
The model needs descriptions of the operations it can request, while application code handles execution. The following components share that work:
| Component | Responsibility | In the Release Reporting Feature |
|---|---|---|
| Model | Interprets available information and selects a next step | Decides which task needs a closer look |
| Instructions | Describe the goal and how the agent should approach it | Ask for a report grounded in task records, with unresolved questions identified |
| Tools | Expose operations the model can request | List tasks for a release or retrieve a task’s details |
| Task state | Records information about the work in progress | Retains the selected release and the task records already examined |
| Runtime | Manages execution around model calls | Checks tool requests, obtains results and decides whether execution can continue |
We can implement the runtime in our backend or use a framework or hosted service. Instructions can tell the model to respect access restrictions, but the code handling a tool request must enforce them.
The model choice, instructions and available tools form part of the agent’s reusable configuration. We’ll use run to mean one attempt to carry out a task using that configuration. The same release reporting agent could prepare reports for different releases, with each run having its own request and execution history.
An agent loop repeatedly calls the model with the information gathered so far. If the model requests a tool, the runtime checks the request and executes the permitted operation, then supplies its result in the next model call. If the model produces an answer, the runtime can return it to the user and end the loop.
For the release report, the loop shown above could work as follows:
Start the run. The application records the team lead’s request and the release identifier. The runtime supplies these to the model along with the reporting instructions and available tool definitions.
Request the release tasks. The model selects list_release_tasks with the release identifier as an argument. The runtime validates the request and obtains the tasks through an operation that enforces the team lead’s access rights.
Return the result to the model. The runtime records the tool result and supplies it in the next model request. The returned list includes a blocked task that is waiting for another task to finish.
Check the blocking task. The model requests get_task_details for that related task. After the request is checked and executed, the result shows that the task is still in progress.
Prepare the report. The model summarizes the unfinished work and identifies the task holding up the blocked work. It links to both records so the team lead can check the details.
In pseudocode, the runtime’s execution loop could look like this:
context = [instructions, user_request]
for step in 1..max_steps:
response = call_model(context, tool_definitions)
context.append(response)
if response.is_final_answer:
return response.answer
for call in response.tool_calls:
validate(call, tool_definitions, user_permissions)
result = execute_tool(call)
context.append(tool_result(call.id, result))
return needs_attention("Step limit reached")
The validate check must succeed before a tool runs. It checks that the tool is available, its arguments are valid, and the user has permission to perform the operation. Each result is paired with its tool call so the model can use it in the next iteration. The max_steps limit bounds the number of model calls in this loop.
A tool definition describes what the operation does and the arguments it accepts. For get_task_details, that means specifying a required task identifier and explaining what the lookup returns.
The result from list_release_tasks should distinguish an empty task list from a permission error or service timeout. Otherwise, the model could interpret a failed lookup as evidence that there is no unfinished work.
We also need to distinguish requesting an operation from completing it. The execution record should show what actually ran and what it returned. A model saying that it checked a task is not evidence that the lookup succeeded.
The loop describes how the agent takes steps, but a run also needs a beginning and a clear outcome. Some runs finish within one request to the application. Others need to pause for input or continue as background work.
For the reporting feature, we might track a run as running, waiting for input, completed, failed or cancelled. These are states we choose for the application rather than a universal set of agent statuses. Their purpose is to make the task’s condition visible to the runtime and the person using the feature.
If the request doesn’t identify a release clearly, the runtime can pause while the team lead selects one. Saving the run’s state lets execution resume when that input arrives. Waiting for a person doesn’t require keeping a model request open the whole time.
Execution limits provide another way to end a run. We can cap tool calls or set a time budget so a run cannot continue indefinitely. A service outage might leave the report incomplete, so the UI should explain what information could not be retrieved.
Producing a final response doesn’t by itself establish that the task succeeded. The runtime can check that a report has the required fields and valid task references. The team lead still needs to review whether the report’s explanation is supported by those records.
Continuing a run requires retaining more than its latest response. The short-term memory used during a task can include previous tool results and findings that later model calls need. The application also tracks execution state, such as which operation is pending and whether the run is waiting for input.
For the release report, the retained information should include the release identifier and the task records already retrieved. It should also retain which task is holding up the blocked work, so later model calls can use that finding without repeating the lookup.
Stored state and model context serve different purposes. State holds information the application retains, while context is the information supplied for a particular model call. We might store all retrieved task records but send only the relevant records and a summary of earlier findings in the next request. Keeping the original records available lets us check details that a summary leaves out.
If a run needs to survive a process restart, its state must be saved to durable storage. We can save a checkpoint that records pending work alongside accumulated state, allowing execution to continue from that point. Conversation history alone may not tell the runtime which operation still needs to finish.
Preserving a run so it can resume is different from long-term memory, which retains selected information for use across tasks or sessions. A team’s preferred report format could be reused across future reporting runs. The current status of a release should still come from its task records, and long-term memory isn’t required to complete an individual report.
An agent run often forms part of a larger application workflow. Orchestration is the logic that coordinates model calls and tools with the rest of that workflow. The runtime carries out this logic, including when to continue execution or wait for input.
Orchestration applies to both single-agent and multi-agent systems. We can implement the coordination in application code or use a framework to handle parts of it.
For release reporting, the application might always validate the selected release before starting the agent and save the resulting draft afterward. Within those fixed steps, the model chooses which task details to inspect. If several requested lookups are independent, the runtime could execute them concurrently and associate each result with the correct request.
Error handling also belongs in this coordination. A temporary service error may justify a limited retry, while an access restriction needs to be resolved before retrying the same request. The runtime can enforce retry limits and end the run if requests keep failing.
Some features benefit from delegating work to more than one agent. A larger reporting feature might assign separate agents to inspect different projects before combining their findings. Each would need a defined scope and a clear way to pass results back. We would also need to decide what happens if one cannot finish. A single agent is a reasonable starting point until separate responsibilities justify that additional coordination.
Understanding an agent means being able to follow a task through the system. We should be able to explain what information the model received, which operation it requested and what result informed the next step.
Saved state allows that work to continue, while orchestration manages how it fits into the application’s workflow.
For more on building AI-powered applications and agents with Progress, check out the following resources:
Hassan is a senior frontend engineer and has helped build large production applications at-scale at organizations like Doordash, Instacart and Shopify. Hassan is also a published author and course instructor where he’s helped thousands of students learn in-depth frontend engineering skills like React, Vue, TypeScript and GraphQL.