Elamur Research

TapeAgents: a Holistic Framework for Agent Development and Optimization

Paper · 2024 · Dzmitry Bahdanau, Nicolas Gontier, Gabriel Huang et al.

Summary

An agent can give a wrong answer even when every tool it calls works as expected. It may search for the wrong thing, overlook a result, or lose track of what the user asked it to do. Finding the failure takes more than reading the final answer. TapeAgents gives these intermediate decisions a common home. It stores a session as a tape, an ordered record of what the agent considered, what it asked the outside world to do, and what came back. The tape is also the state from which the agent continues. A developer who wants to investigate a decision can inspect the record immediately before it and start another run from that point.

The framework divides an agent into nodes. A node can prepare a prompt, turn the response into structured steps, or perform an ordinary computation such as choosing the next node. The agent adds its reasoning and requests to the tape. A separate environment handles requests such as searching for a document or asking the user a question, then adds the result. The same arrangement accommodates a team of agents, with the tape recording who has been called and whose turn it is to act. Metadata connects each generated step to the part of the agent that produced it and, where applicable, to the prompt and response behind it. The authors use these links in prototypes for inspecting, comparing, and debugging sessions.

The paper puts the tape to a second use in optimization. In a HotpotQA experiment, the authors turn successful sessions into demonstrations for individual prompt templates. The selected prompts improve both retrieval and answer accuracy for each of the tested backends. The authors also show how to reconstruct training examples from tapes for fine-tuning. Their main case study starts with a form-filling Teacher that uses several calls to interpret a user message, validate field values, and prepare a reply. A smaller Student learns from the Teacher’s recorded turns and performs the form-filling phase with a single, shorter prompt.

On 1524 unfinished conversations from held-out fictitious companies, human raters gave the fine-tuned Student a GREADTH score of 76.6%. This is the share of continuations meeting every criterion in the paper’s rubric. The Teacher scored 75.8% and the multi-node GPT-4o reference scored 74.9%. Using the paper’s retail pricing assumptions, the estimated cost per million turns was $85 for the Student and $28,157 for the Teacher. The comparison covers individual continuations in a simulated setting. It shows how a detailed record from an expensive workflow can help train a cheaper workflow with a different internal design.

Deep dive: TapeAgents: a Holistic Framework for Agent Development and Optimization

TapeAgents uses a structured session log to resume and debug agents, tune their prompts, and train a low-cost form-filling assistant. · about 34 minutes to read

The problem and its context

A session has decisions that its transcript leaves out

An agent may receive a request, decide which information it needs, call a tool, and revise its plan in response. The user sees the answer and perhaps part of the interaction. A developer investigating the answer needs to know what information reached the agent when it chose its next step. Tool results, task-specific state, intermediate decisions, and instructions can all matter. A record of the conversation captures some of this history. A sequence of raw calls captures another part. The challenge is to preserve enough of the session, at a level that software can use, to understand or repeat a decision.

The paper situates this problem in workflows that mix conventional software with calls to a large language model. Their behavior can vary because a generated response may change, because a remote service can return different information, or because a generated instruction fails to follow the format the application expects. A failure in one part of the workflow can also be hard to recognize until later. A tool may execute a valid request that asks for the wrong data. A reply based on that data may appear coherent. The authors show a question-answering session in their Tape Browser prototype where no step failed during execution even though the final answer was wrong.

The distinction matters for improvement as well as troubleshooting. Suppose a developer changes the instructions used to choose a tool. Rerunning the entire session may change the inputs to that choice. Starting again immediately before the call makes it possible to examine the new behavior with the earlier context held fixed. A developer may also want to gather successful decisions across many sessions and turn them into demonstrations for the component responsible. Both operations require knowing where a decision begins, what it consumed, and what it produced.

A session record designed for that work must preserve more than prose. A plan for gathering information, a request to fetch it, and the returned information have different roles in the execution. The framework needs to know which entry can trigger an external operation and which entry is context for the next decision. Training introduces another distinction. The instruction sent to a generator and the reply it should learn to produce must be recoverable even when the application represents that reply as several typed objects. TapeAgents brings these requirements together by making the agent’s state the same structured object that developers inspect.

Building agents and improving them

The authors describe existing frameworks as serving different parts of this work. LangChain and CrewAI help developers assemble workflows from reusable pieces. AutoGen offers a higher-level way to express teams whose members communicate. LangGraph gives developers fine control over a state machine, including facilities for resumption and concurrency. In the authors’ account, the gap is between infrastructure that makes an agent practical to run and infrastructure that makes its behavior amenable to data-driven changes. The team example is explicitly influenced by AutoGen.

The paper also describes approaches centered on optimization. DSPy represents calls through composable predictors and uses traces of program execution to support optimization. TapeAgents borrows the idea of specifying a prompt through its inputs, outputs, and demonstrations. The authors identify a state-management difference. When control passes between components through a general Python program, resuming at an intermediate point can require recovering the interpreter’s state. A tape can make the transitions between its components explicit as saved data. The connection is closest in the paper’s reimplementation of an example from DSPy.

The paper discusses TextGrad as another approach to improving prompts from data. Its relevance is that an agent can be treated as a collection of decisions to improve and that feedback may be useful at intermediate stages. The authors see typed steps as possible places to attach textual feedback. They present a TapeAgents implementation of feedback propagation as future work. Their discussion draws on TextGrad.

