Search

Search papers and lessons

Agent-Computer Interface

Level 3 · 11 min read

An agent-computer interface is the set of commands a language model agent can use and the format of the feedback it gets back, and its design can change how well the agent works without retraining the model.

On this page

  • Colour = topic mix
  • Calculus
  • Discrete math
  • Neural network basics
  • Linear algebra
  • Probability
  • Language & LLMs
  • ReadReady to readNot yet

TL;DR

An agent-computer interface (ACI) is the layer between a language model agent and the software it works in. It has two parts: the commands the agent is allowed to use, and the format in which the program reports back what happened. Designing that layer well can make an agent much more effective, and it does so without changing the model's weights.

Builds on: LLM Agent, Tool Use · Leads to: SWE-agent

Where it's used

Automated software repair. The SWE-agent paper gives an agent a code repository and asks it to fix a reported bug. The agent searches the code, opens files, edits them and runs tests. The commands it uses for those steps, and the text it reads back after each one, form the ACI. The paper reports that the agent resolved 12.47% of 2,294 real GitHub issues in the SWE-bench test set, using GPT-4 Turbo as the base model.

Browser and desktop agents. An agent that clicks through a web page or a desktop app meets the same design choices. Should it see the raw page structure, or a summary? Should one action click and read the result, or should it take a series of small steps? Each answer is an interface decision.

Customer and internal tools. An agent that looks up orders, reissues refunds or updates records works through an API. A tool that returns every field of a record, when the agent needs two, costs context and makes the next step harder. The same question applies: what does the agent see, and what can it do?

How it works

Trace one small edit from start to finish. This is an illustration, not a measured run. The goal is to change one line in a six-line file. The agent has two possible interfaces, and we compare them.

  1. The goal and the commands. The agent is told to change line 4 of config.txt from debug = true to debug = false. In interface A it has only a shell, where it can run any command. In interface B it has an open command that shows a window of the file with line numbers, and an edit command that takes a start line, an end line and the replacement text.
  2. Interface A, step 1. The agent runs cat config.txt. The shell prints all six lines with no line numbers. Check: the agent has the text, but it must still work out which line is line 4.
  3. Interface A, step 2. The agent writes a sed command to replace the text. It gets the quoting wrong, and the shell prints an error. Check: one wasted step, and the file has not changed.
  4. Interface A, step 3. The agent tries again with a corrected command. The file changes. The agent runs cat once more to confirm. Check: four actions in total.
  5. Interface B, step 1. The agent runs open config.txt. The window shows lines 1 to 6 with numbers, and the total line count. Check: the line number is visible to the agent.
  6. Interface B, step 2. The agent runs edit 4 4 "debug = false". The program replaces line 4 and immediately shows the updated window. Check: the change and its result are in one step, and the agent does not need a confirmation command.

The model, the task and the goal are the same in both runs. Only the commands and the feedback differ. Interface B used two actions where interface A used four, and the agent could see its own change without asking for it.

flowchart LR
  M["Language model"] -- "thought and action" --> I["Agent-computer interface"]
  I -- "command" --> E["Software: files, shell, browser"]
  E -- "raw output" --> I
  I -- "formatted observation" --> M

The interface sits in the middle of this loop. It decides which actions exist, how each action is described, how the output is trimmed and labelled, and what happens when an action is malformed. The agent loop is the same for every design; the ACI is what changes.

The math

The loop can be written as a function, in the form of a partially observed decision process with a fixed policy. Let hth_t be the history at step tt, the list of earlier actions and their formatted observations. Let ata_t be the action the model picks, and oto_t the observation the program returns.

at=π(g,  Doc(A),  Hist(ht−1)),ot=Φ(st,at)a_t = \pi\big(g, \; \mathrm{Doc}(\mathcal{A}), \; \mathrm{Hist}(h_{t-1})\big), \qquad o_t = \Phi(s_t, a_t)

In words: the model's choice ata_t depends on the goal gg, the documentation of the allowed commands A\mathcal{A}, and the history after an optional compression Hist\mathrm{Hist}. The observation oto_t is the result of applying the action to the environment state sts_t, formatted by Φ\Phi. The ACI consists of the command set A\mathcal{A}, the documentation Doc\mathrm{Doc}, the history policy Hist\mathrm{Hist} and the formatter Φ\Phi. The model π\pi is fixed. The documentation Doc\mathrm{Doc} is placed in the prompt, so the model learns the commands from it in context, as in in-context learning.

Step 2 in symbols: a command set

An action set is a list of named commands with their arguments. Interface B has three: open(path), edit(start, end, text) and scroll(direction). Interface A has one, shell(command), whose documentation covers many options. Fewer, simpler commands make A\mathcal{A} smaller and the documentation shorter, which is the first principle SWE-agent reports.

Step 3 in symbols: the history policy

The history grows by one observation per step. Suppose there are mm observations, each of about LL tokens, and the policy keeps the most recent kk in full and collapses each older one to a line of about cc tokens. The context size is

T=kL+(m−k)c.T = kL + (m - k)c.

The arithmetic is illustrative, not from a paper. With m=20m = 20 observations of L=500L = 500 tokens each, keeping all of them in full costs 20×500=10,00020 \times 500 = 10{,}000 tokens. Keeping the last k=5k = 5 in full and collapsing the other 15 to c=20c = 20 tokens each costs 5×500+15×20=2,8005 \times 500 + 15 \times 20 = 2{,}800 tokens. The model sees less old text and still has the plan and the list of past actions.

Step 6 in symbols: the feedback

The formatter Φ\Phi decides what the agent sees after an action. If an edit succeeds, a good Φ\Phi shows the updated lines. If the edit breaks the code, it shows the error next to the changed lines and discards the edit. Writing this as a rule: the observation should contain the state change that matters and no more.

