cs.AIOct 4, 2026

Agent Behavior as Code: Efficient and Robust LLM Agents with Programmatic Specifications

Authors: Peng Qi, Chunliang Lyu, Gang Li, Fabian Chan, Cheng Chang, Ignacio Cases, Will Lu

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 A\textbf{A}gent B\textbf{B}ehavior as C\textbf{C}ode Agent\textbf{Agent} (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 (p=0.001p = 0.001), 71.9% against 47.4% Pass4\mathrm{Pass}^4 on the telecom domain of τ2τ^2-bench (p=0.0001p = 0.0001), 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 5.2×5.2\times lower latency and 7.0×7.0\times lower cost on GSM-Symbolic, 19% lower cost on augmented GAIA, and 9.5×9.5\times lower agent latency on τ2τ^2-telecom.

Figures & tables

Appendix figures & tables9 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. LLM-as-Code: Agentic Programming for Agent Harness

    Jun 14, 2026Junjia Qi, Zichuan Fu, Jingtong Gao +4AI Agent ReliabilityLLM Agent Orchestration

  2. Grow the Harness, Not the Context: From Strategy-Free Scaffolds to Reusable Specialist Agents

    Sep 22, 2026Laizhen Li, Jiarui Li, Juanjuan Zhao +4Agent Harness OptimizationLLM Agent Workflow Optimization

  3. JevAgentHarness: Benchmarking, Deploying and Training Decision Models That Share Control with LLMs

    Oct 15, 2026Kunlun Zhu, Tao Feng, Xu Han +5LLM Agent HarnessesLLM Agents