Earlier work on agent behavior gives the authors another reason to make intermediate steps visible. An agent can plan or reason before choosing an action. It can inspect a previous attempt and use what it finds to guide the next one. Alternating reasoning with action is especially relevant when a decision depends on a fresh result from a tool. TapeAgents can express these patterns through choices about nodes and step types. The patterns themselves precede the framework, as the discussion of ReAct and Reflexion makes clear.

The authors also distinguish the role of an execution framework from that of observability software. In their description, LangSmith and Langfuse let a developer instrument existing code to see what selected components are doing. TapeAgents makes the recorded state part of the execution contract from the start. That choice means the quality of the record depends on how the agent is written. Decisions that a developer represents as steps can guide resumption and be examined independently. The Python code inside a node still determines what computation happens and which results become visible at the next boundary.

The method, step by step

A tape grows as the agent works

A tape begins with whatever the agent needs to start or continue a session. For a conversational agent, the initial entry can be a user message. A node reads the tape and decides what to add. It might write a thought about the information it needs, followed by an action requesting that information. The environment fulfills the request and puts its observation on the tape. The next node can read the decision, the request, and the result. If the agent eventually sends a message back to the user, that too is an action. In an ongoing conversation, the user’s reply supplies another observation.

Thoughts, actions, and observations describe the roles of steps in execution. A thought can record a natural-language plan or a structured update to a form. An action asks for an interaction outside the agent’s reasoning loop. An observation carries information from the environment. Task designers declare the types of steps their application expects. A browser agent can represent pressing a key as a distinct action. A form filler can distinguish a proposed field value from the submission of the form. Tape types express the allowed kinds of entries, while the implementation uses a common class for the tape itself.

A node is a unit of work inside the agent. A typical node prepares a prompt for a single call and interprets the response. A node can also perform conventional computation without making a call. For instance, it can inspect a tape for an earlier form-selection action and use the result to decide where to send control. Keeping that decision at a node boundary lets the agent make it from the recorded session state.

How a TapeAgents session advances

The steps in order.

How a TapeAgents session advancesStep 1: Read the current tape1. Read the current tapeStep 2: Choose the active agent and node2. Choose the active agent and nodeStep 3: Build a prompt when needed3. Build a prompt when neededStep 4: Convert the reply into typed steps4. Convert the reply into typed stepsStep 5: Append thoughts and actions to the tape5. Append thoughts and actions to the tapeStep 6: Let the environment fulfill pending actions6. Let the environment fulfill pending actionsStep 7: Append observations and continue7. Append observations and continue

The root agent runs successive nodes while the agent has internal work to do. An action hands control to the environment. The orchestrator owns that handoff and can apply application-specific policies about continuation or termination. The authors supply a standard loop and expect some applications to provide their own. This division lets a developer change the orchestration without making every node responsible for deciding how external operations should be performed.

What a node receives and returns

The design is defined principally by software interfaces. The first interface lets a node construct the prompt for the current iteration.

def make_prompt(self, agent, tape) -> Prompt

def introduces the method and make_prompt names it. self is the node instance. agent is the agent running the node, and tape is the current session record. The parentheses enclose the inputs, commas separate them, and -> Prompt gives the return type. A node that needs only ordinary computation can produce a null prompt. The agent handles the call when a prompt exists. Given the same inputs, the node’s own prompt-building logic can behave deterministically.

The second interface turns the response into steps.

def generate_steps(self, agent, tape, llm_stream) -> Generator[Step | PartialStep]

Here generate_steps is the method that interprets a response. self, agent, and tape have the same meanings as in prompt construction. llm_stream carries the generated tokens, or is null for a node that made no request. Generator is an object that yields results as the node produces them. The square brackets describe the kinds of values it can yield, and | allows either of the listed kinds. A Step is a complete entry that can be appended to the tape. A PartialStep is a provisional result the application can receive while the response is still arriving.

This distinction gives interactive applications a way to display progress without storing each transient fragment as a separate part of the session. The agent exposes a stream of events, including partial results and tapes. A caller ultimately obtains the completed tape from that stream. The durable session consists of the completed steps even when the interface has displayed parts of them earlier.

The standard node order is sequential. A node can change the route by emitting SetNextNode, a step that identifies where execution should continue. A node may direct execution back to itself, for example, so an acting stage can issue a request, examine the resulting observation, and decide what to do next. Because the decision about where to go is explicit, a resumed agent can derive that route from the tape and configuration. Python remains available for the node’s internal work.

The environment has a corresponding interface.

def react(self, tape) -> Tape

react names the environment method. Here self is the environment instance and tape is the record it receives from the agent. Tape is the return type, with the returned record carrying the appended observations. The environment searches for actions that still need to be fulfilled. It can perform operations with side effects, wait for user input, or obtain data from an external service. The authors also put computationally heavy work on this side of the boundary. A node can then operate on the resulting observation without doing the outside work again as part of parsing a reply.

How a team shares a tape

Agents can contain subagents, and those subagents can have their own subagents. The resulting hierarchy has a root that chooses who will produce the next steps. The default delegation mechanism uses Call and Respond thoughts. A call names the intended agent and can carry a message. The latest agent called that has yet to respond gets control. When it adds a response, the caller becomes active again. The delegation change takes effect on the next agent iteration.

A single tape can therefore hold the work of the whole team. Each agent’s view controls which of those entries it uses. By default, the framework computes a stack of views for the outstanding calls. An agent’s view begins at the call that activated it and omits the internal work of agents it calls. The caller can see the response returned to it. Developers can define a different view, for example to give a subagent access to messages from its earlier assignments.

