Agent Platform:从 Agent Runtime 到企业级智能体基础设施

Agent Platform :从 Agent Runtime 到企业级智能体基础设施

一、引言:Agent 正在从“应用”走向“平台”

2024~2026 年,AI 应用的技术重点正在发生一个非常明显的变化:

早期大家关注:

LLM
Prompt
RAG
Vector Database
Tool Calling

随后开始关注:

Agent
Multi-Agent
MCP
A2A
Workflow
Memory

而当 Agent 数量真正进入企业生产环境以后,一个更核心的问题出现了:

如何管理几十、几百甚至几千个 Agent?

例如一个企业 AI 平台可能同时存在:

                    Agent Platform
                         |
       +-----------------+-----------------+
       |                 |                 |
   Coding Agent      Research Agent    Data Agent
       |                 |                 |
   Tool Calling      RAG / Search      SQL / BI
       |                 |                 |
       +-----------------+-----------------+
                         |
                    Agent Runtime
                         |
       +-----------------+-----------------+
       |                 |                 |
     Memory            Tools             Events
       |                 |                 |
    Redis/DB            MCP              Kafka

这时候,简单地:

Java + Spring Boot + OpenAI API

已经无法解决完整问题。

企业真正需要的是:

Agent Platform

Agent Platform 的定位类似于:

Operating System : Applications
Agent Platform   : Agents

它负责提供 Agent 所需要的:

Identity
Runtime
Tool
Memory
Workflow
Communication
Knowledge
Security
Observability
Governance
Evaluation

因此:

Agent Platform 是 Agent 从 Demo 走向企业级生产系统的基础设施。


二、什么是 Agent Platform?

可以先给出一个比较工程化的定义:

Agent Platform 是一套用于创建、注册、运行、协作、治理、观测和评估 AI Agent 的基础设施平台。

它不是简单的:

LLM API Gateway

也不是:

Chatbot Framework

更不是:

Prompt Management System

完整 Agent Platform 应该解决:

Agent 如何创建?
Agent 如何运行?
Agent 如何调用 Tool?
Agent 如何访问 Knowledge?
Agent 如何保存 Memory?
Agent 如何与其他 Agent 通信?
Agent 如何执行 Workflow?
Agent 如何处理失败?
Agent 如何扩缩容?
Agent 如何被监控?
Agent 如何进行权限控制?
Agent 如何评估?
Agent 如何升级?

因此可以把 Agent Platform 看成:

                 Agent Platform
                       |
       +---------------+---------------+
       |               |               |
   Development      Runtime         Governance
       |               |               |
   Agent SDK        Execution       Security
   Templates        Scheduling      Policy
   Prompt           State           Audit
   Testing          Tool            Evaluation

三、Agent Platform 的总体架构

一个企业级 Agent Platform 可以抽象成下面的架构:

┌────────────────────────────────────────────────────────────┐
│                    Agent Applications                       │
│                                                            │
│  Coding Agent   Research Agent   Customer Agent   Data Agent│
└──────────────────────────┬─────────────────────────────────┘
┌────────────────────────────────────────────────────────────┐
│                     Agent Gateway                           │
│                                                            │
│ Authentication | Authorization | Routing | Rate Limit      │
└──────────────────────────┬─────────────────────────────────┘
┌────────────────────────────────────────────────────────────┐
│                    Agent Control Plane                      │
│                                                            │
│ Agent Registry | Version | Policy | Configuration           │
│ Workflow       | Model Routing | Deployment                 │
└──────────────────────────┬─────────────────────────────────┘
┌────────────────────────────────────────────────────────────┐
│                     Agent Runtime                           │
│                                                            │
│ Planner | Executor | State | Tool Manager | Memory Manager │
│ Context | Scheduler | Retry | Checkpoint | Human-in-loop    │
└───────────────┬──────────────┬──────────────┬──────────────┘
                │              │              │
                ▼              ▼              ▼
          ┌──────────┐   ┌──────────┐   ┌──────────┐
          │   LLM    │   │   MCP    │   │   A2A    │
          └──────────┘   └──────────┘   └──────────┘
                │              │              │
                ▼              ▼              ▼
          Model Layer       Tools          Agents

