© 2026FindAgent  · @simprr
返回列表
A

AgentOps-AI/agentops

Python SDK for AI agent monitoring, LLM cost tracking, benchmarking, and more. Integrates with most LLMs and agent frameworks including CrewAI, Agno, OpenAI Agents SDK, Langchain, Autogen, AG2, and CamelAI

agentagentopsagents-sdkaianthropicautogencost-estimationcrewaievalsevaluation-metricsgroqlangchainllmmistralollamaopenaiopenai-agents
⭐

5.4k

Stars

🔱

553

Forks

👁

51

Watchers

📋

136

Issues

PythonMIT创建于 2023/8/15更新于 今天
在 GitHub 上查看访问主页
README
由 Gemini 翻译整理

AgentOps

AI Agent 的可观测性与开发工具平台

AgentOps 致力于帮助开发者构建、评估和监控 AI Agent。涵盖从原型设计到生产部署的全过程。

开源声明

AgentOps 应用在 MIT 许可协议下开源。欢迎访问我们的 app 目录 查看源代码。

核心集成 🔌

📊 回放分析与调试分步 Agent 执行图表
💸 LLM 成本管理跟踪 LLM 基础模型提供商的支出
🤝 框架集成原生集成 CrewAI、AG2 (AutoGen)、Agno、LangGraph 等
⚒️ 自托管想在自己的云端运行 AgentOps?完全支持

快速上手 ⌨️

pip install agentops

仅需两行代码实现会话回放

初始化 AgentOps 客户端,即可自动获取所有 LLM 调用的分析数据。

获取 API key

import agentops

# 程序开头 (例如 main.py, __init__.py)
agentops.init( )

...

# 程序结束
agentops.end_session('Success')

您可以在 AgentOps 控制台 查看所有会话。

自托管

如果您希望在本地运行完整的 AgentOps 应用(控制台 + API 后端),请按照 app/README.md 中的设置指南操作:

  • 运行应用与后端 (控制台 + API)

一流的开发者体验

通过尽可能少的代码,为您的 Agent、工具和函数添加强大的可观测性:逐行实现。

请参考我们的 文档

# 创建一个 session span (所有其他 span 的根节点)
from agentops.sdk.decorators import session

@session
def my_workflow():
    # 在此处编写会话代码
    return result
# 创建一个 agent span 用于跟踪 Agent 操作
from agentops.sdk.decorators import agent

@agent
class MyAgent:
    def __init__(self, name):
        self.name = name
        
    # 在此处编写 Agent 方法
# 创建 operation/task span 以跟踪特定操作
from agentops.sdk.decorators import operation, task

@operation  # 或 @task
def process_data(data):
    # 处理数据
    return result
# 创建 workflow span 以跟踪多操作工作流
from agentops.sdk.decorators import workflow

@workflow
def my_workflow(data):
    # 工作流实现
    return result
# 嵌套装饰器以构建正确的 span 层级
from agentops.sdk.decorators import session, agent, operation

@agent
class MyAgent:
    @operation
    def nested_operation(self, message):
        return f"Processed: {message}"
        
    @operation
    def main_operation(self):
        result = self.nested_operation("test message")
        return result

@session
def my_session():
    agent = MyAgent()
    return agent.main_operation()

所有装饰器均支持:

  • 输入/输出记录
  • 异常处理
  • Async/await 函数
  • 生成器函数
  • 自定义属性和名称

集成 🦾

OpenAI Agents SDK 🖇️

利用工具、移交(handoffs)和护栏(guardrails)构建多 Agent 系统。AgentOps 为 Python 和 TypeScript 的 OpenAI Agents SDK 提供了原生集成。

Python

pip install openai-agents
  • Python 集成指南
  • OpenAI Agents Python 文档

TypeScript

npm install agentops @openai/agents
  • TypeScript 集成指南
  • OpenAI Agents JS 文档

CrewAI 🛶

仅需两行代码即可为 Crew Agent 添加可观测性。只需在环境变量中设置 AGENTOPS_API_KEY,您的 Crew 就会自动在 AgentOps 控制台上进行监控。

pip install 'crewai[agentops]'
  • AgentOps 集成示例
  • CrewAI 官方文档

AG2 🤖

只需两行代码,即可为 AG2(前身为 AutoGen)Agent 添加全面的可观测性和监控功能。在环境变量中设置 AGENTOPS_API_KEY 并调用 agentops.init()。

  • AG2 可观测性示例
贡献者
aHbsDdtdfg
项目信息
默认分支main
LicenseMIT License
创建时间2023/8/15
最近更新今天
GAI 中文摘要

AgentOps 是一个专为 AI Agent 开发设计的全生命周期监测与评估平台。它通过提供深度可见性工具,帮助开发者解决 AI 代理在构建、调试及生产环境部署过程中遇到的难以追踪与评估的问题。

提供实时代理执行监控,详细记录从交互链路到任务执行的每一个步骤。 集成多维度的 LLM 成本与性能追踪功能,帮助用户精准管理与分析算力开销。 支持自动化基准测试与评估指标分析,协助开发者对比不同方案效果以优化代理性能。 具备极强的生态兼容性,无缝集成 CrewAI、Langchain、AutoGen 等主流代理框架及多种主流大模型。

该项目适用于正在开发或运行复杂 AI 代理应用的软件工程师与研发团队,特别是在需要深度分析代理行为、控制运营成本及进行生产环境质量保障的场景中具有重要价值。