The financial analyst example makes the difference between tape and view concrete. The analyst can gather stock information and delegate web research to a search specialist. At step 16 in the illustrated session, the search agent’s view is at the top of the stack. At step 19, the analyst is the sole active agent with a view. The full tape contains what the specialist did. The analyst can continue from the specialist’s reply without putting the specialist’s search process into its own next prompt. A developer examining the tape can still follow the search steps and the returned evidence.

The example also distinguishes an internal call to a colleague from an external tool action. Delegation changes which member of the agent team will reason next. A tool request asks the environment to do work. The analyst example uses a tool-shaped choice to recognize an intended handoff, then translates it into a Call step. Requests for actual stock data or webpages go to the environment. The interpretation of a generated choice thus determines which side of the execution boundary handles it.

How steps lead back to prompts

Tape metadata records who produced a tape or its continuation and can store a parent tape identifier. Step metadata names the agent, the node, and the prompt associated with a generated step. The hierarchical agent name is useful when several team members have similar nodes. The prompt identifier distinguishes a particular execution of a node from another visit to that node in the same session. Several steps can come from the same execution.

The framework keeps the prompt and response associated with a call in an SQLite database. The identifier on the step connects the tape to that record. This lets the tape carry semantic entries such as a plan or a tool request without embedding the entire prompt each time. In debugging, a developer can start with an unexpected step, find the node that produced it, and inspect the instruction and reply for that execution.

The agent configuration also has a standard structure. It specifies the available backends, the prompt templates, the nodes, and the subagents. The authors use Pydantic to define and validate it. A prompt optimizer can locate a template in the configuration and identify which steps were produced by nodes using it. The structure also supports composing agents at different levels. A developer can replace a node inside an agent or change the collection of agents in a team.

Resumption, replay, and reconstruction make different uses of these records. To resume, the orchestrator starts from an intermediate tape and carries on. To test replay, the agent can use the earlier call outputs and observations, then check whether it produces the same tape. A difference exposes a change in how the same recorded inputs are processed. The authors also discuss reusing observations when evaluating a changed agent. That is informative when the new agent’s actions still fit those observations. A reply to a different question, for example, would be a poor substitute for the user’s next live response.

Turning a semantic record into training text

A normal execution goes from a prompt and generated response to the structured steps. For supervised training, the framework also needs the reverse operation. It needs to construct a response that would produce the desired steps when the receiving node interprets it.

def make_llm_output(self, agent, tape, index) -> LLMOutput

make_llm_output names the reverse method. self is the receiving node, agent is its agent, and tape contains the behavior to reproduce. index identifies the position in that record at which the relevant steps occur. LLMOutput is the response representation the method constructs. A trainable agent needs the relevant reconstruction behavior from all its nodes.

The agent’s make_training_text method reconstructs the calls and checks them by replaying step generation. For instance, a structured update that assigns a new form field value needs to be rendered into a response the target node can parse into that update. The check establishes that the reconstructed response generates the intended steps. It does not decide whether assigning the value was appropriate. That judgment comes from the task rules, data selection, or evaluation.

The reverse operation also explains how the authors can train a Student with a different node layout. Copying the Teacher’s raw replies would preserve boundaries that make sense for the Teacher’s several prompts. The target training example must make sense under the Student’s shorter prompt, which asks for the state changes, plan, and action together. By working from the structured behavior on the tape, the target agent can reconstruct calls appropriate to its own layout. The report says the tapes in the form-filling case could be reused as they were. It suggests that other kinds of transfer, such as moving between a single agent and a team, may require adapting tapes.

The paper includes prototypes that build on these interfaces. MonoAgent prompts an agent with the relevant tape and available step schemas, then uses schemas to interpret what comes back. TeamAgent demonstrates an initiator, a manager, and workers who communicate through a tape. LLMFunction gives prompt templates named inputs and outputs and room for demonstrations. These are examples of ways to organize an application on top of the core execution design. The authors present the implementation under the name TapeAgents and describe Studio, Tape Browser, and Tape Diff as prototypes for working with its records.

Tuning a retrieval workflow from successful sessions

In the HotpotQA example, the authors build a retrieval-augmented generation agent that writes search queries, retrieves Wikipedia passages, and answers a question using the resulting context. It makes two rounds of queries and retrieval before the short answer. The later query can draw on information retrieved by the earlier one. A null-prompt node removes duplicate passages. The other nodes use function-style templates that tell the generator what kind of result to produce and which entries from the tape to use as inputs.

To begin optimization, the agent runs on 50 examples from the HotpotQA training set. The authors discard tapes with an incorrect answer or repeated queries. From the remaining tapes, the procedure can extract demonstrations for the templates involved. A successful tape can show how a query-generation node turned the question and available context into a retrieval request. It can also show how the answer node produced a short answer from the collected passages. The prompts receive examples of the individual transformation they are meant to perform.

The authors try 10 combinations of 4 randomly selected good tapes. For each combination, they add demonstrations to the templates and judge the resulting agent on validation examples. They choose using the sum of retrieval accuracy and answer accuracy.

S = R + A

S denotes the validation score used to choose between candidate agents. R is retrieval accuracy, and A is answer accuracy on that validation data. The equals sign defines the score, and + adds the two values. The paper reports a mean accuracy in its results table, alongside the separate retrieval and answer metrics. The selected agent then runs on a set of 300 examples.