┌────────────────────────────────────────────────────────────┐
│                     Platform Services                       │
│                                                            │
│ Memory | Knowledge | Event Bus | Observability | Security   │
│ Billing | Evaluation | Audit | Data | Feature Flags        │
└────────────────────────────────────────────────────────────┘

这个架构可以进一步抽象为:

Control Plane
       +
Data Plane
       +
Platform Services

这是理解 Agent Platform 的第一个关键。


四、Control Plane 与 Data Plane

现代 Agent Platform 最重要的架构思想之一,就是:

Control Plane / Data Plane 分离。

Control Plane

负责:

Agent Definition
Agent Registry
Version
Configuration
Policy
Deployment
Routing
Security

例如:

{
  "agentId": "research-agent",
  "version": "v3",
  "model": "gpt-x",
  "tools": [
    "web-search",
    "database"
  ],
  "memory": "long-term",
  "policy": "research-policy"
}

Control Plane 不负责真正执行 Agent Task。


Data Plane

真正执行:

Agent Task

例如:

User
Task
Agent Runtime
LLM
Tool
LLM
Result

因此:

Control Plane
      |
      | configuration
      v
Data Plane
      |
      | execution
      v
Agent

这种架构与 Kubernetes 非常相似。

Kubernetes:

Control Plane
      |
      v
Kubelet / Container Runtime

Agent Platform:

Agent Control Plane
      |
      v
Agent Runtime

所以从架构师角度:

Agent Platform 可以理解成一个面向智能体的 Cloud Native Control Plane。


五、Agent Registry:Agent 平台的“服务注册中心”

如果企业只有:

Agent A
Agent B
Agent C

可以直接管理。

但是如果有:

1000 Agents

就必须建立:

Agent Registry

例如:

Agent Registry
|
+-- coding-agent
|     +-- v1
|     +-- v2
|     +-- v3
|
+-- research-agent
|     +-- v1
|     +-- v2
|
+-- data-agent
      +-- v1

Registry 保存:

Agent ID
Version
Description
Owner
Model
Tools
Memory
Permissions
Runtime
Endpoint
Status

例如:

{
  "agentId": "security-agent",
  "version": "2.3.0",
  "owner": "security-team",
  "runtime": "agent-runtime-v4",
  "model": "reasoning-model",
  "tools": [
    "vulnerability-scan",
    "cve-search"
  ],
  "permissions": [
    "security.read",
    "security.scan"
  ]
}

六、Agent 不应该只是一个 Prompt

这是 Agent Platform 设计中非常重要的思想。

很多早期系统:

Agent = System Prompt + LLM

实际上远远不够。

企业级 Agent:

Agent
 |
 +-- Identity
 +-- Instructions
 +-- Model
 +-- Tools
 +-- Memory
 +-- Knowledge
 +-- Policies
 +-- Workflow
 +-- State
 +-- Evaluation
 +-- Observability

因此:

Agent 应该被视为一种 Runtime Entity,而不是一段 Prompt。


七、Agent Identity

企业 Agent 首先需要身份。

例如:

agentId = payment-agent

但还需要:

tenantId
organization
owner
environment
role
permissions

例如:

Tenant
  |
  +-- Production
        |
        +-- Payment Agent
        +-- Risk Agent
        +-- Customer Agent

Agent Identity 可以类似:

Service Identity

或者:

Workload Identity

这就把 Agent 从:

AI Application

提升成:

Platform Workload

八、Agent Runtime:Agent Platform 的核心

如果说:

Agent Platform = Operating System

那么:

Agent Runtime = Process Runtime

Agent Runtime 负责:

Task Execution
State Management
LLM Invocation
Tool Invocation
Memory
Planning
Retry
Checkpoint
Timeout
Cancellation
Human Approval

一个 Agent Task:

Task
 |
 v
Runtime
 |
 +-- Load Context
 |
 +-- Call LLM
 |
 +-- Parse Action
 |
 +-- Execute Tool
 |
 +-- Update State
 |
 +-- Call LLM
 |
 +-- Final Response

所以 Agent Runtime 是:

Agent Platform 最核心的数据面组件。


九、Agent Runtime 的内部架构

一个生产级 Runtime 可以设计为:

                  Agent Runtime
                       |
       +---------------+---------------+
       |               |               |
   Task Manager    Context Engine   State Manager
       |               |               |
       v               v               v
   Scheduler        Memory          Checkpoint
       |
       v
   Execution Engine
       |
 +-----+-----+------+
 |           |      |
 v           v      v
