Agent APIs Explained The 3 Layers Every AI Developer Must Understand
原始來源與檔名:2026-08-11T094504+0800-Agent APIs Explained The 3 Layers Every AI Developer Must Understand.md
SOURCE | 資訊源評估
- 作者:Divy Yadav
- 來源:Towards AI
- 核心主題:Agent APIs, MCP, Architecture
NAPKIN | 餐巾紙
餐巾紙公式
Agent API = Instructions + Tools + Memory + Control Loop Agent Architecture = Protocol Layer (MCP) + Vendor Endpoint Layer (OpenAI) + Framework Layer (LangChain)
一句話
An “Agent API” isn’t a single product, but a 3-layered architecture; confusing a proprietary vendor endpoint for an open protocol leads to fatal lock-in, as seen with OpenAI’s Assistants API deprecation.
餐巾紙草圖
[ Framework Layer ] (LangChain, CrewAI) - Orchestrates multiple agents
|
[ Vendor Endpoint ] (OpenAI Responses API, Anthropic Messages) - Tied to 1 company
|
[ Protocol Layer ] (MCP - Model Context Protocol) - Vendor neutral tool definition
ROUND 1: SKELETON | 骨架掃描
- In August 2026, OpenAI shuts down the Assistants API, breaking many agent apps. This highlights a fundamental misunderstanding of “Agent APIs”.
- An Agent API is a contract, not a product.
- The 4 parts of every Agent API: Instructions, Tool Definitions, Memory, and the Control Loop (the model deciding what to do).
- The 3 Layers of Architecture:
- Protocol Layer (MCP): Standardizes how tools describe themselves. Vendor-neutral.
- Vendor Endpoint Layer: The actual API call to a specific provider (e.g., OpenAI Responses API).
- Framework Layer: LangChain/CrewAI, sits on top, handles orchestration of the loop.
- The Assistants API was a Vendor Endpoint beta, not a protocol or framework.
- Traditional API vs Agent API: Traditional has fixed flow and fast failures. Agent API has dynamic flow (Control Loop) and silent logic failures.
- Don’t overbuild: Start by hand-writing the loop against a Vendor Endpoint, then use MCP for external tools, and only use a Framework for multi-agent orchestration.
ROUND 2: DISSECTION | 血肉解剖
- The Control Loop is the defining feature of an agent API. The model itself decides whether to call another tool or finish. Your code does not dictate “do A, then B”.
- People got burned because they confused a vendor endpoint (Assistants API) with the foundational protocol layer.
- MCP (Model Context Protocol) uses JSON-RPC 2.0 to define tools neutrally. By early 2026, it had 3000+ servers.
- The danger of Frameworks: If you use a framework before understanding the underlying control loop, debugging becomes impossible because you are debugging someone else’s abstraction over a mechanism you don’t grasp.
- Agent failures are quiet: wrong tool, wrong input, or stopping early. They hide easily in happy-path demos.
- Progressive enhancement approach:
- Hand-write the loop (50 lines) with 1-2 custom tools to feel “the model decides”.
- Add MCP when you need external tools you didn’t write.
- Use Frameworks only for multi-agent coordination.
ROUND 3: SOUL | 靈魂提取
The illusion of the “Agent API” as a turnkey product led developers into a vendor lock-in trap. True mastery of agentic development requires deconstructing the abstraction stack. The developer must understand that they are relinquishing control flow to the model (the loop) and must deliberately choose where they tie themselves to a standard (MCP) versus a vendor.
DEEP READ | 精讀指引
- “An agent API is not a product you install. It’s a contract about who decides what happens next.”
- 4 Parts: “Instructions, Tool definitions, Memory, Control loop.”
- “The Assistants API wasn’t the protocol layer, and it wasn’t a framework. It was one vendor’s beta implementation of the endpoint layer.”
- Traditional vs Agent API failure mode: “When an agent API goes wrong, the model might call the right tool with the wrong input… Those failures are quieter, and they hide well in a demo.”
- Advice on frameworks: “You can’t debug a black box you never opened. Hand write the loop against one vendor endpoint first.”