The implementation in the appendix goes through node executions and groups the demonstrations by template. It makes a copy of the agent and attaches selected demonstrations to that copy. A template can thus draw on the recorded executions that belong to it. The authors report that the demonstration-selection implementation took 12 lines of code. The resulting changes concern the examples shown in prompts, while the runtime still uses the same tape mechanism to represent what the agent does.

Designing the form filler and its Teacher and Student

The form-filling task is a conversation with a destination. The assistant needs to identify which request the user wants to submit, load the documentation for that request, gather the necessary values, and ask for confirmation before submission. The assistant can also close the conversation after confirmation when the user wants to leave. The experiment allows one active form at a time, so a request to switch after selection must be acknowledged within that constraint. Questions are answered from the documentation available for the selected form.

The paper calls the fields of a form slots, following work on task-oriented dialogue. A slot can have a type, allowed values, a default, or rules about whether it can be skipped. A user can provide several values at once, correct an earlier one, or ask what choices are available. The dialogue state therefore includes the selected form and the assignments and skips accumulated so far. The assistant should also explain changes to the user, which is especially relevant in an interaction where the user cannot see the form being updated. This framing draws on MultiWOZ and the Schema-Guided Dialogue Dataset.

The form-filler tape represents state changes and response plans separately. When the user proposes a new value, an update thought can record the assignment. If the value violates the documentation, a different thought can record what the agent should explain. Other thoughts say that the assistant should answer a question, request a missing field, or ask for confirmation. A thought that updates the form carries changes from the latest message. The full state can be read from the history of updates. This gives a developer something concrete to inspect if the final reply acknowledges a change that the structured state fails to record.

The Teacher has 7 nodes. The 2 concerned with intent check whether a form has already been chosen and handle discovery when needed. Discovery can request the available forms, identify the relevant one, and request its documentation. If the request cannot be matched to an available form, the agent can ask the user to clarify. Once a form is selected, the remaining 5 nodes decompose the form-filling work. One extracts candidate values from the user’s words. Another checks their types and whether the documentation permits them. The next records updates and considers how to answer any question. A further node plans what to ask for next, and the final node produces the action.

A form-filling action can send a message, submit the form, or end the exchange. During discovery, actions can also request form candidates and documentation. An action marks the point at which the environment takes over. The result of a form lookup can be appended as an observation and read by the next node. A message to the user allows the environment to return a new user message. The form logic can therefore respond both to tool results and to conversation in the same execution pattern.

The Student has 3 nodes in all. It retains the 2 devoted to intent and handles the form-filling phase through 1 additional node. The shorter prompt asks for the updates, response plan, and action together. The description “single-node” in the comparisons refers to this consolidated form-filling phase. The Teacher uses Llama-3.1-405B-Instruct-FP8, and the Student uses Llama-3.1-8B-Instruct. The Student prompt is compact but retains instructions about what behavior its generated steps should express.

Generating the dialogues and training the Student

The authors build fictitious enterprises so that the assistant has to choose among plausible forms and interpret their documentation. There are 6 companies. FlyCorp, BigBankCorp, and CoffeeCorp are training domains. DriveCorp, LuxuryCorp, and ShopCorp are testing domains. Generation starts with company descriptions, then produces 10 form names and descriptions per company. A further prompt turns each form description into a structured specification with input fields and a description of the submission result. The paper describes programmatic checks that generated material can be parsed in the expected format.

The form descriptions include company-specific policies and explanations that can be needed to answer questions. The schemas describe which user values are acceptable. Together they make it possible to present the assistant with choices that depend on the particular form. A categorical value that sounds plausible in ordinary conversation can still be invalid under the schema. An optional field and a required one can call for different replies to a request to skip them.

A fixed list of questions would leave out how users respond to the assistant’s choices. The authors therefore define 19 user-agent behaviors. Some produce an intent at the start of a conversation. Others answer the assistant, volunteer values for additional fields, change an earlier answer, ask a question about the form, or offer a mixture of valid and invalid information. A simulated user can act as part of the environment. When the assistant asks for a text reply, the simulator appends the next user message as an observation.

The authors build a tree of partial dialogues by alternating the Teacher and sampled user agents. A starting branch can contain just the assistant’s greeting. Each user response creates new context for a Teacher continuation. The generation procedure controls the tree’s width and seeks diversity in both user behavior and the forms being filled. Its beam width is 500. The dialogue limit is 18 turns, with up to 9 user messages and 9 assistant messages. Submission, cancellation, or a failure to produce a valid continuation can end a branch earlier. The paper reports roughly 13k training and 13k testing continuations per synthetic company.

The Student is fine-tuned on 13k Teacher continuations from training domains. This is the size reported for the training run, distinct from the generation counts reported per company. The authors use one epoch of LoRA, which adapts the underlying generator through low-rank updates. An epoch is a pass through the training examples. The batch size is 32, and the learning rate, which governs the size of optimizer updates, is written as follows.

η = 10⁻⁵

η is the learning rate. The equals sign assigns it the reported value, and the superscript ⁻⁵ is the exponent on 10. The optimizer is AdamW, associated with Decoupled Weight Decay Regularization. The authors say additional epochs did not appear to help.

Experiments and results

General question answering and browser work

The GAIA benchmark tests general assistant tasks. The paper’s agent has access to web search, Python execution, and tools for reading several file types. Its first stages are for planning. An acting stage can then repeat as tool results arrive. The output is a precise short answer, following the requirements of the benchmark. Accuracy compares that answer to the expected one. The authors present the validation results apart from the test results.