Planner     LLM    Tool Executor
                     |
                +----+----+
                |         |
               MCP       API

Runtime 本质上是一个:

AI Execution Engine


十、Agent Task Model

Agent Platform 不应该只处理:

Chat Message

而应该建立统一:

Task Model

例如:

{
  "taskId": "task-10001",
  "agentId": "research-agent",
  "tenantId": "company-a",
  "input": {
    "query": "Analyze cloud market"
  },
  "priority": 5,
  "timeout": 300,
  "metadata": {
    "userId": "user-001"
  }
}

Task 生命周期:

CREATED
QUEUED
RUNNING
WAITING
RUNNING
COMPLETED

异常:

RUNNING
   |
   v
FAILED
   |
   +---- RETRY
   |
   +---- CANCEL
   |
   +---- HUMAN_REVIEW

十一、Agent Runtime 本质上是 State Machine

Agent 并不是:

Input
Output

而是:

State
Reason
Action
Observation
State
Reason
Action

可以表示为:

           +----------------+
           |     State      |
           +-------+--------+
                   |
                   v
             LLM / Planner
                   |
                   v
                Action
                   |
          +--------+--------+
          |                 |
        Tool              Final
          |
          v
      Observation
          |
          +------------+
                       |
                       v
                     State

这其实非常接近:

State Machine + Event Loop

因此 Agent Runtime 和传统:

Workflow Engine

有很多相似之处。


十二、Agent Loop

最基本的 Agent Loop:

while (!completed) {

    context = buildContext();

    decision = llm(context);

    if (decision.isFinal()) {
        return decision.result();
    }

    action = decision.action();

    observation = execute(action);

    updateState(observation);
}

但是生产环境不能简单使用:

while(true)

必须考虑:

Max Steps
Timeout
Token Budget
Cost Budget
Retry
Cancellation
Rate Limit
Tool Failure
LLM Failure

所以真正的 Runtime Loop:

Agent Loop
 |
 +-- Step Limit
 +-- Time Limit
 +-- Token Limit
 +-- Cost Limit
 +-- Permission
 +-- Policy
 +-- Cancellation

十三、Context Engine

Agent 最大的技术问题之一:

Context。

因为 Agent 的输入可能包括:

System Prompt
User Input
Conversation
Memory
Knowledge
Tool Result
Previous Steps
Agent Messages
Other Agent Messages

最终:

Context
 |
 +-- System
 +-- User
 +-- History
 +-- Memory
 +-- RAG
 +-- Tools
 +-- State

Context Engine 的任务就是:

决定什么信息应该进入当前 LLM Context。


十四、Context Engineering

真正生产级 Agent 的竞争力,很大程度上不在:

Prompt Engineering

而在:

Context Engineering

例如:

Available Context
        |
        v
Context Selection
        |
        v
Context Compression
        |
        v
Context Ranking
        |
        v
LLM Context

需要处理:

Token Limit
Relevance
Recency
Priority
Security
Cost
Latency

十五、Memory Architecture

Agent Memory 可以拆成:

Memory
 |
 +-- Short-Term Memory
 |
 +-- Long-Term Memory
 |
 +-- Episodic Memory
 |
 +-- Semantic Memory
 |
 +-- Working Memory

例如:

Short-Term
当前 Task

Working Memory
当前 Agent Loop

Long-Term
跨 Session

Semantic Memory
知识 / 用户偏好

Episodic Memory
过去发生过什么

十六、Memory Service

不要让每个 Agent 自己直接操作:

Redis
PostgreSQL
Vector DB

更合理的是:

Agent
 |
 v
Memory API
 |
 +---- Short-term
 +---- Long-term
 +---- Semantic
 +---- Episodic

这样 Platform 可以统一:

Storage
TTL
Encryption
Access Control
Retrieval
Compression
Deletion

十七、Tool Platform

Agent 真正产生价值的关键:

Tool。

例如:

Web Search
Database
GitHub
Jira
Slack
Email
Kubernetes
Cloud API
Internal API

Agent Platform 不应该让每个 Agent:

自己写 Tool Client

而应该建立统一:

Tool Platform

                 Tool Platform
                       |
       +---------------+---------------+
       |               |               |
      MCP             REST           Function
       |               |               |
    Tool A          Tool B          Tool C