Worked examples

Example
1. Counting the actions

Two interfaces are used to change one word in a file.

  1. Interface A needs a cat to read the file, a failed sed because of quoting, a corrected sed, and a cat to check. That is 4 actions.
  2. Interface B needs an open to see the file with numbers, and one edit that shows the result. That is 2 actions.
  3. Ratio: 2 divided by 4 is one half, so the second interface uses half the actions for this change.
  4. Interpretation: the commands did not change what the agent could do. They changed how many steps the same change took, and each wasted step adds context and cost.
Example
2. Search results, one at a time or all at once

A search for a function name returns 40 matches across the repository. Two result interfaces are possible.

  1. Iterative: the agent sees the first match and runs next to see each one. Viewing all 40 takes 40 actions, plus the reading between them.
  2. Summarised: the program returns one list of all 40 file names and line numbers, with a note on how to narrow the query. The agent picks the three likely files and opens only those. That is 1 search action plus 3 opens.
  3. Interpretation: the summarised view takes 4 actions where the iterative view could take 40. The paper reports that agents given a long list of matches tended to inspect every match, which costs budget, so the summary is a design response to that habit. The numbers here are illustrative; the paper compares interfaces with its own measurements.
Example
3. A realistic benchmark result

SWE-agent resolved 286 of 2,294 SWE-bench test tasks, with GPT-4 Turbo as the base model. The paper reports 12.47% for this. A previous best of 3.8% came from a non-interactive, retrieval-augmented system.

  1. Check the first figure: 286 divided by 2,294 is 0.1247, which is 12.47%.
  2. Find the number of tasks the previous best solved: 3.8% of 2,294 is about 87.
  3. Find the difference: 286 minus 87 is about 199 more tasks solved.
  4. Interpretation: the two systems also differ in more than the interface, so the gap is not all due to the ACI. The paper's own ablations on a 300-task subset are what isolate the interface's contribution.
  5. Try it: the paper's Lite split has 300 tasks, and the reported resolve rate for SWE-agent on it is 18.00%. How many of the 300 tasks is that? Answer: 0.18 times 300 is 54 tasks.

Common mistakes and tradeoffs

It is tempting to think that a better model makes a better interface unnecessary. In fact a capable model still loses steps to a poor command set, misreads output that is too long, and repeats a search that gave it nothing useful. Interface design and model quality are separate levers, and the paper shows the interface lever working with a fixed model.

It is also tempting to think that more commands always give the agent more power. In fact each command adds documentation to read, choices to make and failure modes to handle. The paper's principle is that simple commands with a few options are easier for agents to use, and that consolidating related steps into one command reduces the number of turns.

A third mistake is to design the interface for a human. A human can scan a long shell output and notice what matters. A model reads all of it at equal cost, and it can be misled by irrelevant matches. Paths that suit a human, such as a chain of cd, ls and cat, can be slow for an agent. The paper argues for interfaces built around what the agent needs.

When to invest in an ACI: when the agent works in a software or data environment with many steps, when outputs are long, and when errors can be caught by the program before they reach the agent. When not to: for a single question with one tool call, the interface is too small to matter. Alternatives include simply giving the model a richer prompt or a retrieval step, described in retrieval-augmented generation, which changes what the model knows rather than how it acts. A retrieval step can use a ranking function such as BM25, which is what the paper's non-interactive baseline used.

History

Interfaces for people have been studied for decades in human-computer interaction, where designers measure how easily users complete tasks in a given program. The idea of designing for a non-human user is newer. The SWE-agent paper, posted in May 2024, introduced the term agent-computer interface and showed that changes to commands and feedback improved a language model's performance on software engineering tasks without retraining it. Since then the idea has spread to coding, browsing and desktop agents, although the design of each one remains a matter of experiment.

Recap

  • An agent-computer interface is the commands an agent can use plus the format of the feedback it receives.
  • The loop of thought, action, observation is the same for every interface; the ACI changes the actions and the feedback.
  • Simple commands, consolidated multi-line edits, concise feedback and guardrails such as a syntax check each reduce wasted steps.
  • Keeping the recent history in full and compressing older observations keeps the context small.
  • Read next: SWE-agent, which applies these principles to repository repair, and ReAct Prompting, which describes the thought and action pattern the agent uses inside the interface.

Check yourself

QuestionIn one sentence, what are the two parts of an agent-computer interface?Show answer
The set of commands the agent can use, and the format in which the program returns the results of those commands.
QuestionAn interface needs 4 actions for a task that a redesigned interface does in 2. What is the reduction in actions, as a fraction of the original?Show answer
The reduction is 4 minus 2, which is 2. As a fraction of the original 4, that is 2 divided by 4, or one half. The model is the same, so the difference comes from the interface.
QuestionA history holds 20 observations of 500 tokens each. The policy keeps the last 5 in full and collapses the other 15 to 20 tokens each. How many tokens does the context take, and why is that useful?Show answer
5 times 500 is 2,500, and 15 times 20 is 300, so the total is 2,800 tokens, against 10,000 without compression. The model keeps the recent results and the list of earlier actions, and it spends less of its context on old output.
QuestionWhy would a model that can read a long shell output still do better with a summarised search than with a long raw list?Show answer
Reading is not the same as using. A long list of matches invites the agent to inspect each one, which costs steps and budget. A summary with a list of files and a note on how to narrow the query lets the agent act on the likely matches first.
QuestionYour team wants a coding agent to edit files more reliably, but the model is fixed. Name one interface change and explain how it would be checked.Show answer
One candidate is an edit command that replaces a line range and shows the updated file, which removes a separate confirmation step. It would be checked by comparing the number of actions and the rate of successful edits on the same set of tasks, with and without the change, holding the model fixed.

Sources