With GPT-4o, TapeAgent achieved 37.0% accuracy on validation and 33.2% on test. Magentic-1 with GPT-4o achieved 36.9% and 32.3% on the respective splits. The paper describes Magentic-1 as using an orchestrator, several executor agents, and a record of progress. TapeAgent’s results are slightly higher in that comparison. HuggingFace Agents with GPT-4o achieved 44.2% on validation and 33.3% on test. Langfun Agent v2.0 achieved 54.5% and 49.3%, leading the systems in the paper’s comparison on both splits.

A TapeAgent using GPT-4o-mini scored 27.3% on validation and 21.9% on test. The GPT-4 entry with manually selected plugins scored 14.6% on each split. Taken together, the figures show that the paper’s relatively simple agent can handle a share of GAIA tasks while leaving considerable room for improvement. The comparison involves implementations with different tools, instructions, and internal designs. It gives a practical reference point for the implementation and its benchmark setting.

The WorkArena experiment evaluates browser-based knowledge work on the benchmark’s L1 tasks. BrowserGym supplies the interface to a real browser. The authors define action types for operations such as hovering and pressing keys. The agent combines goal setting and reflection with an acting node, so observations from the browser can inform later decisions. The paper compares TapeAgents to Agentlab at each of the reported backend choices.

TapeAgents and Agentlab accuracy on WorkArena L1 tasks

TapeAgents has higher reported accuracy at each matched backend.

TapeAgents and Agentlab accuracy on WorkArena L1 tasksAgentlab GPT-4o: 42.7Agentlab GPT-4o42.7TapeAgents GPT-4o (this paper): 44.2TapeAgents GPT-4o (this paper)44.2Agentlab GPT-4o-mini: 23.0Agentlab GPT-4o-mini23.0TapeAgents GPT-4o-mini: 29.1TapeAgents GPT-4o-mini29.1
The numbers
System or settingaccuracy %
Agentlab GPT-4o42.7
TapeAgents GPT-4o (this paper)44.2
Agentlab GPT-4o-mini23.0
TapeAgents GPT-4o-mini29.1

With GPT-4o, the WorkArena L1 accuracy is 44.2% for TapeAgents and 42.7% for Agentlab. With GPT-4o-mini, the figures are 29.1% and 23.0%, respectively. Matching the backend keeps one prominent choice in common. Each score still measures a complete browser agent. The comparison shows what the implementations achieved, while the design contribution is that the browser workflow can be expressed through recorded observations, typed actions, and explicit transitions.

The data-science team is a demonstration of a different organizational pattern. A manager, a requestor, an asset reviewer, a code executor, and a software engineer work together on a plot that compares stock prices. The paper illustrates the team configuration and the tape resulting from that task. A reader can follow handoffs and distinguish the members’ internal work from calls or observations. The example has no comparative accuracy result. Its evidence concerns the ability to represent the team’s work on a shared, resumable record.

Retrieval prompts and math distillation

In HotpotQA, the authors report retrieval accuracy, answer accuracy, and mean accuracy after selecting prompt demonstrations on validation data and evaluating on 300 examples. Retrieval and answering are measured separately because retrieving useful material and giving the expected answer are distinct parts of the workflow. The final answer can fail after the retrieval stage has succeeded. A change to the query prompt can also affect how much evidence the answer prompt has to work with.

Mean retrieval and answer accuracy on HotpotQA

Adding selected demonstrations raises mean accuracy for every tested backend.

Mean retrieval and answer accuracy on HotpotQAGPT-3.5-Turbo without optimization: 43.7GPT-3.5-Turbo without optimization43.7GPT-3.5-Turbo with selected demonstrations (this paper): 51.8GPT-3.5-Turbo with selecteddemonstrations (this paper)51.8GPT-4o-mini without optimization: 48.8GPT-4o-mini without optimization48.8GPT-4o-mini with selected demonstrations: 53.8GPT-4o-mini with selected demonstrations53.8Llama-3.3-70B-Instruct without optimization: 44.3Llama-3.3-70B-Instruct withoutoptimization44.3Llama-3.3-70B-Instruct with selected demonstrations: 53.0Llama-3.3-70B-Instruct with selecteddemonstrations53.0
The numbers
System or settingmean accuracy %
GPT-3.5-Turbo without optimization43.7
GPT-3.5-Turbo with selected demonstrations (this paper)51.8
GPT-4o-mini without optimization48.8
GPT-4o-mini with selected demonstrations53.8
Llama-3.3-70B-Instruct without optimization44.3
Llama-3.3-70B-Instruct with selected demonstrations53.0

For GPT-3.5-Turbo, retrieval accuracy moved from 42.7% without optimization to 56.7% with it. Answer accuracy moved from 44.7% to 47.0%. For GPT-4o-mini, retrieval accuracy went from 50.3% to 57.0%, and answer accuracy went from 47.3% to 50.7%. For Llama-3.3-70B-Instruct, retrieval accuracy went from 53.7% to 57.7%, while answer accuracy went from 35.0% to 48.3%. The component scores show that the larger gain can occur at retrieval or at answering, depending on the backend. Both parts of the task improve in every reported comparison.

The math experiment uses tapes to train a smaller agent by distillation, meaning that it learns from a more capable Teacher’s examples. Both agents have a reasoning node and access to a calculator through the environment. The Teacher uses LLAMA3.1-70B and the Student uses LLAMA3.1-8B. The authors train on 3,000 samples made from 1,000 Teacher tapes. Reported Student performance rises from 66.2% to 77.5%, while the Teacher reaches 93.1%. The paper gives this as a short demonstration of the fine-tuning component. The result shows improvement within that example and leaves a substantial Teacher advantage.