十八、MCP 在 Agent Platform 中的位置

MCP 主要解决:

Agent ↔ Tool

可以:

Agent Runtime
      |
      v
   MCP Client
      |
      v
   MCP Server
      |
 +----+----+
 |         |
Tool A    Tool B

因此 MCP 可以成为:

Agent Platform 的 Tool Integration Layer。

但不要认为:

Agent Platform = MCP

实际上:

Agent Platform
 |
 +-- Runtime
 +-- MCP
 +-- Memory
 +-- Workflow
 +-- Security
 +-- Observability
 +-- Governance

MCP 只是其中一个重要组成部分。


十九、A2A:Agent Communication Layer

当 Agent 数量增加:

Research Agent
Coding Agent
Security Agent
Data Agent

Agent 之间需要协作。

这就是:

Agent-to-Agent Communication

可以通过:

A2A

进行。

架构:

Agent A
   |
   | A2A
   v
Agent B
   |
   | A2A
   v
Agent C

如果结合 MCP:

                 Agent Platform
                       |
          +------------+------------+
          |                         |
         A2A                       MCP
          |                         |
     Agent ↔ Agent             Agent ↔ Tool

二十、Event-Driven Agent Platform

如果再加入前面的 EDA:

Agent
 |
 +---- A2A ----> Agent
 |
 +---- MCP ----> Tool
 |
 +---- Event --> Event Bus

这三个通信模型分别解决不同问题:

A2A
Agent ↔ Agent

MCP
Agent ↔ Tool

EDA
Agent ↔ Event Ecosystem

这是构建大型 Agent Platform 非常重要的架构基础。


二十一、Agent Workflow Engine

企业 Agent 往往不是单步任务。

例如:

Research
Analyze
Generate Report
Review
Publish

这其实是:

Workflow。

因此 Agent Platform 通常需要 Workflow Engine。

Workflow
 |
 +-- Step 1: Research
 |
 +-- Step 2: Analysis
 |
 +-- Step 3: Generation
 |
 +-- Step 4: Review
 |
 +-- Step 5: Publish

每个 Step 可以是:

Agent
Tool
Human
API
Condition
Parallel Task

二十二、Agent Workflow 与传统 Workflow 的区别

传统 Workflow:

A
B
C

流程通常提前定义。

Agent Workflow:

A
Agent Decision
B / C / D ?

下一步可能由 Agent 决定。

因此:

Workflow Engine + Agent Runtime

是一个非常重要的组合。

可以理解为:

Workflow
     |
     v
Orchestration
     |
     v
Agent Runtime
     |
     v
Dynamic Decision

二十三、Human-in-the-Loop

企业 Agent 不可能所有事情都自动执行。

例如:

Agent
Transfer $100,000

应该:

Agent
Risk Check
Human Approval
Execute

Runtime 状态:

RUNNING
WAITING_FOR_APPROVAL
APPROVED
RUNNING
COMPLETED

所以 Human-in-the-Loop 应该成为 Runtime 的原生能力,而不是应用层临时拼接。


二十四、Agent Scheduler

企业中可能同时有:

1000 Agents
10000 Tasks

不能让所有任务直接创建线程。

需要:

Agent Scheduler

负责:

Priority
Queue
Concurrency
Resource
Quota
Scheduling
Retry
Timeout

例如:

Task Queue
 |
 +-- High Priority
 |
 +-- Normal
 |
 +-- Low

然后:

Scheduler
 |
 +---- Runtime Worker 1
 +---- Runtime Worker 2
 +---- Runtime Worker 3

这已经非常接近:

Distributed Job Scheduling System。


二十五、Agent Runtime 与 Kubernetes

如果 Agent Runtime 是:

Container

那么:

Kubernetes

负责:

Deployment
Scaling
Networking
Resource Isolation

可以设计:

                  Agent Platform
                       |
                       v
                  Kubernetes
                       |
          +------------+------------+
          |            |            |
       Runtime      Runtime      Runtime
        Pod          Pod          Pod

一个 Agent 不一定对应一个 Pod。

更合理的是:

Agent Definition
      |
      v
Runtime Pool
      |
 +----+----+----+
 |    |    |    |
 R1   R2   R3   R4

这样可以提高资源利用率。


