HyperAgent: turn “which tool next?” into “which requirement is missing?”
A tool can be relevant to a task and still be impossible to call. HyperAgent makes the missing inputs and prerequisites explicit, then plans around the values and effects the agent already has.
1. The problem: similarity is not executability
Imagine asking an agent to remind a roommate about an unpaid payment request. A semantic retriever may correctly find a send_reminder API. But that API might require a phone number, a payment-request identifier, and an authenticated session. The request says what to do, not how to obtain these arguments.
Some necessary tools—logging in, looking up contacts, finding a payment request—may sound less similar to the original instruction. Returning only the most semantically relevant APIs can therefore omit precisely the tools needed to make the target API usable.
A coarse tool graph
lookup_contact → send_reminder
This says the tools are related. It does not say whether the contact lookup supplies the phone number, the request ID, or both. Nor does it say which other requirements remain.
A schema-level dependency
lookup_contact.phone → send_reminder.phone
This explains exactly what one tool supplies to another. The planner can distinguish a useful prerequisite from an irrelevant neighbor.
Why a hypergraph?
An ordinary directed edge connects one node to another. A directed hyperedge connects a set of inputs to a set of outputs. A tool is naturally such a relation: it requires its inputs jointly, and one invocation produces its outputs together.
Having a phone number alone is not sufficient. The set on the left is an AND requirement. Conversely, a contact lookup that returns both email and phone can satisfy two downstream requirements with one call.
Teaching illustration, not an API diagram reproduced from the paper.
2. The method: three graphs, two planning scales
HyperAgent does not replace reasoning with a single static tool chain. It combines a global dependency model, a task-level plan, and a fresh tool-level plan for the current state.
| Structure | What it represents | When it is used |
|---|---|---|
| Tool–Schema Hypergraph (TSH) | All modeled tools, their input/output/effect nodes, and port-level support links | Reusable global structure |
| Tool Context Graph | A compact, task-relevant subset of the TSH, including prerequisites | Before task decomposition |
| Task DAG | Subgoals and their data, effect, or ordering dependencies | High-level execution control; refined as needed |
| Tool Support Subgraph | A candidate composition supporting one subgoal from the current state | Built dynamically for a ready subtask |
The Task DAG and Tool Support Subgraph answer different questions. The first says “which subgoal must precede which?” The second says “which concrete producers are still necessary to execute this subgoal now?”
Step A — Build the global hypergraph
The authors start with In-N-Out, a parameter-level API graph built using LLM filtering and expert annotation. They convert each API into a hyperedge while preserving input/output schema nodes and cross-API dependency links.
They then enrich this structure with effects and conditions that do not appear as explicit API parameters. GPT-4o proposes state changes, preconditions, and alignments from documentation; experts validate them. Candidate effect–condition pairs are filtered for domain/entity compatibility, scored for semantic relevance, and reviewed by humans. Accepted state links are labeled strong or weak.
A dependency link means an output may support an input. It is a model of compatibility, not proof that every runtime value will be valid.
Step B — Retrieve a prerequisite-aware planning context
- Interpret the task: the LLM separates intended operations from schemas, values, constraints, and desired effects.
- Anchor tools: embedding similarity retrieves top-ranked tool descriptions above a threshold.
- Anchor schemas: input-side and output-side schema nodes are independently retrieved from the schema-level interpretation. Relevant producers and consumers add more seed tools.
- Expand backward: from needed input nodes, traverse support links backward to candidate producer tools. Add their inputs to the next frontier, within a hop budget.
This is not unrestricted graph traversal. Candidate limits, similarity thresholds, and hop budgets keep the context compact. They also introduce a trade-off: more expansion can recover prerequisites, but too much expansion adds distracting tools and tokens.
Step C — Ask the LLM for a schema-aware Task DAG
The retrieved context is serialized as tool names/descriptions, schema nodes, and producer-output → consumer-input links. The planner uses it to create subtasks. Each subtask records a local goal, target outputs/effects, candidate terminal tools, and execution status. DAG edges are grounded in the relevant dependencies rather than just a prose list of steps.
The agent selects a ready subtask—one whose predecessors have completed. This topological readiness is not yet enough to execute an API: its actual runtime inputs may still be missing.
Step D — Build a support graph from the current deficits
The runtime state stores execution history, subtask statuses, and schema–value bindings plus achieved effects. The same subgoal can require a different tool composition depending on that state. If a previous subtask already produced the request ID, retrieving it again is unnecessary.
Deficit-Oriented Expansion (DOE) starts from each candidate terminal tool and searches backward for producers. Its support score for a tool e and input r is the strongest output-to-input link from that tool:
Ω(e, M) = sum of ρ(e, r) over currently missing inputs r
A producer that covers several deficits can score higher than one that covers only one. The authors precompute these support scores in a sparse producer matrix for efficient lookup.
- Rank producer tools by overlap
Ωwith the current deficit set. - Expand the top-
Kcandidates: add one producer, remove requirements it supports, and add its own unresolved inputs. - Rank the resulting candidates by remaining deficit count; retain a beam of width
B. - Stop expanding a candidate when its deficits are empty. Choose a complete support graph for execution.
K controls how many producer directions are explored; B controls how many competing partial graphs survive. This is bounded search, not an optimal-cost planner.
Step E — Execute, verify, and revise
The executor uses a persistent restricted Python REPL, so intermediate values can be reused. A successful API response does not automatically mean a subtask is complete. Verification checks expected outputs, effects, and constraints against the execution trace, valid bindings, intermediate results, and observed effects.
Verified outputs enter the state. If a subtask fails or no feasible support graph exists, observations are retained and the remaining Task DAG can be refined. The method therefore separates structural feasibility, runtime execution, and goal satisfaction.
The main implementation uses GPT-4o for semantic components and ReAct-Code execution. Context extraction, DOE, and runtime binding validation are deterministic modules unless semantic ambiguity requires an LLM.
3. Playground: send one payment reminder
Try changing what is already known. The planner searches backward from send_reminder, but execution runs forward only when all inputs are available. A joint contact lookup can produce both phone and email.
Initial state
The last switch affects execution, not the schema graph. If the request ID is already known, lookup is unnecessary and this switch has no effect.
Runtime facts
Executable order
Search and execution trace
Inspect the synthetic tool catalog
| Tool | Required inputs | Outputs / effects |
|---|---|---|
| login | credentials | session |
| lookup_contact | session, roommate_name | phone, email |
| lookup_phone | session, roommate_name | phone |
| lookup_email | session, roommate_name | |
| lookup_payment | session, email | request_id |
| send_reminder | session, phone, request_id | reminder_sent |
What to notice
- Default: login → contact lookup → payment lookup → reminder. One contact call can satisfy phone and email requirements.
- Check phone and request ID: only login and the reminder remain. A static prerequisite chain would do unnecessary work.
- Check all three reminder inputs: the reminder itself is the only required call.
- Force an empty payment lookup: the structural plan still exists, but execution cannot materialize the request ID. The simulation stops rather than inventing one or claiming the reminder was sent.
Changing any control resets the run. Search ties favor a smaller selected graph, a teaching convenience not specified as the paper’s DOE ranking rule. The simulation also checks for a forward executable schedule; an empty structural deficit set alone can hide circular support in a poorly formed graph.
4. A minimal prototype you can reason through
The essential implementation is set algebra plus bounded search. Real systems additionally need port-level links, typed values, entity scope, and evidence validation.
// Teaching pseudocode: exact schema names stand in for port links.
function deficits(selectedTools, known) {
const required = union(selectedTools.map(t => t.inputs));
const produced = union(selectedTools.map(t => t.outputs));
return required.difference(known.union(produced));
}
beam = [{ tools: [terminal] }];
while (beam.length && depth < limit) {
next = [];
for (candidate of beam) {
missing = deficits(candidate.tools, known);
if (missing.size === 0) { complete.push(candidate); continue; }
producers = rankByOutputOverlap(catalog, missing).take(K);
for (producer of producers)
next.push(addTool(candidate, producer));
}
beam = rankByDeficitCount(next).take(B);
}
// Structural support is prospective, not runtime evidence.
// During forward execution, require actual values/effects.
for (tool of executableOrder(chosen.tools, known)) {
assert(allInputsActuallyBound(tool));
result = invoke(tool);
known.addAll(validatedBindingsAndEffects(result));
}
verifyGoalAgainstObservedEvidence();Backward search treats selected producer outputs as potential support. Forward execution must obtain actual values. Confusing these two meanings is a direct route to hallucinated arguments.
Worked deficit trace
| Selected tools | Missing requirements | Why |
|---|---|---|
| send_reminder | session, phone, request_id | Only credentials and name are initially known |
| + lookup_contact | session, request_id | Phone is supported; the contact tool also produces email |
| + lookup_payment | session | Request ID is supported; payment lookup’s email is covered by contact output |
| + login | none | Login supplies session from known credentials |
One valid pedagogical expansion trace; a beam search may add these producers in a different order. Execution still needs the forward dependency order.
5. What the experiments actually establish
Benchmark and metrics
AppWorld contains stateful simulated consumer applications such as email, payments, shopping, music, phone, and file management. Unit tests check requested changes, unintended modifications, and final answers where applicable. This is more demanding than checking whether an API name was selected correctly.
There are 250 scenarios with three task variants each: 750 tasks. The splits are 105 training tasks, 60 development tasks, 168 normal-test tasks across 56 scenarios, and 417 challenge-test tasks across 139 scenarios. Challenge tasks require longer, more complex interactions and may involve applications unseen during training.
- TGC: Task Goal Completion—the proportion of tasks solved.
- SGC: Scenario Goal Completion—a scenario counts only if all three variants succeed. It is a stricter consistency measure, not another name for task accuracy.
Same-backbone scaffold comparisons: Table 1
The following values reproduce the paper’s Table 1. All values are percentages.
| Backbone | Scaffold | Normal TGC | Normal SGC | Challenge TGC | Challenge SGC |
|---|---|---|---|---|---|
| GPT-4o | ReAct | 48.8 | 32.1 | 30.2 | 13.0 |
| GPT-4o | PlanExec | 44.6 | 23.2 | 19.7 | 7.9 |
| GPT-4o | FullCodeRefl | 33.9 | 26.8 | 19.2 | 12.2 |
| GPT-4o | HyperAgent | 63.1 | 52.6 | 35.7 | 18.9 |
| GPT-4-Turbo | ReAct | 26.8 | 12.5 | 17.5 | 5.8 |
| GPT-4-Turbo | HyperAgent | 45.3 | 28.6 | 23.1 | 10.1 |
| Llama-3-70B-Instruct | ReAct | 20.8 | 8.9 | 3.4 | 0.0 |
| Llama-3-70B-Instruct | HyperAgent | 30.1 | 19.7 | 8.9 | 6.4 |
The GPT-4-Turbo and Llama rows above are a subset of Table 1; GPT-4o includes all four reported scaffolds.
For GPT-4o, HyperAgent improves normal-test TGC over ReAct by 14.3 percentage points and challenge TGC by 5.5 points. Normal SGC rises by 20.5 points. These are differences in percentage points, not relative percentage improvements.
The direction is consistent across the three backbones, but the absolute challenge success rates remain modest. Llama’s challenge TGC reaches only 8.9%; explicit dependencies do not erase the effect of model capability or task difficulty.
Across optimization methods: Table 2
A second comparison includes supervised training, preference optimization, reinforcement learning, and non-fine-tuned scaffolds. Selected rows are shown below, separately from Table 1.
| Method | Normal TGC | Normal SGC | Challenge TGC | Challenge SGC |
|---|---|---|---|---|
| EI (iterated successful-rollout training) | 58.3 | 36.8 | 32.8 | 17.6 |
| DMPO | 59.0 | 36.6 | 36.3 | 13.7 |
| GRPO | 58.0 | 36.8 | 39.5 | 22.4 |
| LOOP (token) | 71.3 | 53.6 | 45.7 | 26.6 |
| Traj (SetBSR + Snippet) | 65.8 | 53.6 | 38.7 | 24.8 |
| HyperAgent | 67.1 | 55.9 | 40.2 | 26.1 |
Table 2 supports the claim that HyperAgent is competitive with trained agents and leads the listed non-fine-tuned methods. It does not show universal superiority: LOOP (token) has higher TGC on both tests and higher challenge SGC.
There is another comparison limitation: trained SFT/DPO/RL baselines use Qwen-2.5-32B, while non-fine-tuned methods use GPT-4o. Cross-paradigm comparisons mix backbone capability with optimization strategy. Same-backbone scaffold comparisons are cleaner evidence for the framework’s contribution.
Efficiency, ablations, and retrieval checks
Cost comparison
The authors report fewer API calls, LLM interaction turns, and total tokens than ReAct on both test sets. Their rollout discussion attributes this to less documentation exploration and fewer retries.
This supports an online-execution efficiency claim; it does not by itself establish total ownership cost including graph construction and expert review.
Two component ablations
Removing graph context from DAG planning/refinement reduces performance. Replacing support subgraphs with semantically retrieved top-K tools also reduces performance. Both variants use more tokens and API calls.
This is evidence that the high-level context and state-conditioned tool-level support each matter.
Search-budget sensitivity
Increasing context hops from 1 to 2 and support top-K from 1 to 3 improves TGC and SGC. Further expansion gives little improvement while substantially increasing tokens.
More context is not automatically better context.
Two more focused evaluations
Under a common budget of 20 tools, context retrieval better preserves gold tool sets than semantic retrieval and In-N-Out retrieval.
On frozen subgoals with manually annotated completion contracts, support graphs increase subgoal completion while reducing LLM calls compared with ReAct plus semantic top-K retrieval.
The cost, ablation, sensitivity, retrieval, and subgoal results are reported primarily in Figures 2–6. Their exact plotted values were not exposed in the readable text, so this report gives the stated trends rather than inventing percentages or digitizing unavailable values. The paper refers to appendix implementation details and prompts; those appendix contents were not present in the full readable document returned for this report.
6. Where the idea can fail
The paper does not provide a dedicated limitations section in the readable text. The following are engineering implications of its method and evaluation, not additional measured findings.
- The graph is a maintained asset. It relies on expert-validated API dependencies and GPT-4o-assisted condition/effect enrichment. New APIs, changed schemas, and revised preconditions require updates. Incorrect or missing links can mislead both planning levels.
- Schema compatibility is weaker than value validity. An email is not necessarily the correct roommate’s email. A session can expire. A request ID may refer to a settled payment or the wrong user. Runtime binding validation and goal verification remain necessary.
- Empty deficits do not imply a safe, valid execution. Structural support must still be schedulable and grounded. Permission rules, resource availability, state changes, and business constraints can invalidate a plan. Circular producer dependencies need special handling.
- Beam search is heuristic. Fewest missing inputs is not necessarily fewest API calls, lowest latency, lowest risk, or the best success probability. A narrow beam or small retrieval budget can discard a useful path.
- Effects may invalidate old facts. The description emphasizes accumulated bindings and achieved effects. Production systems also need freshness, scope, and invalidation logic—for example, logging out invalidates session-dependent readiness.
- The evidence is benchmark-specific. AppWorld is stateful and unit-tested, but simulated. The study does not establish reliability under live-service outages, changing authorization policies, or real transaction risk. Reported tables do not include uncertainty intervals.
A useful way to remember the contribution
HyperAgent externalizes dependency reasoning that a language model would otherwise perform implicitly. It asks the LLM to interpret, decompose, and adapt, while deterministic machinery exposes which input requirements are missing and which tools might supply them.