katanemo/plano

GitHub: katanemo/plano

面向 Agentic 应用的 AI 原生代理服务器与数据平面,统一处理编排、安全护栏、可观测性和 LLM 路由。

Stars: 5813 | Forks: 346

Plano Logo
_面向 Agentic 应用的 AI 原生代理服务器与数据平面。_

Plano 解决了繁琐的基础设施工作,并将您从脆弱的框架抽象中解耦出来,集中管理那些不应在每个代码库中定制的功能——例如 Agent 路由和编排、用于持续改进的丰富 Agentic 信号与追踪、用于安全和内容审核的护栏过滤器,以及用于实现模型敏捷性的智能 LLM 路由 API。您可以使用任何语言或 AI 框架,更快地将 Agent 部署到生产环境。 [快速入门指南](https://docs.planoai.dev/get_started/quickstart.html) • [使用 Plano 构建 Agentic 应用](#Build-Agentic-Apps-with-Plano) • [文档](https://docs.planoai.dev) • [联系我们](#Contact) [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/19a7f7580e154208.svg)](https://github.com/katanemo/plano/actions/workflows/ci.yml) [![Docker Image](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/0b045c0154154209.svg)](https://github.com/katanemo/plano/actions/workflows/docker-push-main.yml) [![Build and Deploy Documentation](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/d6e0c0c2d2154210.svg)](https://github.com/katanemo/plano/actions/workflows/static.yml)
# 概述 构建 Agentic 演示很容易。但要将 Agentic 应用安全、可靠且可重复地发布到生产环境却很难。在快速 hack 的快感过后,您最终需要构建“隐藏的中间件”才能投入生产:用于到达正确 Agent 的路由逻辑、用于安全和内容审核的护栏钩子、用于持续学习的评估和可观测性粘合代码,以及散落在框架和应用代码中的模型/供应商特性处理。 Plano 通过将核心交付关注点转移到统一的、进程外的数据平面来解决这一问题。 - **🚦 编排:** Agent 之间的低延迟编排;无需修改应用代码即可添加新 Agent。 - **🔗 模型敏捷性:** [按模型名称、别名(语义名称)或通过偏好自动路由](#use-plano-as-a-llm-router)。 - **🕵 Agentic Signals™:** 零代码捕获跨每个 Agent 的 [Signals](https://docs.planoai.dev/concepts/signals.html) 以及 OTEL 追踪/指标。 - **🛡️ 内容审核与记忆钩子:** 通过 [Filter Chains](https://docs.planoai.dev/concepts/filter_chain.html) 一致地构建越狱保护、添加内容审核策略和记忆。 Plano 将繁琐的基础设施工作从您的框架中剥离出来,让您专注于最重要的东西:您的 Agentic 应用的核心产品逻辑。Plano 由[业界领先的 LLM 研究](https://planoai.dev/research)支持,并由 [Envoy](https://envoyproxy.io) 的核心贡献者构建,他们曾为现代工作负载构建了大规模的关键基础设施。 **高层网络序列图**: ![high-level network plano arcitecture for Plano](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/a029c4c794154212.png) **跳转到我们的[文档](https://docs.planoai.dev)**,了解如何使用 Plano 提高 Agentic 应用的速度、安全性和可观测性。 ## 使用 Plano 构建 Agentic 应用 Plano 将**编排、模型管理和可观测性**作为模块化构建块处理——允许您仅配置所需的功能(用于 Agentic 编排和护栏的边缘代理,或来自您服务的 LLM 路由,或两者兼有),以便干净地集成到现有架构中。下面是一个使用 Plano 构建的简单多 Agent 旅行 Agent,展示了所有三个核心功能。 ### 1. 在 YAML 中定义您的 Agent ``` # config.yaml version: v0.3.0 # 你声明的内容:Agent URLs 和自然语言描述 # 你无需编写的部分:Intent classifiers、routing logic、model fallbacks、provider adapters 或 tracing instrumentation agents: - id: weather_agent url: http://localhost:10510 - id: flight_agent url: http://localhost:10520 model_providers: - model: openai/gpt-4o access_key: $OPENAI_API_KEY default: true - model: anthropic/claude-3-5-sonnet access_key: $ANTHROPIC_API_KEY listeners: - type: agent name: travel_assistant port: 8001 router: plano_orchestrator_v1 # Powered by our 4B-parameter routing model. You can change this to different models agents: - id: weather_agent description: | Gets real-time weather and forecasts for any city worldwide. Handles: "What's the weather in Paris?", "Will it rain in Tokyo?" - id: flight_agent description: | Searches flights between airports with live status and schedules. Handles: "Flights from NYC to LA", "Show me flights to Seattle" tracing: random_sampling: 100 # Auto-capture traces for evaluation ``` ### 2. 编写简单的 Agent 代码 您的 Agent 只是实现了 OpenAI 兼容 chat completions 端点的 HTTP 服务器。使用任何语言或框架: ``` # weather_agent.py from fastapi import FastAPI, Request from fastapi.responses import StreamingResponse from openai import AsyncOpenAI app = FastAPI() # 指向 Plano 的 LLM gateway - 它会为你处理 model routing llm = AsyncOpenAI(base_url="http://localhost:12001/v1", api_key="EMPTY") @app.post("/v1/chat/completions") async def chat(request: Request): body = await request.json() messages = body.get("messages", []) days = 7 # Your agent logic: fetch data, call APIs, run tools # See demos/agent_orchestration/travel_agents/ for the full implementation weather_data = await get_weather_data(request, messages, days) # Stream the response back through Plano async def generate(): stream = await llm.chat.completions.create( model="openai/gpt-4o", messages=[{"role": "system", "content": f"Weather: {weather_data}"}, *messages], stream=True ) async for chunk in stream: yield f"data: {chunk.model_dump_json()}\n\n" return StreamingResponse(generate(), media_type="text/event-stream") ``` ### 3. 启动 Plano 并查询您的 Agent **前置条件:** 按照[前置条件指南](https://docs.planoai.dev/get_started/quickstart.html#prerequisites)安装 Plano 并设置您的环境。 ``` # 启动 Plano planoai up config.yaml ... # 查询 - Plano 在单次对话中智能路由到两个 agents curl http://localhost:8001/v1/chat/completions \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-4o", "messages": [ {"role": "user", "content": "I want to travel from NYC to Paris next week. What is the weather like there, and can you find me some flights?"} ] }' # → Plano 路由到 weather_agent 查询巴黎天气 ✓ # → 然后路由到 flight_agent 查询 NYC → Paris 航班 ✓ # → 返回包含天气信息和航班选项的完整旅行计划 ``` ### 4. 免费获得可观测性和模型敏捷性 每个请求都通过 OpenTelemetry 进行端到端追踪——无需检测代码。 ![Atomatic Tracing](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/2f3df06d08154213.png) ### 您无需构建的内容 | 基础设施关注点 | 没有 Plano 时 | 有 Plano 时 | |---------|---------------|------------| | **Agent 编排** | 编写意图分类器 + 路由逻辑 | 在 YAML 中声明 Agent 描述 | | **模型管理** | 处理每个供应商的 API 特性 | 具有状态管理的统一 LLM API | | **丰富追踪** | 使用 OTEL 检测每个服务 | 自动端到端追踪和日志 | | **学习信号** | 构建管道以捕获/导出 Spans | 零代码 Agentic 信号 | | **添加 Agent** | 更新路由代码,测试,重新部署 | 添加到配置,重启 | **为何高效:** Plano 使用专用的轻量级 LLM(例如我们的 4B 参数编排器),而不是重型框架或 GPT-4 进行路由——以极低的成本和延迟为您提供生产级的路由。 ## 联系我们 要与我们取得联系,请加入我们的 [discord server](https://discord.gg/pGZf2gcwEc)。我们会积极监控并在那里提供支持。 ## 开始使用 准备好尝试 Plano 了吗?查看我们的综合文档: - **[快速入门指南](https://docs.planoai.dev/get_started/quickstart.html)** - 几分钟内即可启动并运行 - **[LLM 路由](https://docs.planoai.dev/guides/llm_router.html)** - 按模型名称、别名或智能偏好进行路由 - **[Agent 编排](https://docs.planoai.dev/guides/orchestration.html)** - 构建多 Agent 工作流 - **[Filter Chains](https://docs.planoai.dev/concepts/filter_chain.html)** - 添加护栏、内容审核和记忆钩子 - **[Prompt Targets](https://docs.planoai.dev/concepts/prompt_target.html)** - 将 Prompt 转换为确定性 API 调用 - **[可观测性](https://docs.planoai.dev/guides/observability/observability.html)** - 追踪、指标和日志 ## 贡献 我们非常希望收到关于我们 [Roadmap](https://github.com/orgs/katanemo/projects/1) 的反馈,也欢迎对 **Plano** 的贡献!无论您是修复错误、添加新功能、改进文档还是创建教程,我们都非常感谢您的帮助。请访问我们的 [贡献指南](CONTRIBUTING.md) 了解更多详情。 如果您觉得 Plano 有用,请给仓库点个 Star ⭐️ —— 新版本和更新会首先发布在这里。
标签:Agentic Apps, AI代理, AI开发框架, API集成, DLL 劫持, Docker, LLM路由, Python, 中间件, 人工智能, 代理编排, 内容审核, 可观测性, 基础设施, 大语言模型, 安全护栏, 安全防御评估, 数据平面, 无后门, 智能路由, 流量管理, 生产环境部署, 用户代理, 用户模式Hook绕过, 网关, 网络调试, 自动化, 请求拦截, 逆向工具, 通知系统, 通知系统, 通知系统