二十六、Agent Runtime 的扩缩容

假设:

10:00
100 Tasks/sec

需要:

5 Runtime Workers

到了:

10:05
1000 Tasks/sec

自动扩容:

5
20
50 Workers

指标可以来自:

Queue Depth
Task Latency
CPU
Memory
LLM Rate
Token Usage

因此可以设计:

Agent-aware Autoscaling。


二十七、Model Gateway

Agent Platform 不能把 Agent 直接绑定到某一个模型。

例如:

Agent
 |
 v
Model Gateway
 |
 +---- OpenAI
 +---- Gemini
 +---- Claude
 +---- Local LLM
 +---- Enterprise Model

Model Gateway 负责:

Routing
Fallback
Load Balancing
Rate Limit
Cost Control
Model Selection
Observability

例如:

Simple Task
 → Cheap Model

Complex Reasoning
 → Reasoning Model

Sensitive Data
 → Private Model

这就是:

Model Routing。


二十八、Model Routing

可以根据:

Task Type
Latency
Cost
Context Size
Quality
Privacy
Availability

选择模型。

例如:

             Task
               |
               v
        Model Router
               |
      +--------+--------+
      |        |        |
      v        v        v
    Model A  Model B  Model C

甚至:

Simple → Small Model
Complex → Large Model
Coding → Coding Model
Vision → Vision Model

因此 Agent Platform 本身也是:

AI Model Orchestration Layer。


二十九、Policy Engine

Agent 可以做什么?

不能完全由 Prompt 决定。

例如:

Agent
 |
 +-- read database
 +-- update database
 +-- send email
 +-- transfer money

必须经过:

Policy Engine

例如:

IF agent.role == "researcher"
THEN database.read = ALLOW

IF agent.role == "researcher"
THEN database.write = DENY

更复杂:

User
 +
Agent
 +
Tool
 +
Data
 +
Environment

一起决定:

ALLOW
DENY
REQUIRE_APPROVAL

三十、Agent Security Architecture

企业 Agent Security 可以设计为:

User
 |
 v
Identity
 |
 v
Agent Identity
 |
 v
Policy Engine
 |
 v
Tool Access
 |
 v
Data Access

重点保护:

Prompt
Memory
Tool
Data
Credentials
Model
Event
Agent

特别需要关注:

Agent Privilege Escalation

例如:

Research Agent
     |
     v
Tool A
     |
     v
Database
     |
     v
Sensitive Table

必须通过:

RBAC
ABAC
OAuth
Workload Identity
Secret Management
Policy Engine

进行控制。


三十一、Agent Observability

传统微服务:

Request
Service
Database

Agent:

User Request
Agent
LLM
Tool
Agent
LLM
Agent B
Tool
Result

因此需要观察:

Agent Trace
LLM Trace
Tool Trace
A2A Trace
Workflow Trace
Memory Trace

三十二、Agent Trace

一个完整 Trace:

Trace
 |
 +-- Agent Task
      |
      +-- LLM Call
      |
      +-- Tool Call
      |
      +-- LLM Call
      |
      +-- A2A Call
      |     |
      |     +-- Agent B
      |
      +-- Final Response

每个 Span:

traceId
spanId
parentSpanId
agentId
taskId
toolId
model
latency
tokens
cost

这与 OpenTelemetry 非常契合。


三十三、Agent Metrics

至少应该监控:

Runtime

Task Throughput
Task Latency
Task Failure Rate
Queue Depth
Concurrency

LLM

Token Usage
Latency
Cost
Error Rate

Tool

Tool Call Count
Tool Latency
Tool Failure
Retry

Agent

Success Rate
Average Steps
Average Tool Calls
Completion Rate

三十四、Agent Evaluation

传统系统:

Unit Test
Integration Test
Performance Test

Agent:

Evaluation

因为:

Input

相同情况下:

Output

可能不同。

所以 Agent Platform 必须建立:

Agent Evaluation Framework。


三十五、Agent Evaluation Pipeline

可以设计:

Agent Version
      |
      v
Evaluation Dataset
      |
      v
Run Agent
      |
      v
Evaluator
      |
 +----+----+
 |         |
 v         v
Quality   Safety
 |
 v
Score
 |
 v
Release / Reject

指标:

Accuracy
Relevance
Faithfulness
Tool Accuracy
Task Completion
Safety
Cost
Latency