What the form-filling score measures

The form-filling evaluation takes 1524 unfinished dialogues from the test domains and asks each evaluated agent to continue each one for a single turn. The authors control the mix of user behaviors and forms. They describe the 19 behaviors as mostly uniform in the sample and include 30 forms across 3 domains, together with dialogues in which a form has yet to be selected. Some turns therefore test intent discovery. Others test how the assistant handles a form already in progress. The comparison concerns what each agent does from these given histories.

Human raters label each continuation on the 6 criteria that make up GREADTH. Groundedness asks whether statements have support in the documentation, conversation, or description of the assistant’s role. Accuracy concerns selecting the correct form and making appropriate field updates. Discipline concerns following the response plan recorded in the thoughts. Transparency asks whether the assistant tells the user how the form changed. Helpfulness covers progress through the request and answers that the documentation supports. Responsiveness includes acknowledging what the user meant when they provide valid input, propose an invalid value, ask an unanswerable question, or make a request outside the assistant’s scope.

Several criteria can apply to the same turn. Suppose the user gives a valid value for one field and an impermissible choice for another. The assistant needs to record the valid assignment and avoid putting the invalid one into the form. It also needs to acknowledge what it did, explain the invalid choice, and move the dialogue forward appropriately. A single missed acknowledgment can affect how the turn is judged for both transparency and responsiveness. The criteria describe different responsibilities of the assistant, so a response can satisfy some while failing others.

The paper’s combined score requires all criteria to pass on the same turn.

GREADTH = G ∧ Re ∧ A ∧ D ∧ T ∧ H

GREADTH here is the binary result for an individual continuation. G represents groundedness, Re responsiveness, A accuracy, D discipline, T transparency, and H helpfulness. Each label has value 1 when the condition is satisfied and 0 when it fails. The equals sign defines the combined result. Each ∧ is a logical AND, so the combined result is 1 only when every term is 1. The reported percentages express how frequently that requirement was met across the evaluated continuations.

Invalid continuations are assigned 0 on every criterion. Examples include unparsable JSON, a response outside the schema, an attempt to assign an invalid value, or a submission with missing values. This means the reported results include failures to produce a usable action as well as failures in the quality of an otherwise valid continuation. The authors used Toloka labeling services and report that expert raters audited 10% of the labels.

Form-filling quality, token use, and estimated cost

The main test compares the fine-tuned Student with the Teacher, a multi-node GPT-4o reference, and variants that use different combinations of prompt design and backend without fine-tuning. The GPT-4o reference uses GPT-4o-2024-08-06. All entries in the chart are GREADTH percentages on the 1524 partial dialogues sampled from the test domains.

Human-rated GREADTH on held-out form-filling continuations

The fine-tuned Student reaches the range of the Teacher and the multi-node reference.

Human-rated GREADTH on held-out form-filling continuationsGPT-4o multi-node reference: 74.9GPT-4o multi-node reference74.9Llama-3.1-405B multi-node Teacher: 75.8Llama-3.1-405B multi-node Teacher75.8Llama-3.1-405B single-node zero-shot: 43.2Llama-3.1-405B single-node zero-shot43.2Llama-3.1-8B multi-node zero-shot: 36.6Llama-3.1-8B multi-node zero-shot36.6Llama-3.1-8B single-node zero-shot: 2.0Llama-3.1-8B single-node zero-shot2.0Fine-tuned Llama-3.1-8B single-node Student (this paper): 76.6Fine-tuned Llama-3.1-8B single-nodeStudent (this paper)76.6
The numbers
System or settingGREADTH %
GPT-4o multi-node reference74.9
Llama-3.1-405B multi-node Teacher75.8
Llama-3.1-405B single-node zero-shot43.2
Llama-3.1-8B multi-node zero-shot36.6
Llama-3.1-8B single-node zero-shot2.0
Fine-tuned Llama-3.1-8B single-node Student (this paper)76.6

The fine-tuned Student achieved 76.6%, compared with 75.8% for the Teacher and 74.9% for the GPT-4o reference on the same test continuations. For the Student, the paper reports groundedness of 92.1%, responsiveness of 86.4%, accuracy of 90.2%, discipline of 94.4%, transparency of 95.1%, and helpfulness of 87.1%. The combined score is lower than every component rate because the individual passes must coincide on the same turn. The paper treats the combined scores of the Teacher and fine-tuned Student as comparable in this setting.

The cost table reports mean input and output tokens per agent turn on the evaluation set. A Teacher turn uses 15,189 input tokens and 541 output tokens on average. A fine-tuned Student turn uses 1,441 input tokens and 110 output tokens. The GPT-4o reference uses 15,431 input tokens and 526 output tokens per turn. The multiple prompts used to perform the Teacher’s form-filling work carry considerably more input than the Student’s consolidated prompt.

The estimated cost combines token volume with the applicable retail price. The table reports $28,157 per million agent turns for the Teacher, $85 for the fine-tuned Student, and $43,837 for the GPT-4o reference. The paper uses retail prices available on October 3rd 2024. For its Llama configurations, it specifies $0.055 per million input or output tokens for Llama-3.1-8B-instruct and $1.79 for Llama-3.1-405B-instruct. The authors describe the Student as 300x cheaper than the Teacher under these assumptions. The comparison captures both the shorter turn and the lower rate charged per token.

What the ablations show

A compact prompt benefits from training

