Beyond Static Endpoints: Tool Programs as an Interface for Flexible Agentic Web Services

Mugeng Liu, Shuoqi Li, Yixuan Zhang, Yun Ma

As LLM-based agents increasingly rely on web services to execute complex tasks, a critical bottleneck has emerged: the interface itself. Most agents interact with the web through static API endpoints designed for single-shot queries. For multi-step agentic workflows, this results in a slow, fragile, and "chatty" back-and-forth exchange.

ToolPro introduces a paradigm shift. Instead of executing stepwise API calls over the network, ToolPro packages an agent's intent into a single, executable "tool program" that runs directly on the server. By handling loops, conditionals, and retries on the service side using WebAssembly (Wasm), ToolPro reduces end-to-end latency by up to 53.4% and slashes client-side network traffic by up to 96.1%.

The Problem with Static Endpoints

Consider an agent tasked with booking the "highest-rated hotel in Sydney." Under the current paradigm, the agent must call a search API, wait for the results to travel across the network, reason about which hotel is best, and then call a booking API.

This "stepwise" approach has three major flaws:

  1. Inefficiency: Every step requires a network round-trip and a new round of LLM reasoning, which is slow and computationally expensive.
  2. Over-fetching: Agents frequently pull large amounts of data across the network just to extract a single ID or value needed for the next step.
  3. Brittleness: If a multi-step process fails halfway through, retrying it can be dangerous. A naive retry might result in a user being charged twice—a classic "side effect" problem.

Introducing ToolPro: Executable Intent

The core insight behind ToolPro is that we shouldn't just try to make LLMs faster; we should change how they talk to services. Moving the "brain" of the execution closer to the data eliminates the cost of a chatty interface.

Instead of making individual requests, the agent generates a small program (written in Rust and compiled to WebAssembly) that contains the entire logic of the task. ToolPro ensures this process is safe, efficient, and reliable through four key mechanisms:

  • Constraint-Guided Construction: To ensure LLM-generated code actually works, ToolPro uses a pipeline that performs structural checks, projects the code into a safe "constrained surface," and uses compiler feedback to automatically repair errors.
  • Effect-Aware Replay: This is ToolPro's primary safety feature. It distinguishes between READ (safe to repeat) and WRITE (state-modifying) operations. ToolPro maintains a log of successful WRITEs. If a program fails and needs to be re-run, the system "replays" the previous WRITE results from the log instead of executing them again, ensuring "exactly-once" semantics.
  • Profile-Driven Policy: Program synthesis and compilation have overhead. ToolPro uses a cost model to decide in real-time whether it's faster to send a full program or stick to traditional stepwise calling based on current network conditions.
  • Wasm Sandboxing: Programs run in a WebAssembly sandbox, ensuring that untrusted agent code cannot access the server's filesystem or network beyond the allowed API boundaries.

Evaluation and Datasets

Researchers evaluated ToolPro using three popular open-source applications: Memos (knowledge management), Directus (headless CMS), and MinIO (S3-compatible object storage).

They constructed Read-Only and Read-Write workflows for each, and introduced a new benchmark called cbench (1-4). This benchmark features complex, realistic scenarios involving nondeterministic retrieval, branching logic, and cross-service interactions (e.g., uploading a file to MinIO and then creating a corresponding note in Memos).

Key Results

  • Massive Latency Reductions: ToolPro reduced end-to-end latency by up to 53.4%. The gains were most significant in high-latency scenarios (e.g., a client in Beijing talking to a server in London).
  • Slashed Network Traffic: Client-side traffic dropped by up to 96.1%. The agent only sends the program once, rather than transmitting the entire conversation history and tool definitions back and forth for every API call.
  • Improved Accuracy on Complex Tasks: On the most complex tasks (cbench4), ToolPro improved task accuracy from 0.20 to 0.80. By executing logic on the server, the agent avoids the "drift" and reasoning errors that often plague long, multi-turn conversations.
  • Smart Adaptive Switching: In very low-latency environments (<10ms), the profile-driven policy correctly defaulted to stepwise calling to avoid the overhead of compilation.

Limitations and Future Directions

While ToolPro demonstrates the immense potential of tool programs, there are areas for future optimization. The largest portion of ToolPro's overhead is the time the LLM takes to synthesize the initial Rust program (often 7+ seconds). Specialized, smaller models fine-tuned for this specific syntax could significantly speed this up.

Additionally, while Rust provides excellent safety and Wasm support, it is a "heavy" language for an LLM to generate perfectly every time. Future work might explore a lighter Domain Specific Language (DSL). Finally, if an API endpoint is truly nondeterministic and lacks idempotency keys, ToolPro must fall back to stepwise mode to remain safe, limiting its benefits for certain chaotic services.

Ultimately, ToolPro proves that by treating intent as a first-class, executable object, we can make the agentic web significantly faster, safer, and more reliable.

Summary updated

BibTeX
@inproceedings{liu2026beyond,
  author = {Mugeng Liu and Shuoqi Li and Yixuan Zhang and Yun Ma},
  title = {{Beyond Static Endpoints: Tool Programs as an Interface for Flexible Agentic Web Services}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=fmwNYkYRN6},
}
Figure