三十六、Agent Versioning

Agent 不只是代码版本。

可能同时有:

Agent Version
Prompt Version
Model Version
Tool Version
Workflow Version
Knowledge Version
Policy Version

因此:

Agent v3

可能意味着:

Prompt v7
Model v2
Tool Set v4
Workflow v5
Policy v3

这就要求 Agent Platform 支持:

Reproducibility。

即:

能够还原某一次 Agent 执行到底使用了什么配置。


三十七、Agent Release Pipeline

Agent 应该像软件一样发布:

Development
Test
Evaluation
Canary
Production

例如:

Agent v2
 |
 +-- 5% Traffic
 |
 +-- Evaluation
 |
 +-- Monitor
 |
 +-- 100%

失败:

v2
Rollback
v1

因此:

Agent Platform 最终会越来越接近 DevOps Platform。


三十八、Agent CI/CD

完整流程:

Git
 |
 v
Agent Definition
 |
 v
Build
 |
 v
Unit Test
 |
 v
Evaluation
 |
 v
Security Scan
 |
 v
Canary
 |
 v
Production

这就是:

AgentOps / LLMOps。


三十九、Agent Platform 与传统 Platform Engineering

传统 Platform Engineering:

Developer
   |
   v
Developer Platform
   |
 +-- CI/CD
 +-- Kubernetes
 +-- Database
 +-- Observability
 +-- Security

Agent Platform:

Agent Developer
   |
   v
Agent Platform
   |
 +-- Agent Runtime
 +-- Model Gateway
 +-- Tool Platform
 +-- Memory
 +-- Knowledge
 +-- Workflow
 +-- A2A
 +-- MCP
 +-- Evaluation
 +-- Observability

因此可以认为:

Agent Platform 是 Platform Engineering 在 AI Agent 时代的一次演进。


四十、Agent Platform 的数据模型

一个比较完整的数据模型可以是:

Tenant
  |
  +-- User
  |
  +-- Agent
       |
       +-- Version
       |
       +-- Model
       |
       +-- Tools
       |
       +-- Memory
       |
       +-- Policy
       |
       +-- Workflow
       |
       +-- Deployment

运行时:

Agent
 |
 +-- Task
      |
      +-- Session
      |
      +-- Execution
           |
           +-- Step
           +-- LLM Call
           +-- Tool Call
           +-- Event

这形成一个非常重要的关系:

Definition
Deployment
Task
Execution
Step

四十一、Agent Session 与 Task 的区别

这两个概念不要混淆。

Session

代表:

一段持续的交互上下文。

例如:

User
 |
 +-- Session 1001
       |
       +-- Task 1
       +-- Task 2
       +-- Task 3

Task

代表:

一个具体执行目标。

例如:

Task:
Analyze this report

因此:

Session
   |
   +-- Task
   +-- Task
   +-- Task

是更加合理的设计。


四十二、Agent Execution Record

生产系统必须记录:

Execution ID
Agent ID
Version
Task ID
Start Time
End Time
Model
Tokens
Tools
Events
Result
Status
Error
Cost

例如:

{
  "executionId": "exec-1001",
  "agentId": "research-agent",
  "version": "3.1",
  "status": "COMPLETED",
  "steps": 7,
  "tokens": 12500,
  "toolCalls": 4,
  "latencyMs": 18400,
  "cost": 0.31
}

这些数据最终可以进入:

Analytics
Observability
Billing
Evaluation
Audit

四十三、Agent Event Model

Agent Platform 可以定义统一 Event:

AgentCreated
AgentDeployed
AgentStarted
AgentStepStarted
AgentStepCompleted
LLMCalled
ToolCalled
ToolCompleted
AgentWaiting
HumanApprovalRequested
AgentCompleted
AgentFailed
AgentCancelled

然后进入:

Event Bus

架构:

Agent Runtime
      |
      v
   Event Bus
      |
 +----+----+----+----+
 |    |    |    |    |
Audit Billing BI Observability

这就是:

Event-Driven Agent Platform


四十四、为什么 Agent Platform 最终一定会事件化?

因为 Agent 的运行天然具有:

Long Running
Async
Multi-Step
Distributed
Stateful
Human Interaction
Tool Invocation
Agent Collaboration

这些特点。

例如:

AgentStarted
ToolCalled
ToolCompleted
AgentWaiting
HumanApproved
AgentResumed
AgentCompleted

这本质上就是:

Event-driven State Machine。

因此:

Agent Runtime
+
Event Bus

很可能成为未来 Agent Platform 的核心组合。


四十五、Long-Running Agent

传统 HTTP:

Request
Response

可能只需要:

100ms

但 Agent Task:

Research
Search
Analyze
Read documents
Call tools
Generate report

可能持续:

5 min
30 min
2 hours

因此不能:

HTTP Connection
一直保持

更合理:

POST /tasks
       |
       v
Task Created
       |
       v
202 Accepted

客户端通过:

GET /tasks/{id}

或者:

WebSocket
SSE
Event
Webhook

获取状态。


四十六、Agent Runtime 的 Checkpoint

Long-running Agent 必须支持:

Checkpoint。

例如:

Step 1 ✓
Step 2 ✓
Step 3 ✓
Step 4
Step 5

如果 Runtime Crash:

Restart

不能:

从 Step 1 重新执行

而应该:

Checkpoint
Resume Step 4

因此:

Task State
+
Execution State
+
Checkpoint

是生产级 Runtime 的核心能力。


四十七、Agent Failure Model

Agent 失败可以分为:

LLM Failure
Tool Failure
Network Failure
Timeout
Rate Limit
Policy Violation
Context Overflow
Invalid Output
Agent Logic Failure
Resource Exhaustion

不同错误需要不同处理:

Transient
   → Retry

Rate Limit
   → Backoff

Tool Failure
   → Alternative Tool

Policy Violation
   → Stop

Context Overflow
   → Compression

Human Approval
   → Wait

所以:

Agent Runtime 本质上也是一个复杂的 Failure Management System。


四十八、Agent Platform 的核心抽象

如果让我从架构设计角度提炼 Agent Platform,最核心的是下面十个对象:

1. Agent
2. Model
3. Tool
4. Task
5. Session
6. Memory
7. Workflow
8. Policy
9. Execution
10. Event

关系可以表示为:

Agent
 |
 +-- Model
 +-- Tools
 +-- Memory
 +-- Policy
 +-- Workflow
 |
 v
Task
 |
 v
Execution
 |
 +-- Steps
 +-- LLM Calls
 +-- Tool Calls
 +-- Events

这套抽象比具体框架更加重要。


四十九、Agent Platform 与微服务平台的对比

微服务平台Agent Platform
ServiceAgent
APITool
RPCA2A
API GatewayAgent Gateway
Service RegistryAgent Registry
KubernetesRuntime Infrastructure
WorkflowAgent Workflow
RedisMemory
KafkaAgent Event Bus
OpenTelemetryAgent Observability
IAMAgent Identity
CI/CDAgentOps
MonitoringAgent Evaluation

可以看到:

Agent Platform 并不是完全重新发明基础设施,而是在 Cloud Native / Distributed Systems 基础上增加了一层 AI Runtime。


五十、一个企业级 Agent Platform 的参考架构

最终可以形成:

                         Users / Applications
                                  |
                                  v
                         ┌─────────────────┐
                         │ Agent Gateway   │
                         └────────┬────────┘
                                  |
                                  v
                    ┌──────────────────────────┐
                    │      Control Plane       │
                    │                          │
                    │ Agent Registry           │
                    │ Agent Version            │
                    │ Policy                   │
                    │ Workflow                 │
                    │ Model Routing             │
                    │ Deployment               │
                    └────────────┬─────────────┘
                                 |
                                 v
                    ┌──────────────────────────┐
                    │      Agent Runtime       │
                    │                          │
                    │ Task Manager             │
                    │ Execution Engine         │
                    │ Context Engine            │
                    │ State Manager             │
                    │ Memory Manager            │
                    │ Tool Executor             │
                    │ Checkpoint                │
                    └───────┬─────────┬────────┘
                            |         |
                     ┌──────┘         └──────┐
                     v                       v
               ┌──────────┐             ┌──────────┐
               │   Model  │             │   MCP    │
               │ Gateway  │             │  Tools   │
               └──────────┘             └──────────┘
                     |
                     v
              ┌──────────────┐
              │     A2A      │
              │ Agent Mesh   │
              └──────┬───────┘
                     |
                     v
              ┌──────────────┐
              │ Event Bus    │
              │ Kafka/Pulsar │
              └──────┬───────┘
                     |
        +------------+-------------+
        |            |             |
        v            v             v
     Audit        Billing      Analytics

        ┌───────────────────────────────┐
        │ Platform Infrastructure      │
        │                               │
        │ Memory / Knowledge / DB       │
        │ OpenTelemetry / Prometheus    │
        │ Security / IAM / Secrets      │
        │ Evaluation / Governance       │
        └───────────────────────────────┘