The cleanest contrast in the form-filling study holds the Student’s prompt design and Llama-3.1-8B-Instruct backend fixed and changes whether it has been fine-tuned. The single-node zero-shot Student scores 2.0% on the 1524 test continuations. The fine-tuned version scores 76.6%. A zero-shot condition here asks the configured agent to do the task without supervised tuning on the Teacher turns. The contrast shows that the compact instructions are insufficient on their own for the smaller backend in this evaluation. The trained variant can carry out the same sequence of state updates and response decisions with far greater success.

The cost estimates for these versions are $90 and $85 per million turns, respectively. The input lengths are 1,437 tokens per turn without tuning and 1,441 with tuning. The output lengths are 208 and 110 tokens per turn, respectively. The trained Student’s quality gain accompanies a shorter average output. These figures describe the resulting behavior of the two variants. They do not imply that reducing output length by itself would improve the quality of the zero-shot agent.

A comparison within the compact design changes the backend. Without fine-tuning, Llama-3.1-405B scores 43.2%, whereas Llama-3.1-8B scores 2.0%. The larger backend handles more of the task under the compact instructions. With task training, the smaller backend reaches 76.6% in that design. The comparison shows how much the ranking depends on whether the agents are asked to learn from examples or to perform the task from the supplied instructions alone.

Decomposition helps the zero-shot configurations

The paper also swaps the backend inside the multi-node workflow. The Teacher using the larger backend achieves 75.8% GREADTH. With Llama-3.1-8B-Instruct in the multi-node configuration and no fine-tuning, the score is 36.6%. The authors report 15,189 input tokens and 541 output tokens per turn for both of those entries in their cost table. The similar reported token volumes help distinguish the expense of the longer workflow from the capability of the backend running it. Keeping the workflow buys the smaller backend a stronger result than its compact zero-shot configuration, at greater estimated cost.

The comparison within the larger backend is also informative. Its multi-node configuration scores 75.8%, while its compact single-node version scores 43.2%. The reported cost estimates are $28,157 and $2,742 per million turns, respectively. These settings change how many calls perform the work and how detailed their instructions are. The comparison therefore supports the value of the complete decomposed design in this zero-shot setting. It cannot isolate the contribution of the verification node, the wording of the instructions, or the number of calls by itself.

The appendix includes another experiment used to select the Teacher’s design. The comparison is between a long, detailed prompt in a single node and a multi-node decomposition. It covers 1016 unfinished conversations from the test domains. Human-rated GREADTH across all behaviors is 69.39% for the long-node version and 78.54% for the multi-node one. This is a different comparison from the compact Student prompt in the main table. Both Teacher variants in the appendix are designed to give the task substantial guidance.

The behavior-level results explain why the aggregate is more useful than a blanket claim about decomposition. When users follow the expected path and answer a question correctly, the long-node configuration scores 72.58% and the multi-node one scores 89.25%. For the behavior that combines a correct value with an invalid categorical value, the scores are 62.22% and 77.78%. When a user supplies an invalid date, the long-node configuration scores 47.83%, and the multi-node one scores 19.57%. For a request to skip an optional field, both score 71.74%. The multi-node configuration performs better overall, with the outcome varying by the demands of the user turn.

What the other comparisons isolate

The HotpotQA comparison keeps the retrieval workflow and backend in place for each pair and changes whether the templates receive demonstrations selected from successful tapes. This makes it a direct test of the paper’s prompt-tuning procedure. The retrieval and answer metrics separately indicate where the new prompts help. GPT-3.5-Turbo shows the more pronounced change in its retrieval results. Llama-3.3-70B-Instruct shows the more pronounced change in its answer results. Since the procedure adds demonstrations to the templates involved in the workflow, the results cannot attribute the aggregate gains to a single template.

The math experiment compares the smaller agent before and after training on Teacher tapes. Its improvement establishes that those training examples can be used in a calculator-equipped reasoning workflow. The remaining difference from the Teacher shows that the form-filling result is specific to its setting. The paper’s benchmark comparisons serve a different role. GAIA and WorkArena place the implemented agents alongside existing systems. They do not remove tape metadata, disable resumption, or replace only the state representation while keeping every other part fixed.

Limitations

Limits the authors state

The implementation reported in the paper runs one node from one active agent at a time. The limitation applies even to a team whose independent pieces of work might be able to proceed concurrently. The authors identify coroutine implementations for the agent loop and the orchestrator as future work. Running team members in parallel on a shared tape would also require changes to how views are computed, so a member’s decision would use an appropriate portion of the evolving record.

The authors describe the low-code components and the development and optimization tools as early prototypes. The mini-frameworks show ways to compose nodes and agents, with some application-specific choices left to developers. The paper also describes plans for an online reinforcement-learning trainer and a possible implementation of textual feedback propagation. Those plans are distinct from the demonstrated optimization procedures, which include selecting prompt demonstrations and training on reconstructed text.

The authors point out that reusing historical observations has a validity condition. If a revised agent departs too far from the earlier session, the old observation may become implausible. This follows from how observations arise. A search result depends on the search request, and a user reply depends on the question the assistant asked. Replaying a known output for a test and feeding it to a changed agent as evidence of live behavior are different uses of the record.

The form-filling case deliberately narrows what the assistant can do. It handles a single selected form, answers from the form documentation, and restricts switching after the form has been selected. The authors also call their binary criteria crude measures of response quality. A continuation can meet the rubric while differing from another in readability or in how it chooses to present relevant facts. They suggest that preference judgments could complement the binary criteria for aspects such as fluency and verbosity.

