Agent Behavior as Code: Efficient and Robust LLM Agents with Programmatic Specifications
Organizations: Uniphore · Orby AI
Abstract
AI agents based on foundation models (FMs) have demonstrated strong capabilities to perform complex open-ended tasks. However, they face some common challenges in practice: (a) agent behavior can deviate drastically even for semantically similar tasks, leading to catastrophically propagated errors; (b) high cost and latency due to FM calls, repeated in full whenever a task recurs with different inputs; (c) FMs' limited context and instruction following capability confine how well agents manage the ever-growing execution context and follow complex plans. We introduce gent ehavior as ode (ABCAgent), which uses a symbolic program (e.g., Python code with potential neural functions) to fully specify the agent's behavior at runtime, with a powerful FM agent editing that program for flexibility. Behavior is thus specified without premature variable binding, and its execution is deterministic. We evaluate ABCAgent on six agent benchmarks, two of which we construct to test how well a derived program generalizes to variants of the task it was written for. ABCAgent matches a model-matched neural agent on GAIA and augmented GAIA, and surpasses it where robustness and long control flows matter: 98.3% against 97.3% on GSM-Symbolic (), 71.9% against 47.4% on the telecom domain of -bench (), and more records written correctly at every loop length on our control-flow-augmented WorkArena benchmark. For more parametric task families, ABCAgent is also significantly superior in efficiency. Without authoring a new program, ABCAgent solves 92.6% of GSM-Symbolic instances and 20.1% of augmented GAIA variants, which yields lower latency and lower cost on GSM-Symbolic, 19% lower cost on augmented GAIA, and lower agent latency on -telecom.
Figures & tables
| System | GAIA | WorkArena | GSM-Symbolic | -bench ( ) | |||
|---|---|---|---|---|---|---|---|
| base (165) | augmented (378) | L1 (31) | CF (42) | (5000) | telecom (114) | airline (50) | |
| Reference | 74.6 | — | 42.7 | — | 94.9 | 29.0 | 42.0 |
| Neural agent | 76.4 | 59.5 | 84.9 | 58.3 | 97.3 | 47.4 | 58.0 |
| ABCAgent | 72.7 | 57.1 | 62.4 | 64.3 | 98.3 | 71.9 | 60.0 |
| -value | 0.377 | 0.281 | 0.041 | 0.453 | 0.0011 | 0.0001 | 1.000 |
| Cost efficiency | 0.90 | 1.24 | 0.41 | 1.02 | 6.97 | 12.93 | 5.66 |
| Augmented GAIA L1 (129) | GSM-Symbolic (1000) | WorkArena-CF (18) | |||||||
| Setting | SR | Free | Cost eff. | SR | Free | Cost eff. | SR | Records | Cost eff. |
| Neural agent | 62.0 | 0.0% | 1.00 | 99.7 | 0.0% | 1.00 | 76.5 | 53.3 | 1.00 |
| ABCAgent | 58.9 | 21.7% | 1.27 | 99.1 | 96.0% | 11.91 | 83.3 § | 63.9 | 1.04 |
| reuse & rebind | 62.8 | 0.0% | 1.02 | 99.4 | 0.0% | 0.96 | 77.8 | 63.3 | 0.80 |
| variant check | 56.6 | 0.0% | 1.30 | 99.8 | 0.0% | 0.97 | 68.8 | 0.0 ‡ | 1.26 |
| Transfer setting | pairs | Reuse | Control | |
| GSM-Symbolic | ||||
| Forward ( ) | 7 640 | 0.958 | 0.842 | |
| Backward ( ) | 7 360 | 0.963 | 0.826 | |
| Augmented GAIA | ||||
| Forward ( ) | 235 | 0.332 | 0.302 | 0.410 |
| Backward ( ) | 239 | 0.469 | 0.305 | 3.5e-5 |
| System | Behavior specification | Adaptation signal | |
| Neural agent | prompt only | none | 0.603 |
| Neural agent traces | prompt prior transcripts | task transcripts | 0.671 |
| ABCAgent | symbolic program | task transcripts | 0.789 |
| reward at authoring | symbolic program | transcripts reward | 0.943 |
| Control : neural agent, transcript injection disabled | 0.638 | ||
Appendix figures & tables9 assets
Supplementary material from the paper’s appendix.
Appendix
| GAIA | Augmented GAIA | |||||||
|---|---|---|---|---|---|---|---|---|
| System | L1 (53) | L2 (86) | L3 (26) | all (165) | L1 (129) | L2 (204) | L3 (45) | all (378) |
| Reference (HAL) | 82.1 | 72.7 | 65.4 | 74.6 | — | — | — | — |
| Neural agent | 86.8 | 75.6 | 57.7 | 76.4 | 62.0 | 58.3 | 57.8 | 59.5 |
| ABCAgent | 86.8 | 72.1 | 46.2 | 72.7 | 58.9 | 57.4 | 51.1 | 57.1 |
| McNemar -value | 1.000 | 0.648 | 0.453 | 0.377 | 0.481 | 0.851 | 0.508 | 0.281 |
| Task Type | Task Names |
|---|---|
| Loop tasks | CreateMultipleChangeRequestTask |
| CreateMultipleHardwareAssetTask | |
| CreateMultipleIncidentTask | |
| CreateMultipleProblemTask | |
| CreateMultipleUserTask | |
| DeleteMultipleUserTask |
| telecom ( ) | airline ( ) | |||
| System | ||||
| Reference ( Barres et al., 2025 ) | 0.59 | 0.29 | 0.59 | 0.42 |
| Stock agent | 0.6075 | 0.4737 | 0.6850 | 0.5800 |
| ABCAgent | 0.8158 | 0.7193 | 0.6850 | 0.6000 |
| paired | (46/16/52) | (8/8/34) | ||
| Wilcoxon | 0.0001 | 0.958 | ||
| Transfer setting | pairs | Reuse | Control | |
|---|---|---|---|---|
| Augmented GAIA | ||||
| All pairs | 572 | 0.388 | 0.292 | 2.2e-5 |
| Forward ( ) | 235 | 0.332 | 0.302 | 0.410 |
| Backward ( ) | 239 | 0.469 | 0.305 | 3.5e-5 |
| Backward, target known-passing | 145 | 0.703 | 0.462 | 5.1e-5 |
| Backward, rewritten & known-passing | 103 | 0.718 | 0.388 | 1.2e-6 |
| Setting | SR | Free | $/task | Cost eff. |
|---|---|---|---|---|
| Neural agent | 99.7 | 0.0% | 0.1362 | 1.00 |
| ABCAgent , no components | 99.8 | 0.0% | 0.1408 | 0.97 |
| family reuse | 100.0 | 0.0% | 0.2138 | 0.64 |
| variant check | 99.7 | 0.0% | 0.2155 | 0.63 |
| cheap rebind | 99.1 | 96.0% | 0.0114 | 11.91 |
| executor loop off | executor loop on | |
|---|---|---|
| variant check off | 64.4 | 0.0 ‡ |
| variant check on | 63.3 | 63.9 ⋆ |
| neural agent | 53.3 | |
LLM Agents
Large language model agents use language models to plan, use tools, and act across multi-step tasks and environments.
See all 661 papers