五十一、Agent Platform 的关键设计原则

原则 1:Agent 与 Runtime 解耦

不要:

Agent = Runtime

应该:

Agent Definition
       |
       v
Runtime

这样 Agent 才能迁移和扩展。


原则 2:Control Plane 与 Data Plane 分离

Control Plane
     |
     v
Data Plane

这样才能支持大规模 Agent。


原则 3:所有执行都应该 Task 化

不要:

HTTP → Agent → Response

而应该:

Request
Task
Execution

原则 4:所有执行都应该可观测

必须回答:

Agent 做了什么?
为什么调用这个 Tool?
调用了哪个 Model?
用了多少 Token?
花了多少钱?
为什么失败?

原则 5:所有 Tool 都应该经过治理

Agent
Tool Gateway
Policy
Tool

而不是:

Agent → arbitrary API

原则 6:Agent 必须支持版本化

Agent
Prompt
Model
Tool
Workflow
Policy

都需要版本。


原则 7:Agent 必须支持恢复

Checkpoint
Resume

对于 Long-running Agent 尤其重要。


五十二、Agent Platform 的最终架构认知

如果把整个技术体系压缩成一张图:

                        Agent Platform
                              |
             +----------------+----------------+
             |                                 |
        Control Plane                     Data Plane
             |                                 |
       Agent Registry                  Agent Runtime
       Version                         Task
       Policy                          Execution
       Deployment                      State
       Routing                         Context
             |                         Memory
             |                         Tool
             |                         Workflow
             |                              |
             +--------------+---------------+
                            |
             +--------------+--------------+
             |              |              |
            MCP            A2A            EDA
             |              |              |
           Tools          Agents         Events
                            |
                            v
                     Platform Services
                            |
        +-------------------+-------------------+
        |          |         |         |        |
      Model      Memory    Security   Eval   Observe

最终形成一个完整的:

Agent Operating Platform


五十三、Agent Platform 的本质

如果只记住一句话,我建议记住:

Agent Platform 不是一个 Agent Framework,而是一套面向 Agent 生命周期、执行过程和企业治理的基础设施。

它解决的是:

Build
Register
Deploy
Run
Collaborate
Observe
Evaluate
Govern
Upgrade

也就是:

Agent Lifecycle Management。

而 Agent Runtime 是其中的核心执行引擎:

Agent Platform
      |
      v
Agent Runtime
      |
      +-- LLM
      +-- Memory
      +-- Tool
      +-- Workflow
      +-- A2A
      +-- MCP
      +-- Event

再向下连接:

Kubernetes
Kafka
Redis
PostgreSQL
OpenTelemetry
IAM
Secrets

这就把你之前学习的几个方向真正连接起来了:

                    Agent Platform
                           |
          +----------------+----------------+
          |                |                |
     Agent Runtime         |           Control Plane
          |                |
    +-----+-----+          |
    |     |     |          |
   LLM  MCP   Memory       |
          |                |
          +-------+--------+
                  |
                 A2A
                  |
              Multi-Agent
                  |
                  v
                 EDA
                  |
                Kafka
                  |
        +---------+---------+
        |         |         |
      Event     Audit     Analytics
                  |
                  v
            Observability
                  |
            OpenTelemetry
                  |
             Prometheus
                  |
               Grafana

因此,如果从企业级 AI 架构师的角度来看,真正值得掌握的不是某一个 Agent Framework,而是这一整套架构:

Agent → Runtime → Platform → Infrastructure

这是从“会开发 Agent”走向“能够设计企业级 Agent Platform”的关键一步。

下一步你更想深入哪一块:① Agent Runtime 内核设计,② Agent Platform 微服务架构,③ Agent Platform + Kubernetes 落地?

Vincent zhai
Vincent zhai
Full-Stack Engineer