The paper qualifies the cost estimate by noting that prefix caching could lower the cost of the Teacher. It also observes that much of the Teacher’s multi-node prompting depends on context. The quoted costs use a particular retail price snapshot and the input and output counts observed on the evaluation set. Changes in pricing and serving behavior affect the comparison. The table addresses inference charges for turns under its assumptions.

The authors specify that their detailed AutoGen comparison uses a version from before 0.4, which was released as the report was being written. Their feature judgments describe the versions and modes of use they discuss. The framework comparison is about the engineering support available under those conditions, including cases in which the authors believe that extra implementation work would be needed.

Limits implied by the experimental design

The headline form-filling experiment measures one continuation from each fixed prefix. That makes comparisons between agents easier to interpret because they see the same histories. It leaves open how the Student would perform over whole conversations generated under its own policy. A different question in an earlier turn might lead the user to offer different information later. Small mistakes in field state might compound. A test at a fixed prefix cannot measure how often a complete interaction reaches successful submission or how many exchanges it takes to get there.

The held-out companies test transfer across fictitious domains produced by a common generation procedure. The user behaviors are also simulated. Human raters judge the assistant’s continuations, which gives direct evidence about the rubric, while the interaction histories still come from the synthetic setup. The study therefore supports generalization across those test domains. It leaves open how the same assistant would handle actual enterprise documentation, employees who express goals outside the scripted behavior categories, or encounters where the available form itself is ambiguous.

The reported combined scores show that the Student, Teacher, and GPT-4o reference occupy a similar range on the evaluated set. The main comparison reports point estimates. The ranking of those estimates gives limited evidence about a stable advantage under a different sample of conversations. The important contrast is between the poor zero-shot compact configurations and the much stronger fine-tuned one, together with the estimated per-turn cost of achieving that result.

The cost table measures estimated serving charges from token counts. It provides no total that combines training, Teacher dialogue generation, human evaluation, and deployment. The smaller and larger configurations also run on different hardware in the study. The reported per-turn cost comparison does not provide a measured latency comparison or establish when the training investment would be recovered in a production service.

Finally, the usefulness of tapes depends on the abstractions an application chooses to expose. A recorded thought shows what the node emitted and what later steps could use. A reconstruction test shows that a particular response can reproduce those steps under the agent’s parser. Neither operation establishes that the emitted thought fully explains the generation process. The trace is most concrete as evidence about the workflow itself, including which instructions were sent, which structured decisions were emitted, and which external results reached the agent.

What came after

Simulated conversations and agent evaluation

APIGen-MT cites TapeAgents and addresses multi-turn data generation through simulated agent–human interaction. The overlap is the problem of constructing training data when the next user message depends on what the assistant has just done. TapeAgents uses that pattern to produce form-filling continuations from an expensive Teacher. APIGen-MT places multi-turn data generation at the center of its scope. The citation establishes the connection between the papers. It leaves open whether the later pipeline uses tapes, the same simulation procedure, or a different record of its dialogues.

Holistic Agent Leaderboard cites TapeAgents in work on evaluation infrastructure for agents. This brings the session-level question into a broader evaluation context. TapeAgents illustrates several kinds of evidence an evaluation system might need to interpret, including benchmark outcomes, a human rubric for individual turns, and the token cost of producing them. The later work’s stated subject is the infrastructure for agent evaluation. Its citation does not specify a transfer of the tape format or the GREADTH rubric.

Browser-based agents and verification during research

Coding Agents with Multimodal Browsing are Generalist Problem Solvers cites TapeAgents in work about combining coding agents with multimodal browsing. TapeAgents had already illustrated workflows that interleave generated decisions with browser operations, as well as an agent that can run Python in the course of answering questions. The relationship visible from the later work’s scope is an interest in agents that solve tasks through successive interactions with tools. The citation alone does not establish shared browser tooling, state representation, or evaluation results.

Inference-Time Scaling of Verification cites TapeAgents and studies test-time, rubric-guided verification for deep research agents. TapeAgents makes intermediate decisions and observations addressable as steps and discusses how nodes can support self-evaluation. Its form-filling rubric is used to assess generated continuations. The later work’s stated focus is verification during inference, when the agent is still doing the task. The citation connects these interests in inspecting and evaluating agent behavior. The particular verification procedure and its relationship to tapes remain unspecified by that connection.

Cite

Cite as Dzmitry Bahdanau, Nicolas Gontier, Gabriel Huang, Ehsan Kamalloo, Rafael Pardinas, Alexandre Piché, Torsten Scholak, Oleh Shliazhko, Jordan Prince Tremblay, Karam Ghanem, Soham Parikh, Mitul Tiwari and Quaizar Vohra. 2024. TapeAgents: a Holistic Framework for Agent Development and Optimization. arXiv (Cornell University).

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.48550/arxiv.2412.08445 · arXiv 2412.08445

@misc{bahdanau2024tapeagents,
  title = {{TapeAgents: a Holistic Framework for Agent Development and Optimization}},
  author = {Dzmitry Bahdanau, Nicolas Gontier, Gabriel Huang, Ehsan Kamalloo, Rafael Pardinas, Alexandre Piché, Torsten Scholak, Oleh Shliazhko, Jordan Prince Tremblay, Karam Ghanem, Soham Parikh, Mitul Tiwari and Quaizar Vohra},
  year = {2024},
  doi = {10.48550/arxiv.2412.08445},
  eprint = {2412.08445},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.48550/arxiv.2412.08445}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/bahdanau-2024-tapeagents-holistic-framework-agent-development/