Menu
The New Stack·August 1, 2026

Designing APIs for AI Agents: Principles and Architecture

This article explores the architectural considerations and design patterns for creating effective APIs for AI agents, drawing lessons from Webflow's experience. It highlights the fundamental differences between APIs optimized for human developers and those required for reliable autonomous agent execution, advocating for intent-driven, task-level interfaces, layered tool organization, and code-oriented environments.

Read original on The New Stack

The Challenge: Developer APIs vs. Agent APIs

Traditional APIs are designed for human developers who can interpret documentation, compose granular endpoints, manage state, and manually handle failures. AI agents, particularly large language models (LLMs), operate with less implicit context and rely heavily on the API surface itself to guide their planning and execution. Directly exposing low-level developer APIs to agents leads to chatty interactions, inefficient runtimes, higher latency, increased token consumption, and unreliable task completion due to the agent's need to infer complex execution strategies and preserve intermediate state.

💡

Key Principle

APIs for agents must prioritize execution reliability, fewer ambiguous choices, less state to preserve, and clearer guidance for failure recovery, rather than just flexibility and composability.

Architectural Patterns for Agent-Ready APIs

Webflow's journey led to several key architectural decisions for their MCP (Multi-Modal Command Protocol) server to support robust agent workflows:

  • Intent-Driven, Declarative APIs: Move from granular, low-level operations to task-level tools that directly match a user's intent. This shifts orchestration complexity from the agent to the platform, reducing failure modes and allowing the agent to focus on the goal.
  • Layered Tool Architecture: To combat "tool explosion" with task-oriented APIs, capabilities are grouped into broader domain-level tools with typed composable actions. This provides a structured and navigable map for agents.
  • Filesystem Abstractions and Code Representations: Introduce a programmable workspace where agents can operate against structured project representations using code-driven manipulation (e.g., `read src/pages/home.tsx`, `write src/components/Hero.tsx`). This leverages LLMs' strength in reasoning over structured text and code, reducing explicit tool discovery overhead.
  • Stateful Execution Infrastructure: Agent workflows are inherently stateful. Webflow used Cloudflare Durable Objects to provide a session-oriented execution model, allowing each MCP session to manage user context, tools, and runtime coordination without external session infrastructure.

Observability for Agent Systems

Traditional logging and tracing are insufficient for understanding autonomous agent behavior. New observability systems are needed to grasp *what the agent was trying to accomplish*, which capabilities it used, and how it navigated workflows, rather than just infrastructure metrics.

json
{
  "action": "update_page_section",
  "params": {
    "page": "home",
    "section": "hero",
    "changes": {
      "heading": "Build faster with Webflow"
    }
  }
}
API designAI agentsLLMdeclarative APIsstateful servicesDurable Objectssystem architectureobservability

Comments

Loading comments...