{
  "canonical_name": "openlit/openlit",
  "compilation_id": "pack_cf6e6791db7e4e8cab77f877e5344c40",
  "created_at": "2026-05-16T21:13:00.822719+00:00",
  "created_by": "project-pack-compiler",
  "feedback": {
    "carrier_selection_notes": [
      "viable_asset_types=prompt, recipe, host_instruction, eval, preflight",
      "recommended_asset_types=prompt, recipe, host_instruction, eval, preflight"
    ],
    "evidence_delta": {
      "confirmed_claims": [
        "identity_anchor_present",
        "capability_and_host_targets_present",
        "install_path_declared_or_better"
      ],
      "missing_required_fields": [],
      "must_verify_forwarded": [
        "Run or inspect `pip install openlit` in an isolated environment.",
        "Confirm the project exposes the claimed capability to at least one target host."
      ],
      "quickstart_execution_scope": "allowlisted_sandbox_smoke",
      "sandbox_command": "pip install openlit",
      "sandbox_container_image": "python:3.12-slim",
      "sandbox_execution_backend": "docker",
      "sandbox_planner_decision": "llm_execute_isolated_install",
      "sandbox_validation_id": "sbx_7a347252a92446b598c1b1d2c454d187"
    },
    "feedback_event_type": "project_pack_compilation_feedback",
    "learning_candidate_reasons": [],
    "template_gaps": []
  },
  "identity": {
    "canonical_id": "project_f5114bcff7bb9c22130b8491cafb6ec8",
    "canonical_name": "openlit/openlit",
    "homepage_url": null,
    "license": "unknown",
    "repo_url": "https://github.com/openlit/openlit",
    "slug": "openlit",
    "source_packet_id": "phit_89ffc7f190094e568bb47dc3666592de",
    "source_validation_id": "dval_bc021b9f126d4942b10ce3ce4d4df599"
  },
  "merchandising": {
    "best_for": "需要软件开发与交付能力，并使用 local_cli的用户",
    "github_forks": 276,
    "github_stars": 2446,
    "one_liner_en": "Open source platform for AI Engineering: OpenTelemetry-native LLM Observability, GPU Monitoring, Guardrails, Evaluations, Prompt Management, Vault, Playground. 🚀💻 Integrates with 50+ LLM Providers, VectorDBs, Agent Frameworks and GPUs.",
    "one_liner_zh": "Open source platform for AI Engineering: OpenTelemetry-native LLM Observability, GPU Monitoring, Guardrails, Evaluations, Prompt Management, Vault, Playground. 🚀💻 Integrates with 50+ LLM Providers, VectorDBs, Agent Frameworks and GPUs.",
    "primary_category": {
      "category_id": "software-development",
      "confidence": "medium",
      "name_en": "Software Development",
      "name_zh": "软件开发与交付",
      "reason": "matched_keywords:git, cli"
    },
    "target_user": "使用 local_cli 等宿主 AI 的用户",
    "title_en": "openlit",
    "title_zh": "openlit 能力包",
    "visible_tags": [
      {
        "label_en": "MCP Tools",
        "label_zh": "MCP 工具",
        "source": "repo_evidence_project_characteristics",
        "tag_id": "product_domain-mcp-tools",
        "type": "product_domain"
      },
      {
        "label_en": "Knowledge Base Q&A",
        "label_zh": "知识库问答",
        "source": "repo_evidence_project_characteristics",
        "tag_id": "user_job-knowledge-base-q-a",
        "type": "user_job"
      },
      {
        "label_en": "Workflow Automation",
        "label_zh": "流程自动化",
        "source": "repo_evidence_project_characteristics",
        "tag_id": "core_capability-workflow-automation",
        "type": "core_capability"
      },
      {
        "label_en": "Checkpoint Resume",
        "label_zh": "断点恢复流程",
        "source": "repo_evidence_project_characteristics",
        "tag_id": "workflow_pattern-checkpoint-resume",
        "type": "workflow_pattern"
      },
      {
        "label_en": "Evaluation Suite",
        "label_zh": "评测体系",
        "source": "repo_evidence_project_characteristics",
        "tag_id": "selection_signal-evaluation-suite",
        "type": "selection_signal"
      }
    ]
  },
  "packet_id": "phit_89ffc7f190094e568bb47dc3666592de",
  "page_model": {
    "artifacts": {
      "artifact_slug": "openlit",
      "files": [
        "PROJECT_PACK.json",
        "QUICK_START.md",
        "PROMPT_PREVIEW.md",
        "HUMAN_MANUAL.md",
        "AI_CONTEXT_PACK.md",
        "BOUNDARY_RISK_CARD.md",
        "PITFALL_LOG.md",
        "REPO_INSPECTION.json",
        "REPO_INSPECTION.md",
        "CAPABILITY_CONTRACT.json",
        "EVIDENCE_INDEX.json",
        "CLAIM_GRAPH.json"
      ],
      "required_files": [
        "PROJECT_PACK.json",
        "QUICK_START.md",
        "PROMPT_PREVIEW.md",
        "HUMAN_MANUAL.md",
        "AI_CONTEXT_PACK.md",
        "BOUNDARY_RISK_CARD.md",
        "PITFALL_LOG.md",
        "REPO_INSPECTION.json"
      ]
    },
    "detail": {
      "capability_source": "Project Hit Packet + DownstreamValidationResult",
      "commands": [
        {
          "command": "pip install openlit",
          "label": "Python / pip · 官方安装入口",
          "source": "https://github.com/openlit/openlit#readme",
          "verified": true
        }
      ],
      "display_tags": [
        "MCP 工具",
        "知识库问答",
        "流程自动化",
        "断点恢复流程",
        "评测体系"
      ],
      "eyebrow": "软件开发与交付",
      "glance": [
        {
          "body": "判断自己是不是目标用户。",
          "label": "最适合谁",
          "value": "需要软件开发与交付能力，并使用 local_cli的用户"
        },
        {
          "body": "先理解能力边界，再决定是否继续。",
          "label": "核心价值",
          "value": "Open source platform for AI Engineering: OpenTelemetry-native LLM Observability, GPU Monitoring, Guardrails, Evaluations, Prompt Management, Vault, Playground. 🚀💻 Integrates with 50+ LLM Providers, VectorDBs, Agent Frameworks and GPUs."
        },
        {
          "body": "未完成验证前保持审慎。",
          "label": "继续前",
          "value": "publish to Doramagic.ai project surfaces"
        }
      ],
      "guardrail_source": "Boundary & Risk Card",
      "guardrails": [
        {
          "body": "Prompt Preview 只展示流程，不证明项目已安装或运行。",
          "label": "Check 1",
          "value": "不要把试用当真实运行"
        },
        {
          "body": "local_cli",
          "label": "Check 2",
          "value": "确认宿主兼容"
        },
        {
          "body": "publish to Doramagic.ai project surfaces",
          "label": "Check 3",
          "value": "先隔离验证"
        }
      ],
      "mode": "prompt, recipe, host_instruction, eval, preflight",
      "pitfall_log": {
        "items": [
          {
            "body": "GitHub 社区证据显示该项目存在一个安装相关的待验证问题：Integration: Governance and compliance signals for LLM observability",
            "category": "安装坑",
            "evidence": [
              "community_evidence:github | cevd_16e8a1979e4646f18ae6d36da1fd46fe | https://github.com/openlit/openlit/issues/1106 | 来源类型 github_issue 暴露的待验证使用条件。"
            ],
            "severity": "medium",
            "suggested_check": "来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。",
            "title": "来源证据：Integration: Governance and compliance signals for LLM observability",
            "user_impact": "可能增加新用户试用和生产接入成本。"
          },
          {
            "body": "GitHub 社区证据显示该项目存在一个安装相关的待验证问题：Proposal: gen_ai.agent.threat_detected span event helper for OTel-shaped detection observability",
            "category": "安装坑",
            "evidence": [
              "community_evidence:github | cevd_9788255c9fb34a7eae64ba6413a52030 | https://github.com/openlit/openlit/issues/1186 | 来源讨论提到 python 相关条件，需在安装/试用前复核。"
            ],
            "severity": "medium",
            "suggested_check": "来源问题仍为 open，Pack Agent 需要复核是否仍影响当前版本。",
            "title": "来源证据：Proposal: gen_ai.agent.threat_detected span event helper for OTel-shaped detection observability",
            "user_impact": "可能增加新用户试用和生产接入成本。"
          },
          {
            "body": "GitHub 社区证据显示该项目存在一个安装相关的待验证问题：[Bug]: Docker Image doesn't run on windows 64bit",
            "category": "安装坑",
            "evidence": [
              "community_evidence:github | cevd_e25a08120daf4deb81b9193aeab1f929 | https://github.com/openlit/openlit/issues/786 | 来源讨论提到 docker 相关条件，需在安装/试用前复核。"
            ],
            "severity": "medium",
            "suggested_check": "来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。",
            "title": "来源证据：[Bug]: Docker Image doesn't run on windows 64bit",
            "user_impact": "可能增加新用户试用和生产接入成本。"
          },
          {
            "body": "GitHub 社区证据显示该项目存在一个安装相关的待验证问题：openlit-1.19.0",
            "category": "安装坑",
            "evidence": [
              "community_evidence:github | cevd_0504e467960f4bbe919ff101c6a14d7b | https://github.com/openlit/openlit/releases/tag/openlit-1.19.0 | 来源类型 github_release 暴露的待验证使用条件。"
            ],
            "severity": "medium",
            "suggested_check": "来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。",
            "title": "来源证据：openlit-1.19.0",
            "user_impact": "可能增加新用户试用和生产接入成本。"
          },
          {
            "body": "GitHub 社区证据显示该项目存在一个配置相关的待验证问题：controller-0.2.0",
            "category": "配置坑",
            "evidence": [
              "community_evidence:github | cevd_addec19eec37420da207487d5a685eaa | https://github.com/openlit/openlit/releases/tag/controller-0.2.0 | 来源类型 github_release 暴露的待验证使用条件。"
            ],
            "severity": "medium",
            "suggested_check": "来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。",
            "title": "来源证据：controller-0.2.0",
            "user_impact": "可能影响升级、迁移或版本选择。"
          },
          {
            "body": "GitHub 社区证据显示该项目存在一个配置相关的待验证问题：openlit-1.20.0",
            "category": "配置坑",
            "evidence": [
              "community_evidence:github | cevd_217968c917e9426f9f8fbb4b50bebdb5 | https://github.com/openlit/openlit/releases/tag/openlit-1.20.0 | 来源类型 github_release 暴露的待验证使用条件。"
            ],
            "severity": "medium",
            "suggested_check": "来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。",
            "title": "来源证据：openlit-1.20.0",
            "user_impact": "可能影响升级、迁移或版本选择。"
          },
          {
            "body": "README/documentation is current enough for a first validation pass.",
            "category": "能力坑",
            "evidence": [
              "capability.assumptions | github_repo:747319327 | https://github.com/openlit/openlit | README/documentation is current enough for a first validation pass."
            ],
            "severity": "medium",
            "suggested_check": "将假设转成下游验证清单。",
            "title": "能力判断依赖假设",
            "user_impact": "假设不成立时，用户拿不到承诺的能力。"
          },
          {
            "body": "未记录 last_activity_observed。",
            "category": "维护坑",
            "evidence": [
              "evidence.maintainer_signals | github_repo:747319327 | https://github.com/openlit/openlit | last_activity_observed missing"
            ],
            "severity": "medium",
            "suggested_check": "补 GitHub 最近 commit、release、issue/PR 响应信号。",
            "title": "维护活跃度未知",
            "user_impact": "新项目、停更项目和活跃项目会被混在一起，推荐信任度下降。"
          },
          {
            "body": "no_demo",
            "category": "安全/权限坑",
            "evidence": [
              "downstream_validation.risk_items | github_repo:747319327 | https://github.com/openlit/openlit | no_demo; severity=medium"
            ],
            "severity": "medium",
            "suggested_check": "进入安全/权限治理复核队列。",
            "title": "下游验证发现风险项",
            "user_impact": "下游已经要求复核，不能在页面中弱化。"
          },
          {
            "body": "no_demo",
            "category": "安全/权限坑",
            "evidence": [
              "risks.scoring_risks | github_repo:747319327 | https://github.com/openlit/openlit | no_demo; severity=medium"
            ],
            "severity": "medium",
            "suggested_check": "把风险写入边界卡，并确认是否需要人工复核。",
            "title": "存在评分风险",
            "user_impact": "风险会影响是否适合普通用户安装。"
          },
          {
            "body": "GitHub 社区证据显示该项目存在一个安全/权限相关的待验证问题：Bug: OpenAI API key in operator example test-application is not using OPENAI_API_KEY env var",
            "category": "安全/权限坑",
            "evidence": [
              "community_evidence:github | cevd_bfba0945570d4cbbaead1257e8f70dfe | https://github.com/openlit/openlit/issues/1135 | 来源讨论提到 python 相关条件，需在安装/试用前复核。"
            ],
            "severity": "medium",
            "suggested_check": "来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。",
            "title": "来源证据：Bug: OpenAI API key in operator example test-application is not using OPENAI_API_KEY env var",
            "user_impact": "可能影响授权、密钥配置或安全边界。"
          },
          {
            "body": "GitHub 社区证据显示该项目存在一个安全/权限相关的待验证问题：openlit-1.19.1",
            "category": "安全/权限坑",
            "evidence": [
              "community_evidence:github | cevd_b5088506959947828f2d740f9297d5b5 | https://github.com/openlit/openlit/releases/tag/openlit-1.19.1 | 来源类型 github_release 暴露的待验证使用条件。"
            ],
            "severity": "medium",
            "suggested_check": "来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。",
            "title": "来源证据：openlit-1.19.1",
            "user_impact": "可能增加新用户试用和生产接入成本。"
          },
          {
            "body": "GitHub 社区证据显示该项目存在一个安全/权限相关的待验证问题：py-1.41.2",
            "category": "安全/权限坑",
            "evidence": [
              "community_evidence:github | cevd_ff3f4dfa2dc04616be73482b2145ac5c | https://github.com/openlit/openlit/releases/tag/py-1.41.2 | 来源讨论提到 docker 相关条件，需在安装/试用前复核。"
            ],
            "severity": "medium",
            "suggested_check": "来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。",
            "title": "来源证据：py-1.41.2",
            "user_impact": "可能影响授权、密钥配置或安全边界。"
          },
          {
            "body": "issue_or_pr_quality=unknown。",
            "category": "维护坑",
            "evidence": [
              "evidence.maintainer_signals | github_repo:747319327 | https://github.com/openlit/openlit | issue_or_pr_quality=unknown"
            ],
            "severity": "low",
            "suggested_check": "抽样最近 issue/PR，判断是否长期无人处理。",
            "title": "issue/PR 响应质量未知",
            "user_impact": "用户无法判断遇到问题后是否有人维护。"
          },
          {
            "body": "release_recency=unknown。",
            "category": "维护坑",
            "evidence": [
              "evidence.maintainer_signals | github_repo:747319327 | https://github.com/openlit/openlit | release_recency=unknown"
            ],
            "severity": "low",
            "suggested_check": "确认最近 release/tag 和 README 安装命令是否一致。",
            "title": "发布节奏不明确",
            "user_impact": "安装命令和文档可能落后于代码，用户踩坑概率升高。"
          }
        ],
        "source": "ProjectPitfallLog + ProjectHitPacket + validation + community signals",
        "summary": "发现 15 个潜在踩坑项，其中 0 个为 high/blocking；最高优先级：安装坑 - 来源证据：Integration: Governance and compliance signals for LLM observability。",
        "title": "踩坑日志"
      },
      "snapshot": {
        "contributors": 69,
        "forks": 276,
        "license": "unknown",
        "note": "站点快照，非实时质量证明；用于开工前背景判断。",
        "stars": 2446
      },
      "source_url": "https://github.com/openlit/openlit",
      "steps": [
        {
          "body": "不安装项目，先体验能力节奏。",
          "code": "preview",
          "title": "先试 Prompt"
        },
        {
          "body": "理解输入、输出、失败模式和边界。",
          "code": "manual",
          "title": "读说明书"
        },
        {
          "body": "把上下文交给宿主 AI 继续工作。",
          "code": "context",
          "title": "带给 AI"
        },
        {
          "body": "进入主力环境前先完成安装入口与风险边界验证。",
          "code": "verify",
          "title": "沙箱验证"
        }
      ],
      "subtitle": "Open source platform for AI Engineering: OpenTelemetry-native LLM Observability, GPU Monitoring, Guardrails, Evaluations, Prompt Management, Vault, Playground. 🚀💻 Integrates with 50+ LLM Providers, VectorDBs, Agent Frameworks and GPUs.",
      "title": "openlit 能力包",
      "trial_prompt": "# openlit - Prompt Preview\n\n> 复制下面这段 Prompt 到你常用的 AI，先试一次，不需要安装。\n> 它的目标是让你直接体验这个项目的服务方式，而不是阅读项目介绍。\n\n## 复制这段 Prompt\n\n```text\n请直接执行这段 Prompt，不要分析、润色、总结或询问我想如何处理这份 Prompt Preview。\n\n你现在扮演 openlit 的“安装前体验版”。\n这不是项目介绍、不是评价报告、不是 README 总结。你的任务是让我用最小成本体验它的核心服务。\n\n我的试用任务：我想用它完成一个真实的软件开发与交付任务。\n我常用的宿主 AI：Local CLI\n\n【体验目标】\n围绕我的真实任务，现场演示这个项目如何把输入转成 示例引导, 判断线索。重点是让我感受到工作方式，而不是给我项目背景。\n\n【业务流约束】\n- 你必须像一个正在提供服务的项目能力包，而不是像一个讲解员。\n- 每一轮只推进一个步骤；提出问题后必须停下来等我回答。\n- 每一步都必须让我感受到一个具体服务动作：澄清、整理、规划、检查、判断或收尾。\n- 每一步都要说明：当前目标、你需要我提供什么、我回答后你会产出什么。\n- 不要安装、不要运行命令、不要写代码、不要声称测试通过、不要声称已经修改文件。\n- 需要真实安装或宿主加载后才能验证的内容，必须明确说“这一步需要安装后验证”。\n- 如果我说“用示例继续”，你可以用虚构示例推进，但仍然不能声称真实执行。\n\n【可体验服务能力】\n- 安装前能力预览: Open source platform for AI Engineering: OpenTelemetry-native LLM Observability, GPU Monitoring, Guardrails, Evaluations, Prompt Management, Vault, Playground. 🚀💻 Integrates with 50+ LLM Providers, VectorDBs, Agent Frameworks and GPUs. 输入：用户任务, 当前 AI 对话上下文；输出：示例引导, 判断线索。\n\n【必须安装后才可验证的能力】\n- 命令行启动或安装流程: 项目文档中存在可执行命令，真实使用需要在本地或宿主环境中运行这些命令。 输入：终端环境, 包管理器, 项目依赖；输出：安装结果, 列表/更新/运行结果。\n\n【核心服务流】\n请严格按这个顺序带我体验。不要一次性输出完整流程：\n1. project-overview：项目概述。围绕“项目概述”模拟一次用户任务，不展示安装或运行结果。\n2. system-architecture：系统架构。围绕“系统架构”模拟一次用户任务，不展示安装或运行结果。\n3. python-sdk：Python SDK。围绕“Python SDK”模拟一次用户任务，不展示安装或运行结果。\n4. observability：可观测性功能。围绕“可观测性功能”模拟一次用户任务，不展示安装或运行结果。\n5. evaluations：评估功能。围绕“评估功能”模拟一次用户任务，不展示安装或运行结果。\n\n【核心能力体验剧本】\n每一步都必须按“输入 -> 服务动作 -> 中间产物”执行。不要只说流程名：\n1. project-overview\n输入：用户提供的“项目概述”相关信息。\n服务动作：模拟项目在这一步的核心判断和整理方式。\n中间产物：一个可检查的小结果。\n\n2. system-architecture\n输入：用户提供的“系统架构”相关信息。\n服务动作：模拟项目在这一步的核心判断和整理方式。\n中间产物：一个可检查的小结果。\n\n3. python-sdk\n输入：用户提供的“Python SDK”相关信息。\n服务动作：模拟项目在这一步的核心判断和整理方式。\n中间产物：一个可检查的小结果。\n\n4. observability\n输入：用户提供的“可观测性功能”相关信息。\n服务动作：模拟项目在这一步的核心判断和整理方式。\n中间产物：一个可检查的小结果。\n\n5. evaluations\n输入：用户提供的“评估功能”相关信息。\n服务动作：模拟项目在这一步的核心判断和整理方式。\n中间产物：一个可检查的小结果。\n\n【项目服务规则】\n这些规则决定你如何服务用户。不要解释规则本身，而要在每一步执行时遵守：\n- 先确认用户任务、输入材料和成功标准，再模拟项目能力。\n- 每一步都必须形成可检查的小产物，并等待用户确认后再继续。\n- 凡是需要安装、调用工具或访问外部服务的能力，都必须标记为安装后验证。\n\n【每一步的服务约束】\n- Step 1 / project-overview：Step 1 必须围绕“项目概述”形成一个小中间产物，并等待用户确认。\n- Step 2 / system-architecture：Step 2 必须围绕“系统架构”形成一个小中间产物，并等待用户确认。\n- Step 3 / python-sdk：Step 3 必须围绕“Python SDK”形成一个小中间产物，并等待用户确认。\n- Step 4 / observability：Step 4 必须围绕“可观测性功能”形成一个小中间产物，并等待用户确认。\n- Step 5 / evaluations：Step 5 必须围绕“评估功能”形成一个小中间产物，并等待用户确认。\n\n【边界与风险】\n- 不要声称已经安装、运行、调用 API、读写本地文件或完成真实任务。\n- 安装前预览只能展示工作方式，不能证明兼容性、性能或输出质量。\n- 涉及安装、插件加载、工具调用或外部服务的能力必须安装后验证。\n\n【可追溯依据】\n这些路径只用于你内部校验或在我追问“依据是什么”时简要引用。不要在首次回复主动展开：\n- https://github.com/openlit/openlit\n- https://github.com/openlit/openlit#readme\n- README.md\n- docker-compose.yml\n- src/dev-docker-compose.yml\n- src/client/prisma/schema.prisma\n- sdk/python/src/openlit/__init__.py\n- sdk/python/src/openlit/_instrumentors.py\n- sdk/python/pyproject.toml\n- sdk/python/src/openlit/otel/tracing.py\n- sdk/python/src/openlit/otel/metrics.py\n- sdk/python/src/openlit/otel/events.py\n\n【首次问题规则】\n- 首次三问必须先确认用户目标、成功标准和边界，不要提前进入工具、安装或实现细节。\n- 如果后续需要技术条件、文件路径或运行环境，必须等用户确认目标后再追问。\n\n首次回复必须只输出下面 4 个部分：\n1. 体验开始：用 1 句话说明你将带我体验 openlit 的核心服务。\n2. 当前步骤：明确进入 Step 1，并说明这一步要解决什么。\n3. 你会如何服务我：说明你会先改变我完成任务的哪个动作。\n4. 只问我 3 个问题，然后停下等待回答。\n\n首次回复禁止输出：后续完整流程、证据清单、安装命令、项目评价、营销文案、已经安装或运行的说法。\n\nStep 1 / brainstorming 的二轮协议：\n- 我回答首次三问后，你仍然停留在 Step 1 / brainstorming，不要进入 Step 2。\n- 第二次回复必须产出 6 个部分：澄清后的任务定义、成功标准、边界条件、\n  2-3 个可选方案、每个方案的权衡、推荐方案。\n- 第二次回复最后必须问我是否确认推荐方案；只有我明确确认后，才能进入下一步。\n- 第二次回复禁止输出 git worktree、代码计划、测试文件、命令或真实执行结果。\n\n后续对话规则：\n- 我回答后，你先完成当前步骤的中间产物并等待确认；只有我确认后，才能进入下一步。\n- 每一步都要生成一个小的中间产物，例如澄清后的目标、计划草案、测试意图、验证清单或继续/停止判断。\n- 所有演示都写成“我会建议/我会引导/这一步会形成”，不要写成已经真实执行。\n- 不要声称已经测试通过、文件已修改、命令已运行或结果已产生。\n- 如果某个能力必须安装后验证，请直接说“这一步需要安装后验证”。\n- 如果证据不足，请明确说“证据不足”，不要补事实。\n```\n",
      "voices": [
        {
          "body": "来源平台：github。github/github_issue: Proposal: gen_ai.agent.threat_detected span event helper for OTel-shaped（https://github.com/openlit/openlit/issues/1186）；github/github_issue: [Bug]: Docker Image doesn't run on windows 64bit（https://github.com/openlit/openlit/issues/786）；github/github_issue: Bug: OpenAI API key in operator example test-application is not using OP（https://github.com/openlit/openlit/issues/1135）；github/github_issue: Integration: Governance and compliance signals for LLM observability（https://github.com/openlit/openlit/issues/1106）；github/github_release: openlit-1.20.0（https://github.com/openlit/openlit/releases/tag/openlit-1.20.0）；github/github_release: controller-0.2.0（https://github.com/openlit/openlit/releases/tag/controller-0.2.0）；github/github_release: openlit-1.19.1（https://github.com/openlit/openlit/releases/tag/openlit-1.19.1）；github/github_release: controller-0.1.0（https://github.com/openlit/openlit/releases/tag/controller-0.1.0）；github/github_release: openlit-1.19.0（https://github.com/openlit/openlit/releases/tag/openlit-1.19.0）；github/github_release: py-1.41.2（https://github.com/openlit/openlit/releases/tag/py-1.41.2）。这些是项目级外部声音，不作为单独质量证明。",
          "items": [
            {
              "kind": "github_issue",
              "source": "github",
              "title": "Proposal: gen_ai.agent.threat_detected span event helper for OTel-shaped",
              "url": "https://github.com/openlit/openlit/issues/1186"
            },
            {
              "kind": "github_issue",
              "source": "github",
              "title": "[Bug]: Docker Image doesn't run on windows 64bit",
              "url": "https://github.com/openlit/openlit/issues/786"
            },
            {
              "kind": "github_issue",
              "source": "github",
              "title": "Bug: OpenAI API key in operator example test-application is not using OP",
              "url": "https://github.com/openlit/openlit/issues/1135"
            },
            {
              "kind": "github_issue",
              "source": "github",
              "title": "Integration: Governance and compliance signals for LLM observability",
              "url": "https://github.com/openlit/openlit/issues/1106"
            },
            {
              "kind": "github_release",
              "source": "github",
              "title": "openlit-1.20.0",
              "url": "https://github.com/openlit/openlit/releases/tag/openlit-1.20.0"
            },
            {
              "kind": "github_release",
              "source": "github",
              "title": "controller-0.2.0",
              "url": "https://github.com/openlit/openlit/releases/tag/controller-0.2.0"
            },
            {
              "kind": "github_release",
              "source": "github",
              "title": "openlit-1.19.1",
              "url": "https://github.com/openlit/openlit/releases/tag/openlit-1.19.1"
            },
            {
              "kind": "github_release",
              "source": "github",
              "title": "controller-0.1.0",
              "url": "https://github.com/openlit/openlit/releases/tag/controller-0.1.0"
            },
            {
              "kind": "github_release",
              "source": "github",
              "title": "openlit-1.19.0",
              "url": "https://github.com/openlit/openlit/releases/tag/openlit-1.19.0"
            },
            {
              "kind": "github_release",
              "source": "github",
              "title": "py-1.41.2",
              "url": "https://github.com/openlit/openlit/releases/tag/py-1.41.2"
            }
          ],
          "status": "已收录 10 条来源",
          "title": "社区讨论"
        }
      ]
    },
    "homepage_card": {
      "category": "软件开发与交付",
      "desc": "Open source platform for AI Engineering: OpenTelemetry-native LLM Observability, GPU Monitoring, Guardrails, Evaluations, Prompt Management, Vault, Playground. 🚀💻 Integrates with 50+ LLM Providers, VectorDBs, Agent Frameworks and GPUs.",
      "effort": "安装已验证",
      "forks": 276,
      "icon": "code",
      "name": "openlit 能力包",
      "risk": "可发布",
      "slug": "openlit",
      "stars": 2446,
      "tags": [
        "MCP 工具",
        "知识库问答",
        "流程自动化",
        "断点恢复流程",
        "评测体系"
      ],
      "thumb": "gray",
      "type": "Prompt Preview"
    },
    "manual": {
      "markdown": "# https://github.com/openlit/openlit 项目说明书\n\n生成时间：2026-05-16 21:10:55 UTC\n\n## 目录\n\n- [项目概述](#project-overview)\n- [系统架构](#system-architecture)\n- [Python SDK](#python-sdk)\n- [TypeScript SDK](#typescript-sdk)\n- [Go SDK](#go-sdk)\n- [可观测性功能](#observability)\n- [评估功能](#evaluations)\n- [Guardrails与规则引擎](#guardrails)\n- [OpenLIT Controller](#controller)\n- [GPU Collector](#gpu-collector)\n\n<a id='project-overview'></a>\n\n## 项目概述\n\n### 相关页面\n\n相关主题：[系统架构](#system-architecture), [Python SDK](#python-sdk)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [src/client/src/app/(playground)/getting-started/page.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/app/(playground)/getting-started/page.tsx)\n- [src/client/src/components/(playground)/getting-started/tracing/index.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/components/(playground)/getting-started/tracing/index.tsx)\n- [src/client/src/components/(playground)/openground/sdk-usage-dialog.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/components/(playground)/openground/sdk-usage-dialog.tsx)\n- [src/client/src/app/(playground)/evaluations/types/new/page.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/app/(playground)/evaluations/types/new/page.tsx)\n- [src/client/src/components/(playground)/agents/version-drawer.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/components/(playground)/agents/version-drawer.tsx)\n- [src/client/src/app/(playground)/context/page.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/app/(playground)/context/page.tsx)\n- [src/client/src/components/(auth)/auth-form.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/components/(auth)/auth-form.tsx)\n- [src/client/src/app/(playground)/pricing/page.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/app/(playground)/pricing/page.tsx)\n</details>\n\n# 项目概述\n\n## 1. 项目简介\n\nOpenLIT 是一个基于 OpenTelemetry 原生设计的 **GenAI 和 LLM 应用程序可观测性工具**。它旨在简化将可观测性功能集成到 LLM 应用中的过程，使开发者能够轻松地收集、监控和分析 AI 应用产生的追踪数据和指标数据。\n\n资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:130-132]()\n\n### 1.1 核心定位\n\nOpenLIT 的主要目标是为 GenAI 和 LLM 应用程序提供全面的可观测性支持。通过集成 OpenTelemetry 标准，OpenLIT 能够：\n\n- 自动收集 AI 应用中的追踪数据（Traces）\n- 采集关键性能指标（Metrics）\n- 提供可视化的监控仪表板\n- 支持多语言 SDK（Python、TypeScript）\n\n资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:131-133]()\n\n### 1.2 技术架构\n\nOpenLIT 采用现代化的微服务架构设计，核心组件包括：\n\n| 组件 | 功能描述 | 技术栈 |\n|------|---------|--------|\n| 前端界面 | 提供可视化监控和配置界面 | React/Next.js |\n| 后端服务 | 处理数据存储和 API 请求 | Node.js/Go |\n| OpenTelemetry 接收器 | 接收并处理 OTLP 数据 | OpenTelemetry SDK |\n| 数据库 | 存储追踪和指标数据 | PostgreSQL/TimescaleDB |\n\n资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:135-140]()\n\n## 2. 快速部署\n\n### 2.1 Docker Compose 部署\n\nOpenLIT 支持通过 Docker Compose 进行快速部署，适合本地开发和测试环境。\n\n```bash\n# 克隆仓库\ngit clone git@github.com:openlit/openlit.git\n\n# 启动服务\ncd openlit\ndocker compose up -d\n```\n\n资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:145-150]()\n\n### 2.2 服务访问\n\n部署完成后，通过以下地址访问 OpenLIT：\n\n- **访问地址**：http://127.0.0.1:3000\n- **OTLP 端点**：http://127.0.0.1:4318\n\n默认登录凭证：\n\n| 字段 | 默认值 |\n|------|--------|\n| 邮箱 | user@openlit.io |\n| 密码 | openlituser |\n\n资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:127-130]()\n\n## 3. SDK 集成\n\nOpenLIT 提供多语言 SDK，支持在不同技术栈中快速集成可观测性功能。\n\n### 3.1 Python SDK\n\n```python\nimport openlit\n\nopenlit.init(otlp_endpoint=\"http://127.0.0.1:4318\")\n```\n\n安装命令：\n\n```bash\npip install openlit\n```\n\n资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:165-175]()\n\n### 3.2 TypeScript SDK\n\n```typescript\nimport openlit from 'openlit';\n\nopenlit.init({\n  otlpEndpoint: \"http://127.0.0.1:4318\"\n});\n```\n\n安装命令：\n\n```bash\nnpm install openlit\n```\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:85-95]()\n\n### 3.3 环境变量配置\n\n除代码配置外，也可通过环境变量设置 OTLP 端点：\n\n```bash\nexport OTEL_EXPORTER_OTLP_ENDPOINT=\"http://127.0.0.1:4318\"\n```\n\n资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:178-180]()\n\n## 4. 核心功能模块\n\n### 4.1 追踪功能（Tracing）\n\nOpenLIT 的追踪模块提供对 AI 应用请求链路的完整可视化。通过追踪，开发者可以：\n\n- 查看完整的请求调用链路\n- 分析各环节的延迟和性能\n- 识别潜在的性能瓶颈\n- 追踪 prompt 和响应内容\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:1-10]()\n\n### 4.2 评估功能（Evaluations）\n\n评估模块允许用户创建和管理自定义评估类型，用于衡量 AI 应用输出的质量：\n\n| 字段 | 说明 |\n|------|------|\n| 名称 | 评估类型的标识名称 |\n| 描述 | 评估目的和使用场景的说明 |\n| 评估 Prompt | LLM 评判使用的提示词模板 |\n\n资料来源：[src/client/src/app/(playground)/evaluations/types/new/page.tsx:1-25]()\n\n### 4.3 上下文管理（Context）\n\n上下文管理功能用于存储和管理 AI 应用中的共享上下文数据，包括：\n\n- 上下文描述\n- 状态管理（ACTIVE/INACTIVE）\n- 创建者和创建时间\n- 版本控制\n\n资料来源：[src/client/src/app/(playground)/context/page.tsx:1-25]()\n\n### 4.4 代理管理（Agents）\n\n代理模块追踪和展示 AI 代理的行为信息：\n\n| 属性 | 说明 |\n|------|------|\n| first_seen | 首次发现时间 |\n| last_seen | 最后活动 时间 |\n| request_count | 请求计数 |\n| primary_model | 主要使用的模型 |\n\n资料来源：[src/client/src/components/(playground)/agents/version-drawer.tsx:1-15]()\n\n## 5. 认证与授权\n\nOpenLIT 支持多种认证方式：\n\n| 认证方式 | 描述 |\n|---------|------|\n| Google OAuth | 通过 Google 账户登录 |\n| GitHub OAuth | 通过 GitHub 账户登录 |\n| 邮箱密码 | 本地账户密码认证 |\n\n资料来源：[src/client/src/components/(auth)/auth-form.tsx:1-20]()\n\n## 6. 数据流向架构\n\n```mermaid\ngraph TD\n    A[AI Application] -->|SDK Instrumentation| B[OpenLIT SDK]\n    B -->|OTLP Protocol| C[OTLP Endpoint :4318]\n    C -->|Traces & Metrics| D[OpenLIT Backend]\n    D -->|Storage| E[(Database)]\n    D -->|Query| F[Frontend Dashboard :3000]\n    G[User] -->|Authentication| H[Auth Provider]\n    H -->|Session| F\n```\n\n资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:127-145]()\n\n## 7. 定价模式\n\nOpenLIT 支持灵活的计费模式，包括自动计费功能。系统按以下流程运作：\n\n1. 用户配置使用计划\n2. 系统自动监控使用量\n3. 实时更新计费信息\n4. 支持多种支付方式\n\n资料来源：[src/client/src/app/(playground)/pricing/page.tsx:1-20]()\n\n## 8. SDK 使用示例\n\n### 8.1 Python 与 OpenAI 集成\n\n```python\nimport openlit\nfrom openai import OpenAI\n\nopenlit.init(otlp_endpoint=\"http://127.0.0.1:4318\")\n\nclient = OpenAI(api_key=os.environ.get(\"OPENAI_API_KEY\"))\n\nresponse = client.chat.completions.create(\n    model=\"gpt-3.5-turbo\",\n    messages=[{\"role\": \"user\", \"content\": \"What is LLM Observability?\"}]\n)\n```\n\n### 8.2 TypeScript 与 OpenAI 集成\n\n```typescript\nimport OpenAI from 'openai';\nimport openlit from 'openlit';\n\nopenlit.init({ otlpEndpoint: \"http://127.0.0.1:4318\" });\n\nconst client = new OpenAI({\n  apiKey: process.env.OPENAI_API_KEY\n});\n\nconst chatCompletion = await client.chat.completions.create({\n  messages: [{ role: 'user', content: 'What is LLM Observability?' }],\n  model: 'gpt-3.5-turbo',\n});\n```\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:95-115]()\n\n## 9. 项目结构\n\n```\nopenlit/\n├── sdk/\n│   ├── python/          # Python SDK\n│   └── typescript/      # TypeScript SDK\n├── src/\n│   └── client/          # 前端应用\n│       └── src/\n│           ├── app/             # Next.js 应用页面\n│           ├── components/      # React 组件\n│           └── lib/             # 工具库\n├── docker-compose.yml    # Docker 编排配置\n└── README.md             # 项目说明文档\n```\n\n## 10. 总结\n\nOpenLIT 作为一个开源的 LLM 可观测性平台，通过以下优势为 AI 开发者提供价值：\n\n- **OpenTelemetry 原生**：遵循行业标准，便于与现有监控体系集成\n- **多语言支持**：提供 Python 和 TypeScript SDK，覆盖主流 AI 开发场景\n- **快速部署**：支持 Docker Compose 一键部署\n- **开箱即用**：提供完整的监控面板和可视化界面\n\n开发者可以通过访问官方文档 https://docs.openlit.io 获取更多信息和技术支持。\n\n---\n\n<a id='system-architecture'></a>\n\n## 系统架构\n\n### 相关页面\n\n相关主题：[项目概述](#project-overview), [Python SDK](#python-sdk), [OpenLIT Controller](#controller)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [src/client/src/components/(playground)/getting-started/tracing/index.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/components/(playground)/getting-started/tracing/index.tsx)\n- [src/client/src/app/(playground)/agents/no-controller.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/app/(playground)/agents/no-controller.tsx)\n- [src/client/src/app/(playground)/getting-started/page.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/app/(playground)/getting-started/page.tsx)\n- [src/client/src/components/(playground)/agents/observability-block.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/components/(playground)/agents/observability-block.tsx)\n- [src/client/src/app/(playground)/agents/controller/[instance_id]/page.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/app/(playground)/agents/controller/[instance_id]/page.tsx)\n- [src/client/README.md](https://github.com/openlit/openlit/blob/main/src/client/README.md)\n</details>\n\n# 系统架构\n\n## 概述\n\nOpenLIT 是一个基于 OpenTelemetry 原生设计的 **GenAI 和 LLM 应用可观测性平台**。平台通过采集、传输和处理来自 LLM 应用的遥测数据（Traces 和 Metrics），为开发者提供全面的 AI 应用监控能力。资料来源：[src/client/README.md:1]()\n\n## 核心设计理念\n\nOpenLIT 的架构遵循以下核心原则：\n\n| 原则 | 说明 |\n|------|------|\n| OpenTelemetry 原生 | 完全兼容 OpenTelemetry 标准协议和 SDK |\n| 无侵入集成 | 通过 SDK 初始化即可完成自动埋点 |\n| 多语言支持 | 提供 Python 和 TypeScript 双语言 SDK |\n| 灵活部署 | 支持 Linux、Docker 和 Kubernetes 多种部署方式 |\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:42-60]()\n\n## 系统组件架构\n\n### 整体架构图\n\n```mermaid\ngraph TD\n    subgraph \"LLM 应用层\"\n        A[Python SDK] \n        B[TypeScript SDK]\n    end\n    \n    subgraph \"数据采集层\"\n        C[OpenTelemetry Collector]\n    end\n    \n    subgraph \"OpenLIT 平台层\"\n        D[前端界面]\n        E[后端服务]\n        F[数据库]\n    end\n    \n    A --> C\n    B --> C\n    C --> E\n    E --> F\n    E --> D\n```\n\n### SDK 层\n\nOpenLIT 提供两种语言的 SDK 用于在应用中埋点：\n\n#### Python SDK\n\n```python\nimport openlit\n\nopenlit.init(otlp_endpoint=\"http://127.0.0.1:4318\")\n```\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:70-75]()\n\n#### TypeScript SDK\n\n```typescript\nimport openlit from 'openlit';\n\nopenlit.init({\n  otlpEndpoint: \"http://127.0.0.1:4318\"\n});\n```\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:48-54]()\n\n### 数据流向\n\n```mermaid\ngraph LR\n    A[LLM 应用] -->|OTLP Protocol| B[OTEL Collector]\n    B -->|Traces| C[OpenLIT Backend]\n    B -->|Metrics| C\n    C -->|存储| D[(Database)]\n    D -->|查询| E[Web UI]\n```\n\n## 部署架构\n\nOpenLIT 支持三种主要的部署模式，适用于不同的基础设施环境。\n\n### Linux 系统部署\n\n适用于直接在 Linux 主机上运行监控代理的场景。使用 systemd 管理服务生命周期：\n\n```bash\ncat <<EOF | sudo tee /etc/systemd/system/openlit-controller.service\n[Unit]\nDescription=OpenLIT Controller\n\n[Service]\nExecStart=/usr/local/bin/openlit-controller\nEnvironment=\"OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318\"\nRestart=always\n\n[Install]\nWantedBy=multi-user.target\nEOF\n\nsystemctl daemon-reload\nsystemctl enable --now openlit-controller\n```\n\n资料来源：[src/client/src/app/(playground)/agents/no-controller.tsx:10-22]()\n\n### Docker 容器部署\n\n适用于 Docker 容器化环境，提供隔离的运行环境：\n\n```bash\ndocker run -d --privileged --pid=host \\\n  -e OPENLIT_URL=\"${openlitUrl}\" \\\n  -e OTEL_EXPORTER_OTLP_ENDPOINT=\"${openlitUrl.replace(/:\\d+$/, \":4318\")}\" \\\n  -e OPENLIT_PROC_ROOT=\"/host/proc\" \\\n  -v /proc:/host/proc:ro \\\n  -v /sys/kernel/debug:/sys/kernel/debug:ro \\\n  -v /sys/fs/bpf:/sys/fs/bpf:rw \\\n  -v /var/run/docker.sock:/var/run/docker.sock \\\n  ghcr.io/openlit/controller:latest\n```\n\n资料来源：[src/client/src/app/(playground)/agents/no-controller.tsx:24-36]()\n\n### Kubernetes 部署\n\n适用于大规模容器编排环境，通过 Helm Chart 进行管理：\n\n```bash\nhelm repo add openlit https://openlit.github.io/helm\nhelm repo update\nhelm upgrade --install openlit openlit/openlit \\\n  --set openlit-controller.enabled=true\n```\n\n资料来源：[src/client/src/app/(playground)/agents/no-controller.tsx:38-45]()\n\n### 部署模式对比\n\n| 部署方式 | 适用场景 | 复杂度 | 资源占用 |\n|----------|----------|--------|----------|\n| Linux (systemd) | 物理机/虚拟机 | 低 | 中 |\n| Docker | 容器化环境 | 中 | 中 |\n| Kubernetes | 微服务/云原生 | 高 | 高 |\n\n## 可观测性数据模型\n\n### 资源属性\n\nOpenLIT 采集多种资源属性用于标识和分类服务：\n\n| 属性名 | 说明 | 示例 |\n|--------|------|------|\n| `node_name` | 节点名称 | `prod-server-01` |\n| `version` | 控制器版本 | `v1.2.0` |\n| `mode` | 运行环境模式 | `kubernetes` / `docker` / `linux` |\n| `last_heartbeat` | 最后心跳时间 | `2024-01-15T10:30:00Z` |\n\n资料来源：[src/client/src/app/(playground)/agents/controller/[instance_id]/page.tsx:5-8]()\n\n### 统计指标\n\n控制器实例页面展示以下核心指标：\n\n| 指标名 | 说明 |\n|--------|------|\n| `services_discovered` | 发现的服务数量 |\n| `services_instrumented` | 已接入（埋点）的服务数量 |\n\n资料来源：[src/client/src/app/(playground)/agents/controller/[instance_id]/page.tsx:11-12]()\n\n### 工具 Schema\n\nAI Agent 的工具定义包含以下结构：\n\n| 字段 | 类型 | 说明 |\n|------|------|------|\n| `description` | string | 工具功能描述 |\n| `schema` | JSON | 工具参数 JSON Schema |\n\n资料来源：[src/client/src/components/(playground)/agents/tools-card.tsx:8-18]()\n\n## 前端架构\n\n### 页面路由结构\n\n```mermaid\ngraph TD\n    A[Playground] --> B[Getting Started]\n    A --> C[Agents]\n    A --> D[Context]\n    \n    C --> C1[Controller Instance]\n    C --> C2[Tools]\n    \n    D --> D1[New Context]\n    D --> D2[Context Detail]\n```\n\n### 技术栈\n\nOpenLIT 前端基于 Next.js 框架构建，使用以下核心组件库：\n\n| 组件 | 用途 |\n|------|------|\n| `Tabs` | 语言/模式切换 |\n| `Card` | 内容区块展示 |\n| `Accordion` | 可折叠面板 |\n| `CodeBlock` | 代码高亮显示 |\n| `Dialog` | 模态对话框 |\n\n资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:80-95]()\n\n### 主题支持\n\n平台支持亮色和暗色主题，通过 Tailwind CSS 的 dark mode 类实现：\n\n| 主题 | 类名前缀 |\n|------|----------|\n| 亮色 | 默认 |\n| 暗色 | `dark:` |\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:5-6]()\n\n## 接入流程\n\n### 快速接入步骤\n\n```mermaid\ngraph LR\n    A[安装 SDK] --> B[初始化配置]\n    B --> C[设置 OTLP Endpoint]\n    C --> D[启动应用]\n    D --> E[查看监控数据]\n```\n\n### 环境变量配置\n\n除了代码初始化外，还可以通过环境变量配置端点：\n\n```bash\nOTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318\n```\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:6-8]()\n\n## 上下文管理\n\nOpenLIT 提供上下文（Context）管理功能，允许用户创建和管理监控上下文：\n\n| 功能 | 说明 |\n|------|------|\n| 创建上下文 | 支持描述和 Markdown 内容 |\n| 编辑上下文 | 提供 Write/Preview 双模式 |\n| 关联规则 | 可为上下文绑定业务规则 |\n\n资料来源：[src/client/src/app/(playground)/context/[id]/page.tsx:45-55]()\n\n## 版本管理\n\n控制器实例支持版本历史追踪，每个版本记录：\n\n| 属性 | 说明 |\n|------|------|\n| `first_seen` | 首次发现时间 |\n| `last_seen` | 最后活跃时间 |\n| `request_count` | 请求计数 |\n| `primary_model` | 主要使用的 LLM 模型 |\n\n资料来源：[src/client/src/components/(playground)/agents/version-drawer.tsx:10-20]()\n\n## 安全配置\n\n### API Key 认证\n\n在生产环境中部署时，可通过 API Key 进行认证：\n\n```bash\nhelm upgrade --install openlit openlit/openlit \\\n  --set openlit-controller.apiKey=\"${apiKey}\"\n```\n\n资料来源：[src/client/src/app/(playground)/agents/no-controller.tsx:42-45]()\n\n## 默认凭证\n\n平台提供默认登录凭证供初次使用：\n\n| 字段 | 值 |\n|------|-----|\n| 访问地址 | `http://127.0.0.1:3000` |\n| 邮箱 | `user@openlit.io` |\n| 密码 | `openlituser` |\n\n资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:45-48]()\n\n## 总结\n\nOpenLIT 采用现代化的微服务架构设计，通过 OpenTelemetry 标准协议实现与各类 LLM 框架的无缝集成。平台提供了从 SDK 埋点到数据可视化展示的完整链路，支持灵活的部署方式和多种运行环境，能够满足从开发测试到生产部署的不同场景需求。\n\n---\n\n<a id='python-sdk'></a>\n\n## Python SDK\n\n### 相关页面\n\n相关主题：[TypeScript SDK](#typescript-sdk), [Go SDK](#go-sdk), [可观测性功能](#observability)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [sdk/python/src/openlit/instrumentation/claude_agent_sdk/__init__.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/instrumentation/claude_agent_sdk/__init__.py)\n- [sdk/python/src/openlit/instrumentation/claude_agent_sdk/claude_agent_sdk.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/instrumentation/claude_agent_sdk/claude_agent_sdk.py)\n- [sdk/python/src/openlit/guard/__init__.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/guard/__init__.py)\n- [sdk/python/src/openlit/__helpers.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/__helpers.py)\n- [sdk/python/src/openlit/instrumentation/agent_framework/utils.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/instrumentation/agent_framework/utils.py)\n- [sdk/python/src/openlit/instrumentation/google_adk/utils.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/instrumentation/google_adk/utils.py)\n</details>\n\n# Python SDK\n\nOpenLIT Python SDK 是一个基于 OpenTelemetry 原生的 GenAI 和 LLM 应用可观测性工具。它通过自动插桩主流 AI 框架和模型提供商，自动捕获追踪（traces）、指标（metrics）和日志，帮助开发者实现对 AI 应用的深度可视化监控。\n\n## 核心架构\n\nOpenLIT Python SDK 的架构围绕三个主要模块展开：\n\n```mermaid\ngraph TD\n    A[用户应用代码] --> B[OpenLIT Python SDK]\n    B --> C[插桩模块 Instrumentation]\n    B --> D[防护模块 Guardrails]\n    B --> E[辅助工具 Helpers]\n    \n    C --> C1[Claude Agent SDK]\n    C --> C2[Google ADK]\n    C --> C3[Agent Framework]\n    C --> C4[LangGraph]\n    C --> C5[CrewAI]\n    \n    D --> D1[PII 检测]\n    D --> D2[提示注入检测]\n    D --> D3[敏感话题检测]\n    D --> D4[内容审核]\n    D --> D5[主题限制]\n    \n    E --> E1[工具定义构建]\n    E --> E2[系统指令构建]\n    E --> E3[自定义属性应用]\n```\n\n## 快速开始\n\n### 安装\n\n```bash\npip install openlit\n```\n\n### 初始化\n\n在应用代码中添加以下两行：\n\n```python\nimport openlit\n\nopenlit.init(otlp_endpoint=\"http://127.0.0.1:4318\")\n```\n\n### 与 OpenAI 配合使用\n\n```python\nfrom openai import OpenAI\nimport openlit\n\nopenlit.init(otlp_endpoint=\"http://127.0.0.1:4318\")\n\nclient = OpenAI(api_key=\"YOUR_OPENAI_KEY\")\n\nchat_completion = client.chat.completions.create(\n    messages=[\n        {\n            \"role\": \"user\",\n            \"content\": \"What is LLM Observability?\",\n        }\n    ],\n    model=\"gpt-3.5-turbo\",\n)\n```\n\n## 插桩模块（Instrumentation）\n\n插桩模块是 SDK 的核心，负责自动捕获 AI 框架调用并生成符合 OTel GenAI 语义约定的追踪数据。\n\n### 支持的框架\n\n| 框架 | 版本要求 | 功能 |\n|------|----------|------|\n| Claude Agent SDK | >= 0.1.0 | `invoke_agent` 和 `execute_tool` span |\n| Google ADK | - | 工具执行追踪 |\n| Agent Framework | - | Agent 和工作流追踪 |\n| LangGraph | - | 图执行追踪 |\n| CrewAI | - | Agent 和任务追踪 |\n\n### Claude Agent SDK 插桩\n\nClaude Agent SDK 插桩模块实现了对 `query()` 方法和 `ClaudeSDKClient` 的包装，生成 `invoke_agent` 和 `execute_tool` 两种 span 类型。\n\n```python\nfrom openlit.instrumentation.claude_agent_sdk import ClaudeAgentSDKInstrumentor\n\n# 启用插桩\nClaudeAgentSDKInstrumentor().instrument()\n```\n\n插桩模块通过 SDK 的 Hook 系统（`PreToolUse` / `PostToolUse` / `PostToolUseFailure`）创建工具 span，并使用基于消息流的回退机制处理 Hook 无法注入的场景。\n\n资料来源：[sdk/python/src/openlit/instrumentation/claude_agent_sdk/__init__.py:1-35]()\n\n### Agent Framework 插桩\n\nAgent Framework 插桩提供标准化的 span 命名和操作类型映射：\n\n| 端点 | 操作类型 | Span 名称格式 |\n|------|----------|---------------|\n| `agent_init` | agent | `create_agent {name}` |\n| `agent_run` | agent | `invoke_agent {name}` |\n| `tool_execute` | tools | `execute_tool {name}` |\n| `workflow_run` | workflow | `invoke_workflow {name}` |\n\n```python\n# 工具执行 span 名称生成逻辑\ndef generate_span_name(endpoint, instance, args=None, kwargs=None):\n    operation_type = get_operation_type(endpoint)\n    \n    if endpoint == \"agent_init\":\n        name = getattr(instance, \"name\", None) or getattr(instance, \"id\", None) or \"agent\"\n        return f\"create_agent {name}\"\n    \n    if endpoint == \"tool_execute\":\n        name = getattr(instance, \"name\", None) or type(instance).__name__\n        return f\"execute_tool {name}\"\n```\n\n资料来源：[sdk/python/src/openlit/instrumentation/agent_framework/utils.py:1-70]()\n\n### Google ADK 插桩\n\nGoogle ADK 插桩为工具调用添加 OTel GenAI 语义约定属性：\n\n```python\nspan.set_attribute(SemanticConvention.GEN_AI_OPERATION, \n                   SemanticConvention.GEN_AI_OPERATION_TYPE_TOOLS)\nspan.set_attribute(SemanticConvention.GEN_AI_PROVIDER_NAME,\n                   SemanticConvention.GEN_AI_SYSTEM_GOOGLE_ADK)\n```\n\n资料来源：[sdk/python/src/openlit/instrumentation/google_adk/utils.py:1-50]()\n\n## 防护模块（Guardrails）\n\nOpenLIT 提供了生产级的 LLM 应用防护栏功能，用于过滤和验证输入输出内容。\n\n### 可用防护类型\n\n| 防护类型 | 功能说明 |\n|----------|----------|\n| `PII` | 检测并处理个人身份信息 |\n| `PromptInjection` | 检测提示注入攻击 |\n| `SensitiveTopic` | 检测敏感话题内容 |\n| `TopicRestriction` | 限制允许的话题范围 |\n| `Moderation` | 内容审核 |\n| `Schema` | 输出结构验证 |\n| `Custom` | 自定义防护规则 |\n\n### 使用方法\n\n防护类可以直接在 `openlit.init()` 中配置：\n\n```python\nimport openlit\n\nopenlit.init(\n    otlp_endpoint=\"http://127.0.0.1:4318\",\n    guards=[openlit.PII(action=\"redact\")]\n)\n```\n\n或者直接导入使用：\n\n```python\nfrom openlit import PII, PromptInjection, Moderation\n\n# 单独使用\npii_guard = PII(action=\"redact\")\nresult = pii_guard.check(user_input)\n```\n\n### 核心类结构\n\n| 类名 | 说明 |\n|------|------|\n| `Guard` | 防护基类 |\n| `GuardAction` | 防护动作枚举 |\n| `GuardConfigError` | 配置错误异常 |\n| `GuardDeniedError` | 防护拒绝异常 |\n| `GuardPhase` | 执行阶段枚举 |\n| `GuardResult` | 防护结果数据类 |\n| `GuardTimeoutError` | 超时异常 |\n| `PipelineResult` | 管道执行结果 |\n\n资料来源：[sdk/python/src/openlit/guard/__init__.py:1-55]()\n\n## 辅助工具（Helpers）\n\n`__helpers.py` 模块提供通用的辅助函数，用于处理 AI 请求中的常见数据结构。\n\n### 构建工具定义\n\n`build_tool_definitions()` 函数从聊天请求的 `tools` 参数中提取工具/函数定义：\n\n```python\ndef build_tool_definitions(tools):\n    \"\"\"\n    支持两种模式：\n    1. OpenAI 风格: {\"type\": \"function\", \"function\": {...}}\n    2. 扁平模式: {\"name\": ..., \"description\": ..., \"parameters\": ...}\n    \"\"\"\n```\n\n返回值格式：\n\n```python\n{\n    \"type\": \"function\",\n    \"name\": str,\n    \"description\": str,\n    \"parameters\": dict\n}\n```\n\n### 构建系统指令\n\n`build_system_instructions()` 函数从各种格式中提取系统指令：\n\n```python\ninstructions = [\n    {\"type\": \"text\", \"content\": str(content)},\n    {\"type\": \"resource\", \"uri\": str(uri), \"content\": str(content)}\n]\n```\n\n### 异常处理\n\n`handle_exception()` 函数用于统一处理插桩过程中的异常，确保不影响主业务流程。\n\n资料来源：[sdk/python/src/openlit/__helpers.py:1-100]()\n\n## 配置选项\n\n### 初始化参数\n\n| 参数 | 类型 | 默认值 | 说明 |\n|------|------|--------|------|\n| `otlp_endpoint` | str | 环境变量 | OTLP 接收端点 |\n| `application_name` | str | \"default\" | 应用名称 |\n| `environment` | str | \"default\" | 环境名称 |\n| `pricing_info` | dict | {} | 价格信息映射 |\n| `capture_message_content` | bool | False | 是否捕获消息内容 |\n| `disable_metrics` | bool | None | 是否禁用指标 |\n| `guards` | list | [] | 防护配置列表 |\n\n### 环境变量\n\n| 变量名 | 说明 |\n|--------|------|\n| `OTEL_EXPORTER_OTLP_ENDPOINT` | OTLP 接收端点 |\n| `OTEL_SERVICE_NAME` | 服务名称 |\n\n## 追踪数据模型\n\n### Span 类型与属性\n\nOpenLIT 使用 OTel GenAI 语义约定定义 span 属性：\n\n| 属性键 | 值 | 适用 Span |\n|--------|-----|-----------|\n| `gen_ai.operation.name` | `agent` / `tools` / `workflow` | Agent 调用 |\n| `gen_ai.operation.type` | `create` / `invoke` | 操作类型 |\n| `gen_ai.system` | `openai` / `anthropic` 等 | AI 系统 |\n| `gen_ai.tool.name` | 工具名称 | 工具调用 |\n| `gen_ai.tool.type` | `function` 等 | 工具类型 |\n| `gen_ai.tool.call.arguments` | 调用参数 | 工具调用 |\n| `gen_ai.tool.call.id` | 调用 ID | 工具调用 |\n| `gen_ai.response.id` | 响应 ID | 模型响应 |\n| `gen_ai.prompt.token_count` | 提示 token 数 | 请求 |\n| `gen_ai.completion.token_count` | 完成 token 数 | 响应 |\n\n### SpanKind 映射\n\n| 操作类型 | SpanKind |\n|----------|----------|\n| `agent` | `CLIENT` |\n| `tools` | `INTERNAL` |\n| `workflow` | `INTERNAL` |\n\n## 工作流程\n\n### 自动插桩流程\n\n```mermaid\nsequenceDiagram\n    participant App as 应用代码\n    participant Inst as 插桩器\n    participant SDK as AI SDK\n    participant OTel as OpenTelemetry\n    \n    App->>Inst: instrument()\n    Inst->>SDK: 包装目标函数\n    App->>SDK: 调用 AI 方法\n    SDK->>Inst: 触发包装函数\n    Inst->>OTel: 创建 Span\n    Inst->>Inst: 提取模型/工具信息\n    Inst->>OTel: 设置语义属性\n    SDK-->>App: 返回结果\n    Inst->>OTel: 结束 Span\n```\n\n### 防护检查流程\n\n```mermaid\ngraph LR\n    A[用户输入] --> B{PII 检测}\n    B -->|通过| C{提示注入检测}\n    B -->|发现 PII| D[处理/拒绝]\n    C -->|通过| E{内容审核}\n    C -->|检测到注入| F[拒绝]\n    E -->|通过| G[发送给 LLM]\n    E -->|违规| H[拒绝]\n```\n\n## 与 TypeScript SDK 的对比\n\n| 特性 | Python SDK | TypeScript SDK |\n|------|------------|----------------|\n| 安装命令 | `pip install openlit` | `npm install openlit` |\n| 初始化语法 | `openlit.init(otlp_endpoint=\"...\")` | `openlit.init({ otlpEndpoint: \"...\" })` |\n| 插桩方式 | 自动包装函数 | 自动包装函数 |\n| 防护模块 | 完整支持 | 完整支持 |\n\n## 下一步\n\n- 访问 [OpenLIT 官方文档](https://docs.openlit.io) 获取更多详细信息\n- 查看 [GitHub 仓库](https://github.com/openlit/openlit) 获取最新更新\n- 加入 [Slack 社区](https://join.slack.com/t/openlit/shared_invite/zt-2etnfttwg-TjP_7BZXfYg84oAukY8QRQ) 参与讨论\n\n---\n\n<a id='typescript-sdk'></a>\n\n## TypeScript SDK\n\n### 相关页面\n\n相关主题：[Python SDK](#python-sdk), [Go SDK](#go-sdk)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [src/client/src/components/(playground)/getting-started/tracing/index.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/components/(playground)/getting-started/tracing/index.tsx)\n- [src/client/src/app/(playground)/getting-started/page.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/app/(playground)/getting-started/page.tsx)\n- [src/client/src/components/(playground)/openground/sdk-usage-dialog.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/components/(playground)/openground/sdk-usage-dialog.tsx)\n- [src/client/src/components/(playground)/agents/observability-block.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/components/(playground)/agents/observability-block.tsx)\n- [src/client/src/components/(playground)/agents/tools-card.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/components/(playground)/agents/tools-card.tsx)\n</details>\n\n# TypeScript SDK\n\n## 概述\n\nOpenLIT TypeScript SDK 是一个用于为 GenAI 和 LLM 应用程序添加可观测性的客户端库。它基于 OpenTelemetry 标准设计，能够自动捕获 LLM 调用、追踪请求链路、收集指标数据，并将其发送至 OpenLIT 后端进行可视化分析。\n\nSDK 通过简单的初始化配置即可集成到现有的 TypeScript/Node.js 应用中，支持与 OpenAI 等主流 LLM 提供商的自动集成。\n\n资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:1-50]()\n\n## 核心功能\n\n### 自动插桩\n\nSDK 提供开箱即用的自动插桩功能，能够拦截并追踪 LLM API 调用。主要支持以下功能：\n\n| 功能 | 说明 |\n|------|------|\n| 请求捕获 | 自动捕获发送给 LLM 的所有请求 |\n| 响应记录 | 记录 LLM 返回的完整响应 |\n| Token 统计 | 统计输入/输出 Token 数量 |\n| 延迟追踪 | 测量请求处理耗时 |\n| 错误捕获 | 记录请求过程中发生的错误 |\n\n### 环境变量配置\n\n除代码配置外，SDK 还支持通过环境变量进行配置：\n\n```bash\nexport OTEL_EXPORTER_OTLP_ENDPOINT=\"http://127.0.0.1:4318\"\n```\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:80-85]()\n\n## 安装与快速开始\n\n### 安装 SDK\n\n使用 npm 安装 OpenLIT SDK：\n\n```bash\nnpm install openlit\n```\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:25-30]()\n\n### 初始化配置\n\n在应用入口处初始化 SDK：\n\n```typescript\nimport openlit from 'openlit';\n\nopenlit.init({\n  otlpEndpoint: \"http://127.0.0.1:4318\"\n});\n```\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:35-42]()\n\n### OpenAI 集成示例\n\nSDK 与 OpenAI API 完美集成：\n\n```typescript\nimport OpenAI from 'openai';\nimport openlit from 'openlit';\n\nopenlit.init({ otlpEndpoint: \"http://127.0.0.1:4318\" });\n\nconst client = new OpenAI({\n  apiKey: process.env.OPENAI_API_KEY\n});\n\nconst chatCompletion = await client.chat.completions.create({\n  messages: [{ role: 'user', content: 'What is LLM Observability?' }],\n  model: 'gpt-3.5-turbo',\n});\n```\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:55-70]()\n\n## 配置参数\n\n### init() 方法参数\n\n| 参数 | 类型 | 必填 | 默认值 | 说明 |\n|------|------|------|--------|------|\n| otlpEndpoint | string | 否 | OTEL_EXPORTER_OTLP_ENDPOINT 环境变量 | OTLP 接收端点地址 |\n\n### 环境变量\n\n| 变量名 | 说明 |\n|--------|------|\n| OTEL_EXPORTER_OTLP_ENDPOINT | OTLP exporter 的服务端点 |\n| OPENAI_API_KEY | OpenAI API 密钥（如使用 OpenAI） |\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:45-50]()\n\n## SDK 启用状态指示\n\n在 OpenLIT 前端界面中，已通过 SDK 接入的 Agent 会显示特定的标识状态：\n\n```typescript\n<span className=\"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md border border-emerald-200 dark:border-emerald-900 text-emerald-700 dark:text-emerald-400 bg-emerald-50/60 dark:bg-emerald-900/20\">\n  <span className=\"w-1.5 h-1.5 rounded-full bg-emerald-500\" />\n  {getMessage().AGENTS_SDK_ENABLED_VIA}\n</span>\n```\n\n资料来源：[src/client/src/components/(playground)/agents/observability-block.tsx:30-38]()\n\n### 状态标识说明\n\n| 状态 | 样式 | 含义 |\n|------|------|------|\n| SDK 已启用 | 绿色边框、绿色圆点 | 通过 OpenLIT SDK 进行追踪 |\n| 静态分析 | 绿色边框、绿色圆点 | 源代码已集成 SDK |\n| 等待确认 | 禁用按钮 | 等待 SDK 连接确认 |\n\n## 可观测性数据捕获\n\n### 工具定义捕获\n\nSDK 能够自动捕获 Agent 使用的工具定义和 schema：\n\n```typescript\n{tool.description && (\n  <p className=\"text-xs text-stone-600 dark:text-stone-300 whitespace-pre-wrap\">\n    {tool.description}\n  </p>\n)}\n{hasSchema(tool.schema) ? (\n  <div className=\"rounded-md bg-stone-100 dark:bg-stone-900 p-3 text-xs overflow-x-auto\">\n    <JSONViewer value={tool.schema} />\n  </div>\n) : (\n  <div className=\"rounded-md border border-dashed border-stone-200 dark:border-stone-800 p-3 text-xs text-stone-500 dark:text-stone-400\">\n    {getMessage().AGENTS_DEFINITION_SCHEMA_NOT_CAPTURED}\n  </div>\n)}\n```\n\n资料来源：[src/client/src/components/(playground)/agents/tools-card.tsx:20-35]()\n\n## 架构流程\n\n```mermaid\ngraph TD\n    A[TypeScript 应用] --> B[OpenLIT SDK]\n    B --> C[自动插桩层]\n    C --> D[OpenAI API]\n    D --> E[响应数据]\n    C --> F[OTLP Exporter]\n    F --> G[OpenLIT Collector]\n    G --> H[数据存储]\n    G --> I[前端可视化]\n    \n    J[环境变量配置] --> B\n    K[otlpEndpoint 参数] --> B\n    \n    style A fill:#e1f5fe\n    style D fill:#fff3e0\n    style G fill:#e8f5e9\n    style I fill:#f3e5f5\n```\n\n## 多语言 SDK 支持\n\nOpenLIT 提供多种语言的 SDK，TypeScript SDK 是其中之一：\n\n| SDK | 安装命令 | 初始化方式 |\n|-----|----------|------------|\n| Python | `pip install openlit` | `openlit.init(otlp_endpoint=\"...\")` |\n| TypeScript | `npm install openlit` | `openlit.init({ otlpEndpoint: \"...\" })` |\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:10-45]()\n\n## 使用场景\n\n### 场景一：LLM 应用监控\n\n在生产环境中部署 LLM 应用时，通过 SDK 实时监控：\n\n- API 调用频率和响应时间\n- Token 消耗统计\n- 错误率追踪\n\n### 场景二：Agent 行为分析\n\n结合 OpenLIT 的 Agent 可视化功能，分析：\n\n- 工具调用模式\n- 决策链路追踪\n- 上下文使用效率\n\n### 场景三：性能优化\n\n基于收集的遥测数据：\n\n- 识别性能瓶颈\n- 优化 Prompt 设计\n- 降低 API 成本\n\n## 高级配置\n\n### 异步初始化\n\nSDK 支持在异步环境中初始化：\n\n```typescript\nimport openlit from 'openlit';\n\nasync function initializeApp() {\n  await openlit.init({\n    otlpEndpoint: process.env.OTEL_EXPORTER_OTLP_ENDPOINT\n  });\n}\n```\n\n### 条件初始化\n\n在开发环境中可选择性地禁用追踪：\n\n```typescript\nopenlit.init({\n  otlpEndpoint: process.env.NODE_ENV === 'production' \n    ? \"http://127.0.0.1:4318\" \n    : undefined\n});\n```\n\n## 注意事项\n\n1. **端点配置优先级**：代码中的 `otlpEndpoint` 参数优先于环境变量\n2. **网络要求**：确保应用能够访问配置的 OTLP 端点\n3. **性能影响**：SDK 设计为低侵入性，对应用性能影响极小\n4. **数据类型**：自动捕获的数据包括文本内容，可能涉及敏感信息，请确保合规处理\n\n## 相关资源\n\n- 官方文档：https://docs.openlit.io\n- SDK 仓库：https://github.com/openlit/openlit/tree/main/sdk/typescript\n- OpenTelemetry 官方：https://opentelemetry.io\n\n---\n\n<a id='go-sdk'></a>\n\n## Go SDK\n\n### 相关页面\n\n相关主题：[Python SDK](#python-sdk), [TypeScript SDK](#typescript-sdk)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [sdk/go/openlit.go](https://github.com/openlit/openlit/blob/main/sdk/go/openlit.go)\n- [sdk/go/config.go](https://github.com/openlit/openlit/blob/main/sdk/go/config.go)\n- [sdk/go/instrumentation/openai/instrumentor.go](https://github.com/openlit/openlit/blob/main/sdk/go/instrumentation/openai/instrumentor.go)\n- [sdk/go/instrumentation/anthropic/instrumentor.go](https://github.com/openlit/openlit/blob/main/sdk/go/instrumentation/anthropic/instrumentor.go)\n- [sdk/go/go.mod](https://github.com/openlit/openlit/blob/main/sdk/go/go.mod)\n- [sdk/go/README.md](https://github.com/openlit/openlit/blob/main/sdk/go/README.md)\n</details>\n\n# Go SDK\n\nOpenLIT Go SDK 是一个原生支持 OpenTelemetry 的观测工具，专为 Go 语言开发的 GenAI 应用和 LLM 应用设计。该 SDK 提供自动化的链路追踪（Tracing）和指标收集（Metrics）功能，使开发者能够轻松地将应用程序的观测数据导出至 OpenLIT 平台进行可视化和分析。\n\n## 核心架构\n\n```mermaid\ngraph TD\n    A[Go 应用] --> B[OpenLIT SDK]\n    B --> C[OpenAI Instrumentation]\n    B --> D[Anthropic Instrumentation]\n    C --> E[OpenTelemetry Collector]\n    D --> E\n    E --> F[OpenLIT Dashboard]\n    \n    G[Rule Engine] --> H[HTTP API 调用]\n    H --> F\n```\n\nOpenLIT Go SDK 采用模块化架构，核心模块负责 SDK 初始化和配置管理，而插桩（Instrumentation）模块则负责拦截和追踪具体的 AI SDK 调用。Rule Engine 模块独立运行，无需调用 `Init()`，通过 HTTP 与 OpenLIT 平台通信。\n\n## 快速开始\n\n### 环境要求\n\n- Go 1.21 或更高版本\n- OpenLIT 后端服务运行中\n\n### 安装 SDK\n\n```bash\ngo get github.com/openlit/openlit/sdk/go\n```\n\n### 初始化 OpenLIT\n\n在应用程序启动时调用初始化方法：\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"log\"\n    \n    \"github.com/openlit/openlit/sdk/go\"\n)\n\nfunc main() {\n    err := openlit.Init(openlit.Config{\n        OtlpEndpoint:    \"http://127.0.0.1:4318\",\n        Environment:     \"production\",\n        ApplicationName: \"my-go-app\",\n    })\n    if err != nil {\n        log.Fatalf(\"初始化 OpenLIT 失败: %v\", err)\n    }\n    defer openlit.Shutdown(context.Background())\n}\n```\n\n资料来源：[sdk/go/README.md:Quick Start]()\n\n## 配置选项\n\n`Config` 结构体是 SDK 的核心配置单元，支持多种自定义选项：\n\n| 配置项 | 类型 | 说明 | 默认值 |\n|--------|------|------|--------|\n| `OtlpEndpoint` | string | OTLP 导出端点地址 | `http://localhost:4318` |\n| `Environment` | string | 运行环境名称 | `\"default\"` |\n| `ApplicationName` | string | 应用名称 | `\"default\"` |\n| `PricingInfo` | `map[string]ModelPricing` | 自定义模型定价信息 | 空 |\n| `OtlpHeaders` | `map[string]string` | 自定义 OTLP 导出头 | 空 |\n\n### 自定义模型定价\n\n```go\nconfig := openlit.Config{\n    PricingInfo: map[string]openlit.ModelPricing{\n        \"gpt-4-custom\": {\n            InputCostPerToken:  0.00003,\n            OutputCostPerToken: 0.00006,\n        },\n    },\n}\n```\n\n资料来源：[sdk/go/README.md:Custom Pricing]()\n\n### 自定义 Headers\n\n```go\nconfig := openlit.Config{\n    OtlpHeaders: map[string]string{\n        \"Authorization\": \"Bearer token\",\n        \"X-Custom-Header\": \"value\",\n    },\n}\n```\n\n资料来源：[sdk/go/README.md:Custom Headers]()\n\n## OpenAI 插桩\n\nOpenAI 插桩模块提供了对 `sashabaranov/go-openai` 客户端的自动追踪支持。\n\n### 使用方式\n\n```go\nimport (\n    \"github.com/openlit/openlit/sdk/go/instrumentation/openai\"\n    openai_sdk \"github.com/sashabaranov/go-openai\"\n)\n\n// 创建并插桩 OpenAI 客户端\nclient := openai_sdk.NewClient(\"your-api-key\")\ninstrumentedClient := openai.Instrument(client)\n\n// 使用方式与普通客户端完全相同，自动产生追踪数据\nresp, err := instrumentedClient.CreateChatCompletion(ctx, openai_sdk.ChatCompletionRequest{\n    Model: openai_sdk.GPT4,\n    Messages: []openai_sdk.ChatCompletionMessage{\n        {\n            Role:    openai_sdk.ChatMessageRoleUser,\n            Content: \"Hello!\",\n        },\n    },\n})\n```\n\n资料来源：[sdk/go/README.md:Instrument OpenAI]()\n\n### 工作原理\n\n```mermaid\nsequenceDiagram\n    participant App as 应用代码\n    participant Inst as InstrumentedClient\n    participant OpenAI as OpenAI API\n    participant OTel as OpenTelemetry\n    \n    App->>Inst: CreateChatCompletion()\n    Inst->>OpenAI: 调用 OpenAI API\n    OpenAI-->>Inst: 返回响应\n    Inst->>OTel: 创建 Span 和 Metrics\n    Inst-->>App: 返回响应结果\n```\n\n插桩客户端内部自动拦截所有 API 调用，创建相应的 OpenTelemetry Span，并记录输入/输出 token 数量、成本等指标数据。\n\n## Anthropic 插桩\n\nAnthropic 插桩模块支持对 Anthropic Claude API 的追踪。\n\n### 使用方式\n\n```go\nimport (\n    \"github.com/openlit/openlit/sdk/go/instrumentation/anthropic\"\n)\n\n// 创建并插桩 Anthropic 客户端\nclient := anthropic.NewClient(\"your-api-key\")\ninstrumentedClient := anthropic.Instrument(client)\n```\n\n资料来源：[sdk/go/README.md:Instrument Anthropic]()\n\n## 规则引擎\n\nOpenLIT Go SDK 提供独立的规则引擎评估功能，允许开发者对追踪属性进行规则匹配，并获取关联的实体信息。\n\n### 核心函数\n\n```go\nresult := openlit.EvaluateRule(ruleConfig)\n```\n\n### 特性\n\n- **独立运行**：无需调用 `openlit.Init()`，仅需 HTTP 连接即可使用\n- **规则匹配**：根据追踪属性评估匹配规则\n- **实体获取**：返回关联的上下文、提示词和评估配置\n\n资料来源：[sdk/go/README.md:Rule Engine]()\n\n## 与 OpenLIT Dashboard 集成\n\n### 1. 启动 OpenLIT 堆栈\n\n```bash\ndocker compose up -d\n```\n\n### 2. 配置 SDK 发送数据\n\n```go\nopenlit.Init(openlit.Config{\n    OtlpEndpoint: \"http://localhost:4318\",\n})\n```\n\n### 3. 查看追踪数据\n\n访问 http://localhost:3000 查看可视化追踪和指标数据。\n\n资料来源：[sdk/go/README.md:Integration with OpenLIT Dashboard]()\n\n## 示例项目\n\nSDK 仓库包含完整的可运行示例：\n\n| 示例路径 | 说明 |\n|----------|------|\n| `examples/openai/chat/` | OpenAI 聊天补全示例 |\n| `examples/openai/streaming/` | OpenAI 流式响应示例 |\n| `examples/anthropic/messages/` | Anthropic 消息 API 示例 |\n| `examples/anthropic/streaming/` | Anthropic 流式响应示例 |\n\n资料来源：[sdk/go/README.md:Examples]()\n\n## 模块结构\n\n```\nsdk/go/\n├── openlit.go              # 核心初始化和配置\n├── config.go               # 配置结构体定义\n├── go.mod                  # 模块依赖声明\n├── instrumentation/\n│   ├── openai/\n│   │   └── instrumentor.go  # OpenAI 插桩实现\n│   └── anthropic/\n│       └── instrumentor.go  # Anthropic 插桩实现\n└── examples/               # 示例代码\n```\n\n## 环境变量\n\n除代码配置外，SDK 也支持通过环境变量进行配置：\n\n| 环境变量 | 说明 |\n|----------|------|\n| `OTEL_EXPORTER_OTLP_ENDPOINT` | OTLP 导出端点 |\n\n## 关闭 SDK\n\n应用程序结束时，应优雅地关闭 SDK 以确保所有数据被正确刷新：\n\n```go\ndefer openlit.Shutdown(context.Background())\n\n---\n\n<a id='observability'></a>\n\n## 可观测性功能\n\n### 相关页面\n\n相关主题：[Python SDK](#python-sdk), [GPU Collector](#gpu-collector), [评估功能](#evaluations)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [src/client/src/app/(playground)/getting-started/page.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/app/(playground)/getting-started/page.tsx)\n- [sdk/python/src/openlit/instrumentation/claude_agent_sdk/__init__.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/instrumentation/claude_agent_sdk/__init__.py)\n- [sdk/python/src/openlit/instrumentation/llamaindex/utils.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/instrumentation/llamaindex/utils.py)\n- [sdk/python/src/openlit/instrumentation/langgraph/__init__.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/instrumentation/langgraph/__init__.py)\n- [sdk/python/src/openlit/instrumentation/openai/async_openai.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/instrumentation/openai/async_openai.py)\n- [sdk/typescript/src/instrumentation/llamaindex/index.ts](https://github.com/openlit/openlit/blob/main/sdk/typescript/src/instrumentation/llamaindex/index.ts)\n- [src/client/src/components/(playground)/getting-started/tracing/index.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/components/(playground)/getting-started/tracing/index.tsx)\n- [src/client/src/components/(playground)/agents/observability-block.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/components/(playground)/agents/observability-block.tsx)\n</details>\n\n# 可观测性功能\n\n## 概述\n\nOpenLIT 是一个基于 OpenTelemetry 原生的 GenAI 和 LLM 应用可观测性工具，旨在简化 LLM 应用与 OpenTelemetry 追踪和指标系统的集成过程。OpenLIT 通过自动插桩技术，为开发者提供开箱即用的可观测性能力，无需对现有代码进行大规模改造。资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:50]()\n\n### 核心设计理念\n\nOpenLIT 的可观测性功能遵循以下设计原则：\n\n1. **OpenTelemetry 原生支持**：完全兼容 OpenTelemetry 标准协议\n2. **零侵入式集成**：通过自动插桩（Auto-Instrumentation）实现透明监控\n3. **多框架支持**：覆盖主流 LLM 框架和应用框架\n4. **语义约定合规**：遵循 GenAI 语义约定规范\n\n---\n\n## 架构设计\n\n### 系统架构图\n\n```mermaid\ngraph TD\n    A[用户应用] --> B[OpenLIT SDK]\n    B --> C[自动插桩层]\n    C --> D[OpenTelemetry Collector]\n    D --> E[追踪数据]\n    D --> F[指标数据]\n    D --> G[事件数据]\n    \n    H[Python SDK] --> C\n    I[TypeScript SDK] --> C\n    \n    J[OpenAI] --> C\n    K[Anthropic] --> C\n    L[LlamaIndex] --> C\n    M[LangGraph] --> C\n    N[Claude Agent SDK] --> C\n    \n    E --> H1[追踪后端]\n    F --> M1[指标后端]\n    G --> E1[事件后端]\n```\n\n### 组件层次结构\n\n| 层级 | 组件 | 说明 |\n|------|------|------|\n| 应用层 | 用户代码 | 集成 OpenLIT SDK 的业务应用 |\n| SDK 层 | Python/TypeScript SDK | 提供初始化和配置接口 |\n| 插桩层 | 自动插桩模块 | 拦截并增强框架调用 |\n| 传输层 | OTLP 导出器 | 将遥测数据传输至后端 |\n| 后端层 | OpenTelemetry Collector | 收集和处理遥测数据 |\n\n---\n\n## 核心功能模块\n\n### 1. 追踪功能（Tracing）\n\nOpenLIT 的追踪功能通过包装框架的核心方法来创建分布式追踪 span，记录 LLM 调用的完整生命周期。\n\n#### 1.1 支持的框架和操作\n\n| 框架 | 操作类型 | 语义约定 |\n|------|----------|----------|\n| OpenAI | `chat`、`embedding` | `gen_ai.operation.type` |\n| Anthropic | `chat` | `gen_ai.operation.type` |\n| LlamaIndex | `query_engine_query`、`document_load`、`document_split`、`response_synthesize` | `gen_ai.operation.type` |\n| LangGraph | `execution`、`construction`、`checkpointing` | `gen_ai.operation.type` |\n| Claude Agent SDK | `invoke_agent`、`execute_tool` | `gen_ai.operation.type` |\n\n#### 1.2 LlamaIndex 操作映射\n\nOpenLIT 为 LlamaIndex 定义了精细的操作类型映射，采用简化的语义约定以提高处理效率：\n\n```python\nOPERATION_MAP = {\n    # 文档加载与处理\n    \"document_load\": SemanticConvention.GEN_AI_OPERATION_TYPE_RETRIEVE,\n    \"document_transform\": SemanticConvention.GEN_AI_OPERATION_TYPE_FRAMEWORK,\n    \"document_split\": SemanticConvention.GEN_AI_OPERATION_TYPE_FRAMEWORK,\n    \n    # 索引构建与管理\n    \"index_construct\": SemanticConvention.GEN_AI_OPERATION_TYPE_FRAMEWORK,\n    \"index_insert\": SemanticConvention.GEN_AI_OPERATION_TYPE_FRAMEWORK,\n    \n    # 查询引擎操作\n    \"query_engine_query\": SemanticConvention.GEN_AI_OPERATION_TYPE_RETRIEVE,\n    \"query_engine_query_async\": SemanticConvention.GEN_AI_OPERATION_TYPE_RETRIEVE,\n    \n    # 检索器操作\n    \"retriever_retrieve\": SemanticConvention.GEN_AI_OPERATION_TYPE_RETRIEVE,\n}\n```\n\n资料来源：[sdk/python/src/openlit/instrumentation/llamaindex/utils.py:14-36]()\n\n#### 1.3 TypeScript SDK 的 LlamaIndex 插桩\n\nTypeScript SDK 采用原型方法打补丁的方式实现 LlamaIndex 插桩：\n\n```typescript\n// 文档操作（框架 / 检索 span）\nthis._patchProto(m, ['SimpleDirectoryReader'], 'loadData',\n  LlamaIndexWrapper._patchFrameworkMethod(tracer, 'document_load'));\n\n// 文本分割\nthis._patchProto(m, ['SentenceSplitter', 'NodeParser'], 'getNodesFromDocuments',\n  LlamaIndexWrapper._patchFrameworkMethod(tracer, 'document_split'));\n\n// 检索操作\nthis._patchProto(m, ['BaseRetriever'], 'retrieve',\n  LlamaIndexWrapper._patchFrameworkMethod(tracer, 'retriever_retrieve'));\n```\n\n资料来源：[sdk/typescript/src/instrumentation/llamaindex/index.ts:78-92]()\n\n### 2. 指标功能（Metrics）\n\nOpenLIT 自动收集并记录关键性能指标，包括：\n\n| 指标类型 | 说明 | 记录方式 |\n|----------|------|----------|\n| 请求计数 | LLM 调用总次数 | 计数器 |\n| 令牌使用 | 输入/输出令牌数 | 计量器 |\n| 响应延迟 | 请求到响应的耗时 | 直方图 |\n| 错误率 | 失败请求的比例 | 计数器 |\n\n#### 指标收集流程\n\n```mermaid\ngraph LR\n    A[LLM 调用] --> B[插桩包装器]\n    B --> C{是否禁用指标?}\n    C -->|否| D[记录完成指标]\n    C -->|是| E[跳过指标记录]\n    D --> F[record_completion_metrics]\n    F --> G[更新指标后端]\n    \n    style C fill:#f9f,stroke:#333\n    style D fill:#bbf,stroke:#333\n```\n\n### 3. 事件功能（Events）\n\nOpenLIT 通过事件提供者（Event Provider）记录重要的应用事件，支持日志级别的事件追踪：\n\n```python\nevent_provider = _logs.get_logger_provider().get_logger(__name__)\n```\n\n事件功能允许开发者在追踪 span 之外记录额外的上下文信息，增强问题的排查能力。\n\n### 4. 异常处理\n\nOpenLIT 的插桩层实现了完善的异常处理机制，确保即使在监控过程中发生错误也不会影响应用正常运行：\n\n```python\nexcept Exception as e:\n    handle_exception(span, e)\n    if not disable_metrics and metrics:\n        record_completion_metrics(\n            metrics,\n            # ... 参数配置\n            error_type=type(e).__name__ or \"_OTHER\",\n        )\n```\n\n资料来源：[sdk/python/src/openlit/instrumentation/openai/async_openai.py:95-108]()\n\n---\n\n## SDK 使用指南\n\n### Python SDK\n\n#### 安装\n\n```bash\npip install openlit\n```\n\n#### 初始化配置\n\n```python\nimport openlit\n\nopenlit.init(otlp_endpoint=\"http://127.0.0.1:4318\")\n```\n\n或者通过环境变量配置：\n\n```bash\nexport OTEL_EXPORTER_OTLP_ENDPOINT=\"http://127.0.0.1:4318\"\n```\n\n#### 完整使用示例\n\n```python\nfrom openai import OpenAI\nimport openlit\n\nopenlit.init(otlp_endpoint=\"http://127.0.0.1:4318\")\n\nclient = OpenAI(api_key=\"YOUR_OPENAI_KEY\")\n\nchat_completion = client.chat.completions.create(\n    messages=[\n        {\n            \"role\": \"user\",\n            \"content\": \"What is LLM Observability?\",\n        }\n    ],\n    model=\"gpt-3.5-turbo\",\n)\n```\n\n资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:90-110]()\n\n### TypeScript SDK\n\n#### 安装\n\n通过 npm 或 yarn 安装 TypeScript SDK\n\n#### 初始化配置\n\n```typescript\nimport openlit from 'openlit';\n\nopenlit.init({\n  otlpEndpoint: \"http://127.0.0.1:4318\"\n});\n```\n\n#### 完整使用示例\n\n```typescript\nimport OpenAI from 'openai';\nimport openlit from 'openlit';\n\nopenlit.init({ otlpEndpoint: \"http://127.0.0.1:4318\" });\n\nconst client = new OpenAI({\n  apiKey: process.env.OPENAI_API_KEY\n});\n\nconst chatCompletion = await client.chat.completions.create({\n  messages: [{ role: 'user', content: 'What is LLM Observability?' }],\n  model: 'gpt-3.5-turbo',\n});\n```\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:95-110]()\n\n---\n\n## 插桩模块架构\n\n### 基类设计\n\nOpenLIT 的所有插桩模块都继承自 `BaseInstrumentor` 基类，提供统一的接口规范：\n\n```python\nclass ClaudeAgentSDKInstrumentor(BaseInstrumentor):\n    \"\"\"OTel GenAI semantic convention compliant instrumentor for Claude Agent SDK.\"\"\"\n    \n    def instrumentation_dependencies(self) -> Collection[str]:\n        return _instruments  # 声明依赖版本\n    \n    def _instrument(self, **kwargs):\n        # 执行插桩逻辑\n        tracer = trace.get_tracer(__name__)\n        # ... 配置和包装逻辑\n```\n\n资料来源：[sdk/python/src/openlit/instrumentation/claude_agent_sdk/__init__.py:26-38]()\n\n### LangGraph 插桩分类\n\nLangGraph 的插桩功能分为三大类：\n\n| 操作类别 | 说明 | 包含操作 |\n|----------|------|----------|\n| 执行操作 | 图执行相关 | `invoke`、`ainvoke`、`stream` 等 |\n| 构建操作 | 组件构建 | `add_node`、`add_edge` 等 |\n| 检查点操作 | 状态保存 | `get`、`put` 等 |\n\n```python\n# 执行操作包装\nself._wrap_execution_operations(\n    EXECUTION_OPERATIONS,\n    version,\n    environment,\n    application_name,\n    tracer,\n    pricing_info,\n    capture_message_content,\n    metrics,\n    disable_metrics,\n)\n\n# 检查点操作包装\nself._wrap_checkpoint_operations(\n    version,\n    environment,\n    application_name,\n    tracer,\n    pricing_info,\n    capture_message_content,\n    metrics,\n    disable_metrics,\n)\n```\n\n资料来源：[sdk/python/src/openlit/instrumentation/langgraph/__init__.py:50-100]()\n\n---\n\n## 配置选项\n\n### 初始化参数\n\n| 参数 | 类型 | 默认值 | 说明 |\n|------|------|--------|------|\n| `otlp_endpoint` | string | - | OTLP 导出器端点 |\n| `environment` | string | \"default\" | 运行环境标识 |\n| `application_name` | string | \"default\" | 应用名称 |\n| `pricing_info` | dict | {} | 定价信息映射 |\n| `capture_message_content` | bool | False | 是否捕获消息内容 |\n| `metrics` | bool | True | 是否启用指标收集 |\n| `disable_metrics` | bool | False | 是否禁用指标 |\n\n### 环境变量\n\n| 变量名 | 说明 |\n|--------|------|\n| `OTEL_EXPORTER_OTLP_ENDPOINT` | OTLP 端点地址 |\n| `OTEL_SERVICE_NAME` | 服务名称 |\n\n---\n\n## 前端可视化\n\n### 可观测性状态显示\n\nOpenLIT 前端提供了实时的可观测性状态展示功能：\n\n```typescript\n// SDK 启用状态标识\n{isStatic ? (\n    <span className=\"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md border border-emerald-200 dark:border-emerald-900 text-emerald-700 dark:text-emerald-400 bg-emerald-50/60 dark:bg-emerald-900/20\">\n        <span className=\"w-1.5 h-1.5 rounded-full bg-emerald-500\" />\n        {getMessage().AGENTS_SDK_ENABLED_VIA}\n    </span>\n) : pending ? (\n    // 待处理状态\n)}\n```\n\n资料来源：[src/client/src/components/(playground)/agents/observability-block.tsx:45-55]()\n\n### 版本追踪\n\n前端组件支持追踪不同版本的代理（Agent）使用情况：\n\n| 显示字段 | 说明 |\n|----------|------|\n| 首次出现时间 | `first_seen` |\n| 最后出现时间 | `last_seen` |\n| 请求计数 | `request_count` |\n| 主要模型 | `primary_model` |\n\n资料来源：[src/client/src/components/(playground)/agents/version-drawer.tsx:80-95]()\n\n---\n\n## 默认凭证\n\n首次部署 OpenLIT 后，访问前端界面需要使用以下默认登录凭证：\n\n| 字段 | 值 |\n|------|-----|\n| Email | user@openlit.io |\n| Password | openlituser |\n\n资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:60-65]()\n\n---\n\n## 技术栈总结\n\n### 核心技术依赖\n\n| 组件 | 用途 |\n|------|------|\n| OpenTelemetry | 遥测数据标准 |\n| wrapt | 函数包装 |\n| opentelemetry-instrumentation | 自动插桩框架 |\n\n### 支持的框架版本\n\n| 框架 | 最低版本要求 |\n|------|--------------|\n| Claude Agent SDK | >= 0.1.0 |\n| OpenAI | - |\n| LlamaIndex | - |\n| LangGraph | - |\n\n---\n\n## 总结\n\nOpenLIT 的可观测性功能通过标准化的 OpenTelemetry 集成，为 LLM 应用提供了全面的监控能力。其核心优势包括：\n\n- **多框架支持**：统一覆盖主流 GenAI 和 LLM 框架\n- **零侵入集成**：通过自动插桩实现快速部署\n- **标准化输出**：遵循 OpenTelemetry 和 GenAI 语义约定\n- **灵活配置**：支持多种初始化方式和配置参数\n- **优雅降级**：异常情况下不影响应用运行\n\n---\n\n<a id='evaluations'></a>\n\n## 评估功能\n\n### 相关页面\n\n相关主题：[Guardrails与规则引擎](#guardrails), [可观测性功能](#observability)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [sdk/python/src/openlit/guard/__init__.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/guard/__init__.py)\n- [src/client/src/utils/breadcrumbs.ts](https://github.com/openlit/openlit/blob/main/src/client/src/utils/breadcrumbs.ts)\n- [src/client/src/components/(playground)/getting-started/tracing/index.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/components/(playground)/getting-started/tracing/index.tsx)\n- [src/client/README.md](https://github.com/openlit/openlit/blob/main/src/client/README.md)\n- [sdk/python/src/openlit/instrumentation/claude_agent_sdk/__init__.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/instrumentation/claude_agent_sdk/__init__.py)\n\n</details>\n\n# 评估功能\n\n## 概述\n\nOpenLIT 的评估功能（Evaluation）是平台核心能力之一，旨在为 LLM 应用提供可量化的质量评估机制。通过集成 OpenTelemetry 原生架构，OpenLIT 能够对 AI 应用的响应质量、成本效率和性能表现进行全面的监控与评估。\n\n> **注意**：当前从源码中获取的评估功能相关文档较为有限，以下内容基于可观察到的系统架构和组件进行阐述。\n\n## 评估设置页面\n\n### 路由配置\n\n评估功能在客户端应用中具有独立的路由入口。根据路由配置，评估相关页面包括：\n\n| 路由路径 | 页面标题 | 面包屑导航 |\n|---------|---------|-----------|\n| `/evaluations/settings` | 评估设置（Evaluation Settings） | Settings → Evaluation Settings |\n\n资料来源：[src/client/src/utils/breadcrumbs.ts:1-150]()\n\n### 评估设置界面\n\n评估设置页面允许用户配置评估相关的参数和行为。页面采用标准的设置界面布局，与平台其他设置页面保持一致的交互模式。\n\n## 评估执行机制\n\n### SDK 层面的评估支持\n\nOpenLIT Python SDK 提供了多层次的支持机制，虽然直接的评估执行文件在当前源码上下文中未完全展示，但从系统架构可以看出评估功能与其他 SDK 组件的集成关系。\n\n```mermaid\ngraph TB\n    subgraph \"Python SDK\"\n        A[openlit.init] --> B[Guard System]\n        B --> C[PII Detection]\n        B --> D[Prompt Injection Detection]\n        B --> E[Moderation]\n        B --> F[Topic Restriction]\n    end\n    \n    subgraph \"Evaluation Layer\"\n        G[Evaluation Settings] --> H[Run Evaluation]\n        H --> I[Results Analysis]\n    end\n    \n    C --> G\n    D --> G\n    E --> G\n    F --> G\n```\n\n## Guard 系统与评估质量保障\n\n### Guard 组件架构\n\nOpenLIT 的 Guard 系统是评估功能的重要组成部分，提供生产级的安全保障机制。Guard 组件可以作为评估流程中的质量过滤器使用。\n\n资料来源：[sdk/python/src/openlit/guard/__init__.py:1-47]()\n\n### 核心 Guard 类\n\n| 类名 | 功能描述 | 使用场景 |\n|-----|---------|---------|\n| `PII` | 个人身份信息检测与处理 | 隐私合规评估 |\n| `PromptInjection` | 提示词注入攻击检测 | 安全性评估 |\n| `SensitiveTopic` | 敏感话题识别 | 内容安全评估 |\n| `TopicRestriction` | 话题范围限制 | 主题一致性评估 |\n| `Moderation` | 内容审核 | 合规性评估 |\n| `Schema` | 输出结构验证 | 格式正确性评估 |\n| `Custom` | 自定义 Guard 逻辑 | 定制化评估规则 |\n\n### Guard 基础类型\n\n```python\n# 基础类型定义\nGuard              # Guard 基类\nGuardAction        # Guard 执行动作\nGuardPhase         # Guard 执行阶段\nGuardResult        # Guard 执行结果\nPipelineResult     # 管道执行结果\n```\n\n资料来源：[sdk/python/src/openlit/guard/__init__.py:11-24]()\n\n### Guard 错误类型\n\n| 错误类 | 说明 |\n|-------|------|\n| `GuardError` | 基础 Guard 错误 |\n| `GuardDeniedError` | Guard 拒绝执行错误 |\n| `GuardTimeoutError` | Guard 执行超时错误 |\n| `GuardConfigError` | Guard 配置错误 |\n\n资料来源：[sdk/python/src/openlit/guard/__init__.py:26-31]()\n\n## 评估集成方式\n\n### 初始化配置\n\n在应用代码中集成评估功能的标准方式：\n\n```python\nimport openlit\n\n# 初始化 OpenLIT\nopenlit.init(\n    otlp_endpoint=\"http://127.0.0.1:4318\",\n    # 评估相关配置\n)\n```\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:1-100]()\n\n### Guard 与评估结合使用\n\n```python\nimport openlit\n\n# 初始化并启用 Guard\nopenlit.init(\n    guards=[\n        openlit.PII(action=\"redact\"),\n        openlit.Moderation(threshold=0.8)\n    ]\n)\n```\n\n## 技术架构\n\n### OpenTelemetry 原生集成\n\nOpenLIT 采用 OpenTelemetry 标准进行数据采集和传输，确保评估数据与追踪、指标数据的一致性。\n\n```mermaid\ngraph LR\n    A[Application] -->|Traces/Metrics| B[OpenLIT SDK]\n    B -->|OTLP| C[OpenTelemetry Collector]\n    C -->|Data| D[OpenLIT Backend]\n    D -->|Display| E[UI Dashboard]\n    \n    F[Evaluation Engine] -->|Quality Scores| D\n    G[Guard System] -->|Security Results| F\n```\n\n### 追踪与评估关联\n\n评估结果与应用的追踪数据关联存储，用户可以在 OpenLIT 前端界面中同时查看：\n\n- 追踪详情（Traces）\n- 评估分数（Evaluation Scores）\n- Guard 事件（Guard Events）\n- 成本与延迟指标（Cost & Latency Metrics）\n\n## 前端组件结构\n\n### 评估相关路由\n\n客户端应用使用 Next.js 的文件路由系统，评估功能页面位于：\n\n```\nsrc/client/src/app/(playground)/evaluations/\n```\n\n### 导航与面包屑\n\n评估功能通过统一的导航系统与平台其他功能整合，用户可以从主导航直接访问评估设置。\n\n资料来源：[src/client/src/utils/breadcrumbs.ts:60-75]()\n\n## SDK 仪器化支持\n\n### Claude Agent SDK 仪器化\n\nOpenLIT 支持对 Claude Agent SDK 进行仪器化，自动采集代理执行过程中的评估相关数据：\n\n资料来源：[sdk/python/src/openlit/instrumentation/claude_agent_sdk/__init__.py:1-50]()\n\n支持的仪器化操作：\n\n| 操作类型 | 追踪事件 | 说明 |\n|---------|---------|------|\n| `invoke_agent` | Agent 调用 | 追踪代理执行 |\n| `execute_tool` | 工具执行 | 追踪工具使用 |\n| `query` | 查询操作 | 追踪查询请求 |\n\n## 使用限制与注意事项\n\n### 当前源码限制\n\n从当前获取的源码上下文来看，评估功能的具体实现细节（如评估算法、评分标准等）需要在以下方面获取更多源码：\n\n1. 评估执行核心逻辑文件\n2. 评估结果存储与查询 API\n3. 前端评估配置界面组件\n4. 评估报告生成模块\n\n### 建议\n\n- 访问 OpenLIT 官方文档获取完整的评估功能使用指南\n- 查看 `sdk/python/src/openlit/evaluation/` 目录下的具体实现\n- 参考前端 `src/client/src/lib/platform/evaluation/` 目录了解评估流程\n\n## 相关资源\n\n| 资源 | 链接 |\n|------|------|\n| OpenLIT 官方文档 | https://docs.openlit.io |\n| GitHub 仓库 | https://github.com/openlit/openlit |\n| Python SDK | https://github.com/openlit/openlit/tree/main/sdk/python |\n| TypeScript SDK | https://github.com/openlit/openlit/tree/main/sdk/typescript |\n\n---\n\n*本文档基于 OpenLIT 开源项目源码生成，如有疏漏或更新延迟，请以官方最新文档为准。*\n\n---\n\n<a id='guardrails'></a>\n\n## Guardrails与规则引擎\n\n### 相关页面\n\n相关主题：[评估功能](#evaluations), [可观测性功能](#observability)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [sdk/python/src/openlit/guard/__init__.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/guard/__init__.py)\n- [sdk/python/src/openlit/guard/pii.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/guard/pii.py)\n- [sdk/python/src/openlit/guard/_base.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/guard/_base.py)\n- [sdk/python/src/openlit/guard/_pipeline.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/guard/_pipeline.py)\n- [sdk/python/src/openlit/guard/prompt_injection.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/guard/prompt_injection.py)\n- [sdk/python/src/openlit/guard/sensitive_topic.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/guard/sensitive_topic.py)\n</details>\n\n# Guardrails与规则引擎\n\n## 概述\n\nOpenLIT Guardrails是面向LLM应用的生产级安全防护系统，提供开箱即用的防护栏（Guardrails）和灵活可扩展的规则引擎（Rule Engine）。该系统通过在LLM应用的关键阶段注入检测逻辑，自动识别并处理敏感信息泄露、提示词注入攻击、违禁内容等安全风险。\n\nGuardrails系统基于OpenTelemetry语义约定设计，支持preflight（前置检查）和postflight（后置检查）两个执行阶段，可无缝集成到现有LLM应用架构中。资料来源：[sdk/python/src/openlit/guard/__init__.py:1-12]()\n\n## 架构设计\n\n### 核心组件\n\nOpenLIT Guardrails系统由以下核心组件构成：\n\n| 组件 | 文件路径 | 职责 |\n|------|----------|------|\n| Guard基类 | `guard/_base.py` | 定义所有Guard的通用接口和生命周期 |\n| Pipeline管道 | `guard/_pipeline.py` | 编排多个Guard的执行顺序和结果聚合 |\n| PII检测器 | `guard/pii.py` | 识别API密钥、个人身份信息等敏感数据 |\n| 提示词注入检测器 | `guard/prompt_injection.py` | 识别恶意提示词注入攻击 |\n| 敏感话题检测器 | `guard/sensitive_topic.py` | 检测涉及敏感话题的内容 |\n| 主题限制器 | `guard/topic_restriction.py` | 限制对话内容的主题范围 |\n| 内容审核器 | `guard/moderation.py` | 审核生成内容是否合规 |\n| Schema验证器 | `guard/schema.py` | 验证输出是否符合预定义Schema |\n| 自定义Guard | `guard/custom.py` | 支持用户自定义检测规则 |\n\n资料来源：[sdk/python/src/openlit/guard/__init__.py:14-36]()\n\n### 架构流程图\n\n```mermaid\ngraph TD\n    A[LLM请求入口] --> B[Preflight阶段]\n    B --> C{Guard Pipeline}\n    C --> D1[PII检测]\n    C --> D2[提示词注入检测]\n    C --> D3[敏感话题检测]\n    C --> D4[自定义Guard]\n    D1 --> E{检测结果}\n    D2 --> E\n    D3 --> E\n    D4 --> E\n    E -->|通过| F[调用LLM]\n    E -->|拒绝| G[返回GuardDeniedError]\n    E -->|警告| H[记录日志继续执行]\n    F --> I[Postflight阶段]\n    I --> J1[输出PII检测]\n    I --> J2[内容审核]\n    I --> J3[Schema验证]\n    J1 --> K[返回结果]\n    J2 --> K\n    J3 --> K\n```\n\n## Guard基类设计\n\n### 执行阶段\n\nGuard系统定义了两个核心执行阶段：\n\n| 阶段 | 说明 | 适用场景 |\n|------|------|----------|\n| `PREFLIGHT` | 在LLM调用前执行 | 输入内容检测、提示词保护 |\n| `POSTFLIGHT` | 在LLM调用后执行 | 输出内容审核、数据脱敏 |\n\n资料来源：[sdk/python/src/openlit/guard/_base.py]()\n\n### 动作类型\n\n每个Guard支持三种响应动作：\n\n| 动作 | 行为 | 返回结果 |\n|------|------|----------|\n| `redact` | 自动脱敏/替换敏感内容 | 返回脱敏后的文本 |\n| `deny` | 直接拒绝请求 | 抛出`GuardDeniedError` |\n| `warn` | 仅记录事件不阻断 | 返回原始文本并附带警告信息 |\n\n资料来源：[sdk/python/src/openlit/guard/_base.py]()\n\n### 错误类型\n\n| 错误类 | 触发条件 |\n|--------|----------|\n| `GuardError` | 通用Guard异常 |\n| `GuardDeniedError` | 内容被拒绝时抛出 |\n| `GuardTimeoutError` | 检测超时 |\n| `GuardConfigError` | 配置错误 |\n\n## PII检测器详解\n\n### 功能概述\n\nPII检测器是OpenLIT Guardrails最核心的组件之一，使用约25种高置信度正则表达式模式，在小于1毫秒的时间内完成本地检测。该检测器支持识别API密钥、PII个人信息和各类敏感凭证。\n\n### 支持的检测类型\n\n| 类别 | 检测项目 | 正则模式示例 |\n|------|----------|--------------|\n| API密钥 | OpenAI API Key | `sk-(?:proj-)?[A-Za-z0-9_-]{20,}` |\n| API密钥 | Anthropic API Key | `sk-ant-[A-Za-z0-9_-]{20,}` |\n| API密钥 | AWS Access Key | `AKIA[0-9A-Z]{16}` |\n| API密钥 | GCP API Key | `AIza[0-9A-Za-z_-]{35}` |\n| 令牌 | GitHub Token | `(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9_]{36,}` |\n| 证书 | 客户端证书 | PEM格式证书检测 |\n| 凭证 | 私钥检测 | RSA/DSA/EC私钥模式 |\n| 凭证 | Azure凭据 | Azure服务主体格式 |\n\n资料来源：[sdk/python/src/openlit/guard/pii.py:1-45]()\n\n### 使用方式\n\n```python\nimport openlit\n\n# 基础使用 - 自动脱敏\nopenlit.init(guards=[openlit.PII(action=\"redact\")])\n\n# 自定义检测模式\nopenlit.init(guards=[\n    openlit.PII(\n        action=\"deny\",\n        custom_patterns={\n            \"custom-secret\": r\"secret-[A-Za-z0-9]{16}\",\n            \"internal-id\": r\"INT-\\d{8}\"\n        }\n    )\n])\n```\n\n### 脱敏机制\n\n当检测到敏感信息时，PII检测器会将匹配内容替换为标准化的占位符格式：\n\n```\n[REDACTED:<label>]\n```\n\n其中`<label>`为检测类型的标签名称（如`openai-api-key`、`github-token`等）。脱敏过程采用从后向前替换策略，确保位置索引准确性。\n\n资料来源：[sdk/python/src/openlit/guard/pii.py:95-120]()\n\n## Pipeline管道编排\n\n### 功能说明\n\nPipeline用于将多个Guard组合成检测链，支持顺序执行和结果聚合。Pipeline接受一个Guard列表，按声明顺序依次执行每个Guard的检测逻辑。\n\n### 执行结果\n\n```python\n@dataclass\nclass PipelineResult:\n    guard_results: List[GuardResult]  # 各Guard的检测结果\n    final_action: GuardAction          # 最终采取的动作\n    transformed_text: Optional[str]    # 转换后的文本\n```\n\n资料来源：[sdk/python/src/openlit/guard/_base.py]()\n\n### 配置选项\n\n| 参数 | 类型 | 默认值 | 说明 |\n|------|------|--------|------|\n| `guards` | List[Guard] | [] | Guard实例列表 |\n| `timeout` | float | 5.0 | 检测超时时间（秒） |\n\n## 集成方式\n\n### 方式一：初始化时配置\n\n```python\nimport openlit\n\n# 在应用初始化时配置Guardrails\nopenlit.init(\n    guards=[\n        openlit.PII(action=\"redact\"),\n        openlit.PromptInjection(action=\"deny\"),\n        openlit.Moderation(action=\"warn\")\n    ]\n)\n```\n\n### 方式二：直接导入使用\n\n```python\nfrom openlit import PII, PromptInjection, Moderation\n\n# 独立使用单个Guard\npii_guard = PII(action=\"redact\")\nresult = pii_guard.evaluate(\"请帮我分析这个API密钥: sk-abc123...\")\n\nif result.action == GuardAction.DENY:\n    print(\"检测到敏感信息，请求被拒绝\")\n```\n\n资料来源：[sdk/python/src/openlit/guard/__init__.py:4-12]()\n\n## 性能特性\n\n| 特性 | 指标 | 说明 |\n|------|------|------|\n| 本地执行 | <1ms | 所有检测在本地完成，无外部依赖 |\n| 内存占用 | 低 | 使用预编译正则表达式 |\n| 并发支持 | 高 | 无状态设计，支持高并发场景 |\n| 可扩展性 | 自定义模式 | 支持用户添加自定义正则表达式 |\n\n## 最佳实践\n\n### 输入保护策略\n\n建议在`PREFLIGHT`阶段启用PII检测和提示词注入检测，防止敏感信息进入LLM处理流程：\n\n```python\nopenlit.init(guards=[\n    openlit.PII(action=\"redact\"),           # 脱敏输入中的敏感信息\n    openlit.PromptInjection(action=\"deny\")  # 拒绝明显的注入攻击\n])\n```\n\n### 输出审核策略\n\n建议在`POSTFLIGHT`阶段启用内容审核和Schema验证，确保输出符合预期：\n\n```python\nopenlit.init(guards=[\n    openlit.Moderation(action=\"warn\"),  # 审核输出内容\n    openlit.Schema(action=\"deny\")        # 验证输出格式\n])\n```\n\n### 混合策略\n\n生产环境推荐使用Pipeline组合多种Guard：\n\n```python\nopenlit.init(guards=[\n    openlit.PII(action=\"redact\"),\n    openlit.PromptInjection(action=\"deny\"),\n    openlit.SensitiveTopic(action=\"warn\"),\n    openlit.TopicRestriction(allowed_topics=[\"技术\", \"产品\"], action=\"deny\")\n])\n```\n\n## 扩展开发\n\n### 创建自定义Guard\n\n```python\nfrom openlit.guard._base import Guard, GuardAction, GuardPhase, GuardResult\nimport re\n\nclass MyCustomGuard(Guard):\n    name = \"my_custom_guard\"\n    phases = (GuardPhase.PREFLIGHT, GuardPhase.POSTFLIGHT)\n    \n    def __init__(self, pattern: str, action: str = \"warn\", **kwargs):\n        super().__init__(action=action, **kwargs)\n        self._pattern = re.compile(pattern)\n    \n    def evaluate(self, text: str) -> GuardResult:\n        matches = self._pattern.findall(text)\n        if matches:\n            return GuardResult(\n                guard_name=self.name,\n                action=self._action,\n                classification=f\"matched_{len(matches)}_times\"\n            )\n        return GuardResult(guard_name=self.name)\n```\n\n### 注册自定义Guard\n\n```python\nfrom openlit import Custom\n\n# 使用Custom Guard注册自定义检测逻辑\nopenlit.init(guards=[\n    Custom(\n        name=\"my_detector\",\n        evaluate_fn=lambda text: detect_custom_pattern(text),\n        action=\"deny\"\n    )\n])\n```\n\n## 总结\n\nOpenLIT Guardrails系统提供了完整的企业级LLM安全防护解决方案，其设计遵循以下核心原则：\n\n- **高性能**：本地化检测，毫秒级响应\n- **低侵入**：通过`openlit.init()`一行代码即可启用\n- **可扩展**：支持自定义Guard和检测模式\n- **标准化**：符合OpenTelemetry GenAI语义约定\n\n通过合理配置Guardrails与规则引擎，开发者可以在不影响用户体验的前提下，有效防止数据泄露、内容滥用和安全攻击等风险。\n\n---\n\n<a id='controller'></a>\n\n## OpenLIT Controller\n\n### 相关页面\n\n相关主题：[GPU Collector](#gpu-collector), [Python SDK](#python-sdk)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [src/client/src/app/(playground)/agents/no-controller.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/app/(playground)/agents/no-controller.tsx)\n- [src/client/src/lib/platform/controller/features/agent.ts](https://github.com/openlit/openlit/blob/main/src/client/src/lib/platform/controller/features/agent.ts)\n- [sdk/python/src/openlit/guard/__init__.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/guard/__init__.py)\n- [sdk/go/README.md](https://github.com/openlit/openlit/blob/main/sdk/go/README.md)\n- [sdk/typescript/README.md](https://github.com/openlit/openlit/blob/main/sdk/typescript/README.md)\n</details>\n\n# OpenLIT Controller\n\n## 概述\n\nOpenLIT Controller 是 OpenLIT 平台的核心组件之一，负责在运行时自动检测和插桩 Python 应用程序。它作为一个独立的守护进程运行，能够自动发现用户环境中的 LLM 应用并进行零侵入式的可观测性数据采集，无需修改应用程序代码。\n\nOpenLIT Controller 的主要职责包括：\n\n- **自动检测**：扫描目标环境中的 Python 应用\n- **运行时插桩**：在运行时动态修改 Python 代码，注入 OpenTelemetry 埋点\n- **自动配置**：根据检测到的框架自动应用相应的配置\n- **进程管理**：管理被插桩进程的完整生命周期\n\n## 架构设计\n\n### 组件关系\n\n```mermaid\ngraph TD\n    A[OpenLIT Controller] --> B[Scanner 扫描器]\n    A --> C[Engine 引擎]\n    A --> D[Server 服务器]\n    \n    B --> B1[Python 应用检测]\n    B --> B2[框架识别]\n    B --> B3[依赖分析]\n    \n    C --> C1[运行时插桩]\n    C --> C2[进程管理]\n    C --> C3[配置应用]\n    \n    D --> D1[HTTP API]\n    D --> D2[状态查询]\n    D --> D3[操作指令]\n    \n    E[用户环境] --> B\n    E --> F[Python 应用]\n    F --> C\n    G[OpenLIT Dashboard] --> D\n    D --> H[OTLP 端点]\n```\n\n### 技术栈\n\n| 组件 | 技术选型 | 说明 |\n|------|----------|------|\n| 核心语言 | Go | 高性能、跨平台支持 |\n| 检测引擎 | Python AST 分析 | 精确的代码结构理解 |\n| 通信协议 | OTLP | OpenTelemetry 标准协议 |\n| 部署方式 | Systemd / Docker | 灵活的部署选项 |\n\n## 部署方式\n\nOpenLIT Controller 支持多种部署方式，适应不同的运行环境需求。\n\n### Linux 系统部署\n\n在 Linux 环境中，Controller 可以作为 systemd 服务运行，提供稳定的长期运行能力。\n\n```bash\ncurl -fsSL https://github.com/openlit/openlit/releases/latest/download/openlit-controller-linux-amd64 \\\n  -o /usr/local/bin/openlit-controller\nchmod +x /usr/local/bin/openlit-controller\n\n# 创建 systemd 服务\ncat > /etc/systemd/system/openlit-controller.service << 'EOF'\n[Unit]\nDescription=OpenLIT Controller\nAfter=network.target\n\n[Service]\nEnvironment=\"OPENLIT_URL=${openlitUrl}\"\nEnvironment=\"OTEL_EXPORTER_OTLP_ENDPOINT=${openlitUrl.replace(/:\\d+$/, \":4318\")}\"\nEnvironment=\"OPENLIT_API_KEY=${apiKey}\"\nExecStart=/usr/local/bin/openlit-controller\nRestart=always\n\n[Install]\nWantedBy=multi-user.target\nEOF\n\nsystemctl daemon-reload\nsystemctl enable --now openlit-controller\n```\n\n### Docker 容器部署\n\n对于容器化环境，Controller 可以以特权模式运行，以便进行进程间通信和系统级操作。\n\n```bash\ndocker run -d --privileged --pid=host \\\n  openlit/openlit-controller:latest\n```\n\n## 环境变量配置\n\nController 通过环境变量接收配置信息，这些变量定义了与主平台的连接方式和认证凭证。\n\n| 环境变量 | 说明 | 示例值 |\n|----------|------|--------|\n| `OPENLIT_URL` | OpenLIT 平台 URL | `http://127.0.0.1:3000` |\n| `OTEL_EXPORTER_OTLP_ENDPOINT` | OTLP 导出端点 | `http://127.0.0.1:4318` |\n| `OPENLIT_API_KEY` | API 认证密钥 | `sk-xxx` |\n\n环境变量通过模板字符串进行配置，支持动态插值：\n\n```typescript\nconst systemdKey = apiKey\n    ? `\\nEnvironment=\"OPENLIT_API_KEY=${apiKey}\"`\n    : \"\";\n```\n\n资料来源：[src/client/src/app/(playground)/agents/no-controller.tsx:18-22]()\n\n## 功能特性\n\n### 自动框架检测\n\nController 内置了对多种主流 LLM 框架的自动检测能力，能够识别以下框架：\n\n| 框架类型 | 检测方式 | 支持语言 |\n|----------|----------|----------|\n| OpenAI SDK | 导入语句分析 | Python |\n| Anthropic SDK | 导入语句分析 | Python |\n| LangChain | 依赖检测 | Python |\n| LlamaIndex | 依赖检测 | Python |\n| LiteLLM | 导入语句分析 | Python |\n\n### 运行时插桩机制\n\nController 采用无代理（Agentless）方式的动态插桩技术：\n\n```mermaid\nsequenceDiagram\n    participant Scanner as 扫描器\n    participant Engine as 插桩引擎\n    participant App as Python 应用\n    participant OTLP as OTLP 端点\n\n    Scanner->>App: 检测运行环境\n    Scanner->>Engine: 报告检测结果\n    Engine->>App: 注入埋点代码\n    App->>OTLP: 发送追踪数据\n    Engine->>App: 监控运行状态\n```\n\n### 进程生命周期管理\n\nController 负责管理被插桩进程的完整生命周期，包括：\n\n- **启动**：在检测到目标应用后自动启动插桩\n- **监控**：持续监控进程状态和健康状况\n- **重启**：在进程异常终止时自动重启\n- **停止**：在收到停止指令后优雅终止\n\n## API 接口\n\nController 提供 HTTP API 用于外部控制和状态查询。\n\n### 状态查询\n\n```bash\ncurl http://localhost:8080/status\n```\n\n响应示例：\n\n```json\n{\n  \"status\": \"enabled\",\n  \"mode\": \"kubernetes\",\n  \"service\": \"my-llm-app\",\n  \"namespace\": \"default\",\n  \"transitioning\": false\n}\n```\n\n### 操作指令\n\n| 操作 | 说明 | 参数 |\n|------|------|------|\n| `enable` | 启用自动插桩 | `serviceId` |\n| `disable` | 禁用自动插桩 | `serviceId` |\n| `status` | 查询当前状态 | `serviceId` |\n\n## 与 Python SDK 的集成\n\nOpenLIT Controller 与 Python SDK 形成互补关系，提供端到端的可观测性解决方案：\n\n```python\n# Python SDK - 手动初始化\nimport openlit\n\nopenlit.init(otlp_endpoint=\"http://127.0.0.1:4318\")\n\n# 与 Controller 配合时，Controller 自动处理\n# 未初始化的 Python 应用\n```\n\n当 Python 应用未显式初始化 OpenLIT 时，Controller 可以自动注入初始化代码，实现零配置的可观测性。\n\n资料来源：[sdk/python/src/openlit/guard/__init__.py:1-45]()\n\n## 安全特性\n\n### 认证机制\n\nController 支持 API Key 认证，确保只有授权的客户端可以访问控制接口：\n\n```bash\ncurl -H \"Authorization: Bearer <API_KEY>\" \\\n  http://localhost:8080/status\n```\n\n### 网络隔离\n\nController 支持通过环境变量配置 OTLP 端点，支持 TLS 加密传输，适用于生产环境部署：\n\n```bash\nEnvironment=\"OTEL_EXPORTER_OTLP_ENDPOINT=https://collector.internal:4318\"\n```\n\n## 故障排除\n\n### 常见问题\n\n| 问题 | 可能原因 | 解决方案 |\n|------|----------|----------|\n| Controller 无法启动 | 端口被占用 | 检查 8080 端口占用情况 |\n| 无法连接 OTLP 端点 | 网络隔离 | 检查防火墙规则 |\n| 应用未被检测 | 非 Python 应用 | 确认应用语言运行时 |\n| 数据未上报 | 端点配置错误 | 验证 OTEL_EXPORTER_OTLP_ENDPOINT |\n\n### 日志查看\n\n```bash\n# Systemd 日志\njournalctl -u openlit-controller -f\n\n# Docker 日志\ndocker logs -f openlit-controller\n```\n\n## 最佳实践\n\n### 生产环境部署建议\n\n1. **高可用配置**：使用 Kubernetes 部署时，配置多副本保障可用性\n2. **资源限制**：为 Controller 设置适当的 CPU 和内存限制\n3. **网络安全**：使用 TLS 加密 OTLP 通信，确保数据传输安全\n4. **监控告警**：对 Controller 进程本身进行监控，及时发现异常\n\n### 性能优化\n\n- Controller 本身资源消耗极低，不会影响目标应用性能\n- 插桩开销主要在数据序列化阶段，可通过批量发送优化\n- 建议使用 gRPC 协议的 OTLP 端点以获得更好的性能\n\n## 相关文档\n\n- [OpenLIT Python SDK 文档](https://github.com/openlit/openlit/tree/main/sdk/python)\n- [OpenLIT TypeScript SDK 文档](https://github.com/openlit/openlit/tree/main/sdk/typescript)\n- [OpenLIT Go SDK 文档](https://github.com/openlit/openlit/tree/main/sdk/go)\n- [OpenLIT 官方文档](https://docs.openlit.io/)\n\n---\n\n<a id='gpu-collector'></a>\n\n## GPU Collector\n\n### 相关页面\n\n相关主题：[OpenLIT Controller](#controller), [可观测性功能](#observability)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [opentelemetry-gpu-collector/README.md](https://github.com/openlit/openlit/blob/main/opentelemetry-gpu-collector/README.md)\n- [sdk/go/README.md](https://github.com/openlit/openlit/blob/main/sdk/go/README.md)\n- [src/client/README.md](https://github.com/openlit/openlit/blob/main/src/client/README.md)\n</details>\n\n# GPU Collector\n\nGPU Collector 是 OpenLIT 项目中的一个核心组件，负责从 NVIDIA、AMD、Intel 等主流 GPU 设备中采集硬件遥测数据，并以 OpenTelemetry 标准格式导出供监控和分析使用。该组件基于 OpenTelemetry Collector 架构构建，支持通过 eBPF 技术实现 CUDA 内核级别的追踪能力。\n\n## 概述\n\nGPU Collector 旨在为人工智能和高性能计算场景提供统一的 GPU 硬件监控解决方案。它能够实时采集 GPU 的功耗、时钟频率、内存使用、计算利用率等关键指标，并将这些数据通过 OTLP（OpenTelemetry Protocol）协议发送到后端监控系统。资料来源：[opentelemetry-gpu-collector/README.md](https://github.com/openlit/openlit/blob/main/opentelemetry-gpu-collector/README.md)\n\n该组件的主要设计目标包括：\n\n- 提供跨厂商（NVIDIA、AMD、Intel）的 GPU 监控支持\n- 遵循 OpenTelemetry 语义约定（`hw.gpu.*`）确保指标命名标准化\n- 支持通过 Prometheus `/metrics` 端点暴露数据（规划中）\n- 利用 eBPF 技术实现低开销的内核级追踪\n- 支持 Docker Compose 和独立二进制等多种部署方式\n\n## 功能特性\n\nGPU Collector 目前已完成的功能和规划中的特性如下表所示：\n\n| 功能特性 | 状态 |\n|---------|------|\n| NVIDIA GPU 硬件遥测（NVML） | 已完成 |\n| AMD GPU 硬件遥测（sysfs/hwmon） | 已完成 |\n| Intel GPU 硬件遥测（sysfs/hwmon） | 已完成 |\n| eBPF CUDA 内核追踪 | 已完成 |\n| OTel 语义约定合规（`hw.gpu.*`） | 已完成 |\n| Prometheus `/metrics` 端点 | 规划中 |\n| ROCm HIP 追踪（AMD eBPF） | 规划中 |\n| 每进程 GPU 利用率（DRM fdinfo） | 规划中 |\n\n资料来源：[opentelemetry-gpu-collector/README.md](https://github.com/openlit/openlit/blob/main/opentelemetry-gpu-collector/README.md)\n\n## 指标体系\n\nGPU Collector 定义了一套完整的 GPU 硬件指标体系，涵盖功耗、时钟频率、能耗和错误等多个维度。\n\n### 核心指标\n\n| 指标名称 | 类型 | 单位 | 描述 | NVIDIA | AMD | Intel |\n|---------|------|------|------|:------:|:---:|:-----:|\n| `hw.gpu.power.draw` | Gauge | W | 当前功耗 | ✓ | ✓ | ✓ |\n| `hw.gpu.power.limit` | Gauge | W | 功率限制 | ✓ | ✓ | ✓ |\n| `hw.gpu.energy.consumed` | Counter | J | 累计能耗 | ✓ | ✓ | ✓ |\n| `hw.gpu.clock.graphics` | Gauge | MHz | 图形/SM 时钟频率 | ✓ | ✓ | ✓* |\n| `hw.gpu.clock.memory` | Gauge | MHz | 内存时钟频率 | ✓ | ✓ | — |\n| `hw.errors` | Counter | {error} | ECC 和 PCIe 错误 | ✓ | — | — |\n\n> * Intel 支持取决于驱动程序（i915/Xe）和内核版本\n\n资料来源：[opentelemetry-gpu-collector/README.md](https://github.com/openlit/openlit/blob/main/opentelemetry-gpu-collector/README.md)\n\n### 指标属性\n\n所有 GPU 指标都携带以下标识属性，用于唯一定位和区分设备：\n\n| 属性名称 | 描述 | 示例值 |\n|---------|------|--------|\n| `hw.id` | 设备唯一标识符（规范要求） | `GPU-a1b2c3d4-...` |\n| `hw.name` | 产品名称 | `NVIDIA A100-SXM4-80GB` |\n| `hw.vendor` | 厂商名称 | `nvidia`、`amd`、`intel` |\n| `gpu.index` | 设备索引 | `0`、`1` |\n| `gpu.pci_address` | PCI 总线地址 | `0000:01:00.0` |\n\n### 额外属性\n\n某些指标还包含额外的上下文属性：\n\n| 指标名称 | 额外属性 | 可选值 |\n|---------|---------|--------|\n| `hw.gpu.utilization` | `hw.gpu.task` | `general`、`encoder`、`decoder` |\n\n资料来源：[opentelemetry-gpu-collector/README.md](https://github.com/openlit/openlit/blob/main/opentelemetry-gpu-collector/README.md)\n\n## 系统架构\n\nGPU Collector 的系统架构遵循模块化设计原则，主要包含以下核心模块：\n\n```mermaid\ngraph TD\n    A[GPU Collector 入口] --> B[GPU 数据采集层]\n    A --> C[eBPF 内核追踪层]\n    B --> D[指标处理与聚合]\n    C --> D\n    D --> E[OpenTelemetry 导出器]\n    E --> F[OTLP Endpoint]\n    E --> G[Prometheus Endpoint]\n    \n    B --> B1[NVML NVIDIA]\n    B --> B2[sysfs hwmon AMD]\n    B --> B3[sysfs hwmon Intel]\n    \n    style A fill:#e1f5fe\n    style E fill:#fff3e0\n    style F fill:#e8f5e9\n    style G fill:#f3e5f5\n```\n\n### 采集层\n\n采集层负责与底层 GPU 驱动和硬件接口交互，根据不同厂商采用相应的采集方式：\n\n- **NVIDIA**：通过 NVML（NVIDIA Management Library）API 直接查询 GPU 状态\n- **AMD**：通过 sysfs/hwmon 文件系统读取硬件传感器数据\n- **Intel**：通过 sysfs/hwmon 文件系统读取硬件传感器数据（依赖特定驱动）\n\n### eBPF 追踪层\n\neBPF（Extended Berkeley Packet Filter）模块用于实现 CUDA 内核级别的追踪能力，能够捕获 GPU 上的计算任务执行信息，提供细粒度的性能分析数据。\n\n### 导出层\n\n导出层负责将采集和处理的指标数据以标准格式输出。当前支持：\n\n- **OTLP 协议**：通过 `OTEL_EXPORTER_OTLP_ENDPOINT` 配置发送至 OpenTelemetry Collector 或后端服务\n- **Prometheus 格式**（规划中）：通过 `/metrics` 端点暴露数据供 Prometheus 抓取\n\n## 部署方式\n\nGPU Collector 提供多种部署方式以适应不同的使用场景。\n\n### Docker 镜像\n\n使用预构建的 Docker 镜像是最简便的部署方式：\n\n```bash\ndocker run -d \\\n    --gpus all \\\n    --name otel-gpu-collector \\\n    -e OTEL_SERVICE_NAME=my-app \\\n    -e OTEL_RESOURCE_ATTRIBUTES=\"deployment.environment=production\" \\\n    -e OTEL_EXPORTER_OTLP_ENDPOINT=\"http://otel-collector:4317\" \\\n    ghcr.io/openlit/otel-gpu-collector:latest\n```\n\n资料来源：[opentelemetry-gpu-collector/README.md](https://github.com/openlit/openlit/blob/main/opentelemetry-gpu-collector/README.md)\n\n### Docker Compose 集成\n\n在已有 OpenLIT 栈的环境中，可以通过 Docker Compose 部署 GPU Collector：\n\n```yaml\nservices:\n  otel-gpu-collector:\n    image: ghcr.io/openlit/otel-gpu-collector:latest\n    environment:\n      OTEL_SERVICE_NAME: my-app\n      OTEL_RESOURCE_ATTRIBUTES: \"deployment.environment=production\"\n      OTEL_EXPORTER_OTLP_ENDPOINT: \"http://otel-collector:4317\"\n    deploy:\n      resources:\n        reservations:\n          devices:\n            - driver: nvidia\n              count: all\n              capabilities: [gpu]\n    depends_on:\n      - otel-collector\n    restart: always\n```\n\n资料来源：[opentelemetry-gpu-collector/README.md](https://github.com/openlit/openlit/blob/main/opentelemetry-gpu-collector/README.md)\n\n### 二进制部署\n\n对于无法使用 Docker 的环境，可以下载预编译的二进制文件：\n\n```sh\n# Linux amd64\ncurl -L https://github.com/openlit/openlit/releases/latest/download/opentelemetry-gpu-collector-<version>-linux-amd64 \\\n    -o opentelemetry-gpu-collector\nchmod +x opentelemetry-gpu-collector\n\nOTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317 ./opentelemetry-gpu-collector\n```\n\n资料来源：[opentelemetry-gpu-collector/README.md](https://github.com/openlit/openlit/blob/main/opentelemetry-gpu-collector/README.md)\n\n### 源码构建\n\n从源码构建需要 Go 编译环境：\n\n```sh\ngit clone https://github.com/openlit/openlit.git\ncd openlit/opentelemetry-gpu-collector\nmake build\n./opentelemetry-gpu-collector\n```\n\n## 配置说明\n\nGPU Collector 通过标准 OpenTelemetry 环境变量进行配置，所有配置项如下表所示：\n\n| 环境变量 | 默认值 | 描述 |\n|---------|-------|------|\n| `OTEL_EXPORTER_OTLP_ENDPOINT` | （必需） | OTLP 导出器端点地址 |\n| `OTEL_SERVICE_NAME` | - | 服务名称标识 |\n| `OTEL_RESOURCE_ATTRIBUTES` | - | 资源属性键值对 |\n\n资料来源：[opentelemetry-gpu-collector/README.md](https://github.com/openlit/openlit/blob/main/opentelemetry-gpu-collector/README.md)\n\n## 与 SDK 的集成\n\nGPU Collector 通常与 OpenLIT 提供的多语言 SDK 配合使用，形成完整的可观测性解决方案。SDK 负责在应用层面采集 LLM 调用追踪和指标，而 GPU Collector 则负责基础设施层面的硬件指标采集。\n\n### Go SDK 配置示例\n\nGo SDK 支持自定义定价信息和 OTLP 导出配置：\n\n```go\nconfig := openlit.Config{\n    OtlpEndpoint: \"http://localhost:4318\",\n    OtlpHeaders: map[string]string{\n        \"Authorization\": \"Bearer token\",\n        \"X-Custom-Header\": \"value\",\n    },\n    PricingInfo: map[string]openlit.ModelPricing{\n        \"gpt-4-custom\": {\n            InputCostPerToken:  0.00003,\n            OutputCostPerToken: 0.00006,\n        },\n    },\n}\n\nopenlit.Init(config)\n```\n\n资料来源：[sdk/go/README.md](https://github.com/openlit/openlit/blob/main/sdk/go/README.md)\n\n### 集成流程\n\n完整的集成流程如下：\n\n1. 启动 OpenLIT 基础设施栈（包含 OpenTelemetry Collector、存储和可视化组件）\n2. 在应用服务器上部署 GPU Collector 并配置 OTLP 端点\n3. 在应用代码中集成 OpenLIT SDK，配置相同的 OTLP 端点\n4. 在 OpenLIT Dashboard 中查看追踪和指标数据\n\n```mermaid\ngraph LR\n    A[应用代码 + SDK] -->|OTLP Traces| B[OpenTelemetry Collector]\n    C[GPU Collector] -->|OTLP Metrics| B\n    B --> D[OpenLIT Backend]\n    D --> E[Dashboard]\n```\n\n## 技术依赖\n\nGPU Collector 的正常运行依赖以下技术组件：\n\n| 组件 | 用途 | 平台支持 |\n|-----|------|---------|\n| NVML | NVIDIA GPU 管理接口 | NVIDIA GPU |\n| sysfs/hwmon | Linux 硬件传感器接口 | AMD、Intel GPU |\n| eBPF | 内核级追踪 | Linux 4.x+ |\n| OpenTelemetry Collector | 指标导出协议 | 全平台 |\n\n## 许可说明\n\nOpenTelemetry GPU Collector 由 OpenLIT 团队构建和维护，采用 Apache-2.0 开源许可证。资料来源：[opentelemetry-gpu-collector/README.md](https://github.com/openlit/openlit/blob/main/opentelemetry-gpu-collector/README.md)\n\n---\n\n---\n\n## Doramagic 踩坑日志\n\n项目：openlit/openlit\n\n摘要：发现 15 个潜在踩坑项，其中 0 个为 high/blocking；最高优先级：安装坑 - 来源证据：Integration: Governance and compliance signals for LLM observability。\n\n## 1. 安装坑 · 来源证据：Integration: Governance and compliance signals for LLM observability\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个安装相关的待验证问题：Integration: Governance and compliance signals for LLM observability\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_16e8a1979e4646f18ae6d36da1fd46fe | https://github.com/openlit/openlit/issues/1106 | 来源类型 github_issue 暴露的待验证使用条件。\n\n## 2. 安装坑 · 来源证据：Proposal: gen_ai.agent.threat_detected span event helper for OTel-shaped detection observability\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个安装相关的待验证问题：Proposal: gen_ai.agent.threat_detected span event helper for OTel-shaped detection observability\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源问题仍为 open，Pack Agent 需要复核是否仍影响当前版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_9788255c9fb34a7eae64ba6413a52030 | https://github.com/openlit/openlit/issues/1186 | 来源讨论提到 python 相关条件，需在安装/试用前复核。\n\n## 3. 安装坑 · 来源证据：[Bug]: Docker Image doesn't run on windows 64bit\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个安装相关的待验证问题：[Bug]: Docker Image doesn't run on windows 64bit\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_e25a08120daf4deb81b9193aeab1f929 | https://github.com/openlit/openlit/issues/786 | 来源讨论提到 docker 相关条件，需在安装/试用前复核。\n\n## 4. 安装坑 · 来源证据：openlit-1.19.0\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个安装相关的待验证问题：openlit-1.19.0\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_0504e467960f4bbe919ff101c6a14d7b | https://github.com/openlit/openlit/releases/tag/openlit-1.19.0 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 5. 配置坑 · 来源证据：controller-0.2.0\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个配置相关的待验证问题：controller-0.2.0\n- 对用户的影响：可能影响升级、迁移或版本选择。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_addec19eec37420da207487d5a685eaa | https://github.com/openlit/openlit/releases/tag/controller-0.2.0 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 6. 配置坑 · 来源证据：openlit-1.20.0\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个配置相关的待验证问题：openlit-1.20.0\n- 对用户的影响：可能影响升级、迁移或版本选择。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_217968c917e9426f9f8fbb4b50bebdb5 | https://github.com/openlit/openlit/releases/tag/openlit-1.20.0 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 7. 能力坑 · 能力判断依赖假设\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：README/documentation is current enough for a first validation pass.\n- 对用户的影响：假设不成立时，用户拿不到承诺的能力。\n- 建议检查：将假设转成下游验证清单。\n- 防护动作：假设必须转成验证项；没有验证结果前不能写成事实。\n- 证据：capability.assumptions | github_repo:747319327 | https://github.com/openlit/openlit | README/documentation is current enough for a first validation pass.\n\n## 8. 维护坑 · 维护活跃度未知\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：未记录 last_activity_observed。\n- 对用户的影响：新项目、停更项目和活跃项目会被混在一起，推荐信任度下降。\n- 建议检查：补 GitHub 最近 commit、release、issue/PR 响应信号。\n- 防护动作：维护活跃度未知时，推荐强度不能标为高信任。\n- 证据：evidence.maintainer_signals | github_repo:747319327 | https://github.com/openlit/openlit | last_activity_observed missing\n\n## 9. 安全/权限坑 · 下游验证发现风险项\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：no_demo\n- 对用户的影响：下游已经要求复核，不能在页面中弱化。\n- 建议检查：进入安全/权限治理复核队列。\n- 防护动作：下游风险存在时必须保持 review/recommendation 降级。\n- 证据：downstream_validation.risk_items | github_repo:747319327 | https://github.com/openlit/openlit | no_demo; severity=medium\n\n## 10. 安全/权限坑 · 存在评分风险\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：no_demo\n- 对用户的影响：风险会影响是否适合普通用户安装。\n- 建议检查：把风险写入边界卡，并确认是否需要人工复核。\n- 防护动作：评分风险必须进入边界卡，不能只作为内部分数。\n- 证据：risks.scoring_risks | github_repo:747319327 | https://github.com/openlit/openlit | no_demo; severity=medium\n\n## 11. 安全/权限坑 · 来源证据：Bug: OpenAI API key in operator example test-application is not using OPENAI_API_KEY env var\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个安全/权限相关的待验证问题：Bug: OpenAI API key in operator example test-application is not using OPENAI_API_KEY env var\n- 对用户的影响：可能影响授权、密钥配置或安全边界。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_bfba0945570d4cbbaead1257e8f70dfe | https://github.com/openlit/openlit/issues/1135 | 来源讨论提到 python 相关条件，需在安装/试用前复核。\n\n## 12. 安全/权限坑 · 来源证据：openlit-1.19.1\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个安全/权限相关的待验证问题：openlit-1.19.1\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_b5088506959947828f2d740f9297d5b5 | https://github.com/openlit/openlit/releases/tag/openlit-1.19.1 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 13. 安全/权限坑 · 来源证据：py-1.41.2\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个安全/权限相关的待验证问题：py-1.41.2\n- 对用户的影响：可能影响授权、密钥配置或安全边界。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_ff3f4dfa2dc04616be73482b2145ac5c | https://github.com/openlit/openlit/releases/tag/py-1.41.2 | 来源讨论提到 docker 相关条件，需在安装/试用前复核。\n\n## 14. 维护坑 · issue/PR 响应质量未知\n\n- 严重度：low\n- 证据强度：source_linked\n- 发现：issue_or_pr_quality=unknown。\n- 对用户的影响：用户无法判断遇到问题后是否有人维护。\n- 建议检查：抽样最近 issue/PR，判断是否长期无人处理。\n- 防护动作：issue/PR 响应未知时，必须提示维护风险。\n- 证据：evidence.maintainer_signals | github_repo:747319327 | https://github.com/openlit/openlit | issue_or_pr_quality=unknown\n\n## 15. 维护坑 · 发布节奏不明确\n\n- 严重度：low\n- 证据强度：source_linked\n- 发现：release_recency=unknown。\n- 对用户的影响：安装命令和文档可能落后于代码，用户踩坑概率升高。\n- 建议检查：确认最近 release/tag 和 README 安装命令是否一致。\n- 防护动作：发布节奏未知或过期时，安装说明必须标注可能漂移。\n- 证据：evidence.maintainer_signals | github_repo:747319327 | https://github.com/openlit/openlit | release_recency=unknown\n\n<!-- canonical_name: openlit/openlit; human_manual_source: deepwiki_human_wiki -->\n",
      "markdown_key": "openlit",
      "pages": "draft",
      "source_refs": [
        {
          "evidence_id": "github_repo:747319327",
          "kind": "repo",
          "supports_claim_ids": [
            "claim_identity",
            "claim_distribution",
            "claim_capability"
          ],
          "url": "https://github.com/openlit/openlit"
        },
        {
          "evidence_id": "art_5748a4a0423c40c19b67f0f72e239443",
          "kind": "docs",
          "supports_claim_ids": [
            "claim_identity",
            "claim_distribution",
            "claim_capability"
          ],
          "url": "https://github.com/openlit/openlit#readme"
        }
      ],
      "summary": "DeepWiki/Human Wiki 完整输出，末尾追加 Discovery Agent 踩坑日志。",
      "title": "openlit 说明书",
      "toc": [
        "https://github.com/openlit/openlit 项目说明书",
        "目录",
        "项目概述",
        "1. 项目简介",
        "2. 快速部署",
        "克隆仓库",
        "启动服务",
        "3. SDK 集成",
        "Doramagic 踩坑日志"
      ]
    }
  },
  "quality_gate": {
    "blocking_gaps": [],
    "category_confidence": "medium",
    "compile_status": "ready_for_review",
    "five_assets_present": true,
    "install_sandbox_verified": true,
    "missing_evidence": [],
    "next_action": "publish to Doramagic.ai project surfaces",
    "prompt_preview_boundary_ok": true,
    "publish_status": "publishable",
    "quick_start_verified": true,
    "repo_clone_verified": true,
    "repo_commit": "7ca59852f63177cdfd8f5b40924b6126c7b37fcc",
    "repo_inspection_error": null,
    "repo_inspection_files": [
      "README.md",
      "docker-compose.yml",
      "docs/docs.json",
      "docs/snippets/helm-repo-setup.mdx",
      "docs/snippets/llm-as-a-judge.mdx",
      "docs/snippets/quickstart-gpu.mdx",
      "docs/snippets/integration-methods-python.mdx",
      "docs/snippets/quickstart-programmatic-evals.mdx",
      "docs/snippets/quickstart-mcp.mdx",
      "docs/snippets/quickstart-vectordb.mdx",
      "docs/snippets/quickstart-guard.mdx",
      "docs/snippets/integration-methods.mdx",
      "docs/snippets/quickstart-observability.mdx",
      "docs/snippets/openlit-platform-install.mdx",
      "docs/latest/overview.mdx",
      "docs/snippets/destinations/victoriametrics-stack/conclusion.mdx",
      "docs/snippets/destinations/victoriametrics-stack/intro.mdx",
      "docs/snippets/destinations/victoriametrics-stack/sdk.mdx",
      "docs/snippets/destinations/signoz/conclusion.mdx",
      "docs/snippets/destinations/signoz/intro.mdx",
      "docs/snippets/destinations/signoz/sdk.mdx",
      "docs/snippets/destinations/langfuse/conclusion.mdx",
      "docs/snippets/destinations/langfuse/intro.mdx",
      "docs/snippets/destinations/langfuse/sdk.mdx",
      "docs/snippets/destinations/highlight/conclusion.mdx",
      "docs/snippets/destinations/highlight/intro.mdx",
      "docs/snippets/destinations/highlight/sdk.mdx",
      "docs/snippets/destinations/dynatrace/conclusion.mdx",
      "docs/snippets/destinations/dynatrace/intro.mdx",
      "docs/snippets/destinations/dynatrace/sdk.mdx",
      "docs/snippets/destinations/middleware/conclusion.mdx",
      "docs/snippets/destinations/middleware/intro.mdx",
      "docs/snippets/destinations/middleware/sdk.mdx",
      "docs/snippets/destinations/hyperdx/conclusion.mdx",
      "docs/snippets/destinations/hyperdx/intro.mdx",
      "docs/snippets/destinations/hyperdx/sdk.mdx",
      "docs/snippets/destinations/elastic/conclusion.mdx",
      "docs/snippets/destinations/elastic/intro.mdx",
      "docs/snippets/destinations/elastic/sdk.mdx",
      "docs/snippets/destinations/datadog/conclusion.mdx"
    ],
    "repo_inspection_verified": true,
    "review_reasons": [],
    "tag_count_ok": true,
    "unsupported_claims": []
  },
  "schema_version": "0.1",
  "user_assets": {
    "ai_context_pack": {
      "asset_id": "ai_context_pack",
      "filename": "AI_CONTEXT_PACK.md",
      "markdown": "# openlit - Doramagic AI Context Pack\n\n> 定位：安装前体验与判断资产。它帮助宿主 AI 有一个好的开始，但不代表已经安装、执行或验证目标项目。\n\n## 充分原则\n\n- **充分原则，不是压缩原则**：AI Context Pack 应该充分到让宿主 AI 在开工前理解项目价值、能力边界、使用入口、风险和证据来源；它可以分层组织，但不以最短摘要为目标。\n- **压缩策略**：只压缩噪声和重复内容，不压缩会影响判断和开工质量的上下文。\n\n## 给宿主 AI 的使用方式\n\n你正在读取 Doramagic 为 openlit 编译的 AI Context Pack。请把它当作开工前上下文：帮助用户理解适合谁、能做什么、如何开始、哪些必须安装后验证、风险在哪里。不要声称你已经安装、运行或执行了目标项目。\n\n## Claim 消费规则\n\n- **事实来源**：Repo Evidence + Claim/Evidence Graph；Human Wiki 只提供显著性、术语和叙事结构。\n- **事实最低状态**：`supported`\n- `supported`：可以作为项目事实使用，但回答中必须引用 claim_id 和证据路径。\n- `weak`：只能作为低置信度线索，必须要求用户继续核实。\n- `inferred`：只能用于风险提示或待确认问题，不能包装成项目事实。\n- `unverified`：不得作为事实使用，应明确说证据不足。\n- `contradicted`：必须展示冲突来源，不得替用户强行选择一个版本。\n\n## 它最适合谁\n\n- **正在使用 Claude/Codex/Cursor/Gemini 等宿主 AI 的开发者**：README 或插件配置提到多个宿主 AI。 证据：`README.md` Claim：`clm_0002` supported 0.86\n\n## 它能做什么\n\n- **命令行启动或安装流程**（需要安装后验证）：项目文档中存在可执行命令，真实使用需要在本地或宿主环境中运行这些命令。 证据：`README.md` Claim：`clm_0001` supported 0.86\n\n## 怎么开始\n\n- `git clone git@github.com:openlit/openlit.git` 证据：`README.md` Claim：`clm_0003` supported 0.86\n- `pip install openlit` 证据：`README.md` Claim：`clm_0004` supported 0.86\n\n## 继续前判断卡\n\n- **当前建议**：先做权限沙盒试用\n- **为什么**：项目存在安装命令、宿主配置或本地写入线索，不建议直接进入主力环境，应先在隔离环境试装。\n\n### 30 秒判断\n\n- **现在怎么做**：先做权限沙盒试用\n- **最小安全下一步**：先跑 Prompt Preview；若仍要安装，只在隔离环境试装\n- **先别相信**：工具权限边界不能在安装前相信。\n- **继续会触碰**：命令执行、本地环境或项目文件、宿主 AI 上下文\n\n### 现在可以相信\n\n- **适合人群线索：正在使用 Claude/Codex/Cursor/Gemini 等宿主 AI 的开发者**（supported）：有 supported claim 或项目证据支撑，但仍不等于真实安装效果。 证据：`README.md` Claim：`clm_0002` supported 0.86\n- **能力存在：命令行启动或安装流程**（supported）：可以相信项目包含这类能力线索；是否适合你的具体任务仍要试用或安装后验证。 证据：`README.md` Claim：`clm_0001` supported 0.86\n- **存在 Quick Start / 安装命令线索**（supported）：可以相信项目文档出现过启动或安装入口；不要因此直接在主力环境运行。 证据：`README.md` Claim：`clm_0003` supported 0.86\n\n### 现在还不能相信\n\n- **工具权限边界不能在安装前相信。**（unverified）：MCP/tool 类项目通常会触碰文件、网络、浏览器或外部 API，必须真实检查权限和日志。\n- **真实输出质量不能在安装前相信。**（unverified）：Prompt Preview 只能展示引导方式，不能证明真实项目中的结果质量。\n- **宿主 AI 版本兼容性不能在安装前相信。**（unverified）：Claude、Cursor、Codex、Gemini 等宿主加载规则和版本差异必须在真实环境验证。\n- **不会污染现有宿主 AI 行为，不能直接相信。**（inferred）：Skill、plugin、AGENTS/CLAUDE/GEMINI 指令可能改变宿主 AI 的默认行为。\n- **可安全回滚不能默认相信。**（unverified）：除非项目明确提供卸载和恢复说明，否则必须先在隔离环境验证。\n- **真实安装后是否与用户当前宿主 AI 版本兼容？**（unverified）：兼容性只能通过实际宿主环境验证。\n- **项目输出质量是否满足用户具体任务？**（unverified）：安装前预览只能展示流程和边界，不能替代真实评测。\n- **安装命令是否需要网络、权限或全局写入？**（unverified）：这影响企业环境和个人环境的安装风险。 证据：`README.md`\n\n### 继续会触碰什么\n\n- **命令执行**：包管理器、网络下载、本地插件目录、项目配置或用户主目录。 原因：运行第一条命令就可能产生环境改动；必须先判断是否值得跑。 证据：`README.md`\n- **本地环境或项目文件**：安装结果、插件缓存、项目配置或本地依赖目录。 原因：安装前无法证明写入范围和回滚方式，需要隔离验证。 证据：`README.md`\n- **宿主 AI 上下文**：AI Context Pack、Prompt Preview、Skill 路由、风险规则和项目事实。 原因：导入上下文会影响宿主 AI 后续判断，必须避免把未验证项包装成事实。\n\n### 最小安全下一步\n\n- **先跑 Prompt Preview**：用安装前交互式试用判断工作方式是否匹配，不需要授权或改环境。（适用：任何项目都适用，尤其是输出质量未知时。）\n- **只在隔离目录或测试账号试装**：避免安装命令污染主力宿主 AI、真实项目或用户主目录。（适用：存在命令执行、插件配置或本地写入线索时。）\n- **安装后只验证一个最小任务**：先验证加载、兼容、输出质量和回滚，再决定是否深用。（适用：准备从试用进入真实工作流时。）\n\n### 退出方式\n\n- **保留安装前状态**：记录原始宿主配置和项目状态，后续才能判断是否可恢复。\n- **记录安装命令和写入路径**：没有明确卸载说明时，至少要知道哪些目录或配置需要手动清理。\n- **如果没有回滚路径，不进入主力环境**：不可回滚是继续前阻断项，不应靠信任或运气继续。\n\n## 哪些只能预览\n\n- 解释项目适合谁和能做什么\n- 基于项目文档演示典型对话流程\n- 帮助用户判断是否值得安装或继续研究\n\n## 哪些必须安装后验证\n\n- 真实安装 Skill、插件或 CLI\n- 执行脚本、修改本地文件或访问外部服务\n- 验证真实输出质量、性能和兼容性\n\n## 边界与风险判断卡\n\n- **把安装前预览误认为真实运行**：用户可能高估项目已经完成的配置、权限和兼容性验证。 处理方式：明确区分 prompt_preview_can_do 与 runtime_required。 Claim：`clm_0005` inferred 0.45\n- **命令执行会修改本地环境**：安装命令可能写入用户主目录、宿主插件目录或项目配置。 处理方式：先在隔离环境或测试账号中运行。 证据：`README.md` Claim：`clm_0006` supported 0.86\n- **待确认**：真实安装后是否与用户当前宿主 AI 版本兼容？。原因：兼容性只能通过实际宿主环境验证。\n- **待确认**：项目输出质量是否满足用户具体任务？。原因：安装前预览只能展示流程和边界，不能替代真实评测。\n- **待确认**：安装命令是否需要网络、权限或全局写入？。原因：这影响企业环境和个人环境的安装风险。\n\n## 开工前工作上下文\n\n### 加载顺序\n\n- 先读取 how_to_use.host_ai_instruction，建立安装前判断资产的边界。\n- 读取 claim_graph_summary，确认事实来自 Claim/Evidence Graph，而不是 Human Wiki 叙事。\n- 再读取 intended_users、capabilities 和 quick_start_candidates，判断用户是否匹配。\n- 需要执行具体任务时，优先查 role_skill_index，再查 evidence_index。\n- 遇到真实安装、文件修改、网络访问、性能或兼容性问题时，转入 risk_card 和 boundaries.runtime_required。\n\n### 任务路由\n\n- **命令行启动或安装流程**：先说明这是安装后验证能力，再给出安装前检查清单。 边界：必须真实安装或运行后验证。 证据：`README.md` Claim：`clm_0001` supported 0.86\n\n### 上下文规模\n\n- 文件总数：1727\n- 重要文件覆盖：40/1727\n- 证据索引条目：62\n- 角色 / Skill 条目：17\n\n### 证据不足时的处理\n\n- **missing_evidence**：说明证据不足，要求用户提供目标文件、README 段落或安装后验证记录；不要补全事实。\n- **out_of_scope_request**：说明该任务超出当前 AI Context Pack 证据范围，并建议用户先查看 Human Manual 或真实安装后验证。\n- **runtime_request**：给出安装前检查清单和命令来源，但不要替用户执行命令或声称已执行。\n- **source_conflict**：同时展示冲突来源，标记为待核实，不要强行选择一个版本。\n\n## Prompt Recipes\n\n### 适配判断\n\n- 目标：判断这个项目是否适合用户当前任务。\n- 预期输出：适配结论、关键理由、证据引用、安装前可预览内容、必须安装后验证内容、下一步建议。\n\n```text\n请基于 openlit 的 AI Context Pack，先问我 3 个必要问题，然后判断它是否适合我的任务。回答必须包含：适合谁、能做什么、不能做什么、是否值得安装、证据来自哪里。所有项目事实必须引用 evidence_refs、source_paths 或 claim_id。\n```\n\n### 安装前体验\n\n- 目标：让用户在安装前感受核心工作流，同时避免把预览包装成真实能力或营销承诺。\n- 预期输出：一段带边界标签的体验剧本、安装后验证清单和谨慎建议；不含真实运行承诺或强营销表述。\n\n```text\n请把 openlit 当作安装前体验资产，而不是已安装工具或真实运行环境。\n\n请严格输出四段：\n1. 先问我 3 个必要问题。\n2. 给出一段“体验剧本”：用 [安装前可预览]、[必须安装后验证]、[证据不足] 三种标签展示它可能如何引导工作流。\n3. 给出安装后验证清单：列出哪些能力只有真实安装、真实宿主加载、真实项目运行后才能确认。\n4. 给出谨慎建议：只能说“值得继续研究/试装”“先补充信息后再判断”或“不建议继续”，不得替项目背书。\n\n硬性边界：\n- 不要声称已经安装、运行、执行测试、修改文件或产生真实结果。\n- 不要写“自动适配”“确保通过”“完美适配”“强烈建议安装”等承诺性表达。\n- 如果描述安装后的工作方式，必须使用“如果安装成功且宿主正确加载 Skill，它可能会……”这种条件句。\n- 体验剧本只能写成“示例台词/假设流程”：使用“可能会询问/可能会建议/可能会展示”，不要写“已写入、已生成、已通过、正在运行、正在生成”。\n- Prompt Preview 不负责给安装命令；如用户准备试装，只能提示先阅读 Quick Start 和 Risk Card，并在隔离环境验证。\n- 所有项目事实必须来自 supported claim、evidence_refs 或 source_paths；inferred/unverified 只能作风险或待确认项。\n\n```\n\n### 角色 / Skill 选择\n\n- 目标：从项目里的角色或 Skill 中挑选最匹配的资产。\n- 预期输出：候选角色或 Skill 列表，每项包含适用场景、证据路径、风险边界和是否需要安装后验证。\n\n```text\n请读取 role_skill_index，根据我的目标任务推荐 3-5 个最相关的角色或 Skill。每个推荐都要说明适用场景、可能输出、风险边界和 evidence_refs。\n```\n\n### 风险预检\n\n- 目标：安装或引入前识别环境、权限、规则冲突和质量风险。\n- 预期输出：环境、权限、依赖、许可、宿主冲突、质量风险和未知项的检查清单。\n\n```text\n请基于 risk_card、boundaries 和 quick_start_candidates，给我一份安装前风险预检清单。不要替我执行命令，只说明我应该检查什么、为什么检查、失败会有什么影响。\n```\n\n### 宿主 AI 开工指令\n\n- 目标：把项目上下文转成一次对话开始前的宿主 AI 指令。\n- 预期输出：一段边界明确、证据引用明确、适合复制给宿主 AI 的开工前指令。\n\n```text\n请基于 openlit 的 AI Context Pack，生成一段我可以粘贴给宿主 AI 的开工前指令。这段指令必须遵守 not_runtime=true，不能声称项目已经安装、运行或产生真实结果。\n```\n\n\n## 角色 / Skill 索引\n\n- 共索引 17 个角色 / Skill / 项目文档条目。\n\n- **Observability, Evaluations, Rule Engine, Guardrails, Prompts, Vault, Playground, FleetHub**（project_doc）：Observability, Evaluations, Rule Engine, Guardrails, Prompts, Vault, Playground, FleetHub 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`README.md`\n- **Features**（project_doc）：Documentation https://docs.openlit.io/latest/features/gpu Quickstart -getting-started Metrics -metrics Configuration -configuration 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`opentelemetry-gpu-collector/README.md`\n- **Testing and Developing Locally**（project_doc）：This guide covers the steps needed to set up the development environment for OpenLIT using Docker Compose. The setup is orchestrated by dev-docker-compose.yml and supports two modes: 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`src/README.md`\n- **OpenLIT Kubernetes Example**（project_doc）：A complete local Kubernetes setup with all OpenLIT components and sample LLM apps on a 3-node k3d cluster. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`examples/kubernetes/README.md`\n- **OBI Patches**（project_doc）：This directory contains patch files applied on top of the upstream OBI OpenTelemetry eBPF Instrumentation v0.8.0 during Docker build. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`openlit-controller/patches/README.md`\n- **OpenLIT Go SDK**（project_doc）：OpenTelemetry-native observability SDK for LLM applications in Go. Monitor your AI applications with automatic instrumentation for popular LLM providers. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`sdk/go/README.md`\n- **⚡ Features**（project_doc）：OpenTelemetry-native AI Observability, Evaluation and Guardrails Framework 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`sdk/python/README.md`\n- **⚡ Features**（project_doc）：OpenTelemetry-native AI Observability, Monitoring and Evaluation Framework 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`sdk/typescript/README.md`\n- **Observability, Evaluations, Rule Engine, Guardrails, Prompts, Vault, Playground, FleetHub**（project_doc）：Observability, Evaluations, Rule Engine, Guardrails, Prompts, Vault, Playground, FleetHub 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`src/client/README.md`\n- **Standalone OpAMP Server**（project_doc）：This is a simplified version of the OpenTelemetry OpAMP server that can be used independently. It provides the core functionality of the OpAMP protocol without the UI server component. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`src/opamp-server/README.md`\n- **Contributing to OpenLIT**（project_doc）：We welcome contributions to the OpenLIT project and are grateful for every contribution from bug reports to new features. If you are looking to contribute to the codebase, improve documentation, report issues, or suggest new features, this document is a set of guidelines to help you get started. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`CONTRIBUTING.md`\n- **Change description:**（project_doc）：!IMPORTANT 1. We strictly follow a issue-first approach, please first open an issue https://github.com/openlit/openlit/issues relating to this Pull Request. 2. PR name follows conventional commit format: feat: ... or fix: .... 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`.github/PULL_REQUEST_TEMPLATE.md`\n- **Contributor Covenant Code of Conduct**（project_doc）：Contributor Covenant Code of Conduct 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`CODE_OF_CONDUCT.md`\n- **OpenLIT OpAMP Server Deployment Guide**（project_doc）：OpenLIT OpAMP Server Deployment Guide 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`OPAMP_DEPLOYMENT.md`\n- **Security Policy**（project_doc）：We are committed to maintaining the security of OpenLIT and provide updates to address vulnerabilities. The following table shows which versions of our software currently receive security updates: 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`SECURITY.md`\n- **Changelog**（project_doc）：All notable changes to the OpenLIT Go SDK will be documented in this file. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`sdk/go/CHANGELOG.md`\n- **OpenLIT OpAMP Server - TLS Certificate Management**（project_doc）：OpenLIT OpAMP Server - TLS Certificate Management 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`src/opamp-server/CERTIFICATES.md`\n\n## 证据索引\n\n- 共索引 62 条证据。\n\n- **Observability, Evaluations, Rule Engine, Guardrails, Prompts, Vault, Playground, FleetHub**（documentation）：Observability, Evaluations, Rule Engine, Guardrails, Prompts, Vault, Playground, FleetHub 证据：`README.md`\n- **Features**（documentation）：Documentation https://docs.openlit.io/latest/features/gpu Quickstart -getting-started Metrics -metrics Configuration -configuration 证据：`opentelemetry-gpu-collector/README.md`\n- **Testing and Developing Locally**（documentation）：This guide covers the steps needed to set up the development environment for OpenLIT using Docker Compose. The setup is orchestrated by dev-docker-compose.yml and supports two modes: 证据：`src/README.md`\n- **OpenLIT Kubernetes Example**（documentation）：A complete local Kubernetes setup with all OpenLIT components and sample LLM apps on a 3-node k3d cluster. 证据：`examples/kubernetes/README.md`\n- **OBI Patches**（documentation）：This directory contains patch files applied on top of the upstream OBI OpenTelemetry eBPF Instrumentation v0.8.0 during Docker build. 证据：`openlit-controller/patches/README.md`\n- **OpenLIT Go SDK**（documentation）：OpenTelemetry-native observability SDK for LLM applications in Go. Monitor your AI applications with automatic instrumentation for popular LLM providers. 证据：`sdk/go/README.md`\n- **⚡ Features**（documentation）：OpenTelemetry-native AI Observability, Evaluation and Guardrails Framework 证据：`sdk/python/README.md`\n- **⚡ Features**（documentation）：OpenTelemetry-native AI Observability, Monitoring and Evaluation Framework 证据：`sdk/typescript/README.md`\n- **Observability, Evaluations, Rule Engine, Guardrails, Prompts, Vault, Playground, FleetHub**（documentation）：Observability, Evaluations, Rule Engine, Guardrails, Prompts, Vault, Playground, FleetHub 证据：`src/client/README.md`\n- **Standalone OpAMP Server**（documentation）：This is a simplified version of the OpenTelemetry OpAMP server that can be used independently. It provides the core functionality of the OpAMP protocol without the UI server component. 证据：`src/opamp-server/README.md`\n- **Contributing to OpenLIT**（documentation）：We welcome contributions to the OpenLIT project and are grateful for every contribution from bug reports to new features. If you are looking to contribute to the codebase, improve documentation, report issues, or suggest new features, this document is a set of guidelines to help you get started. 证据：`CONTRIBUTING.md`\n- **Package**（package_manifest）：{ \"name\": \"openlit\", \"version\": \"1.13.0\", \"homepage\": \"https://github.com/openlit/openlit readme\", \"bugs\": { \"url\": \"https://github.com/openlit/openlit/issues\", \"email\": \"developer@openlit.io\" }, \"repository\": { \"type\": \"git\", \"url\": \"https://github.com/openlit/openlit\" }, \"scripts\": { \"build\": \"tsc --build\", \"lint\": \"eslint src/\", \"test\": \"jest\" }, \"files\": \"dist\", \"README.md\", \"LICENSE\", \"package.json\" , \"description\": \"OpenTelemetry-native Auto instrumentation library for monitoring LLM Applications, facilitating the integration of observability into your GenAI-driven projects\", \"main\": \"dist/index.js\", \"types\": \"dist/index.d.ts\", \"keywords\": \"OpenTelemetry\", \"otel\", \"otlp\", \"llm\", \"trac… 证据：`sdk/typescript/package.json`\n- **Package**（package_manifest）：{ \"name\": \"openlit\", \"version\": \"1.20.0\", \"private\": true, \"scripts\": { \"dev\": \"next dev\", \"build\": \"next build\", \"start\": \"next start\", \"lint\": \"next lint\", \"seed\": \"npx prisma db seed\", \"test\": \"jest\", \"test:watch\": \"jest --watch\", \"test:coverage\": \"jest --coverage\" }, \"dependencies\": { \"@ai-sdk/anthropic\": \"^3.0.6\", \"@ai-sdk/cohere\": \"^3.0.3\", \"@ai-sdk/google\": \"^3.0.3\", \"@ai-sdk/mistral\": \"^3.0.4\", \"@ai-sdk/openai\": \"^3.0.4\", \"@anthropic-ai/sdk\": \"^0.21.1\", \"@clickhouse/client\": \"^1.1.0\", \"@dhmk/zustand-lens\": \"^4.0.0\", \"@kubernetes/client-node\": \"^1.4.0\", \"@mistralai/mistralai\": \"^0.4.0\", \"@monaco-editor/react\": \"^4.7.0\", \"@next-auth/prisma-adapter\": \"^1.0.7\", \"@prisma/client\": \"^5.15.… 证据：`src/client/package.json`\n- **License**（source_file）：Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ 证据：`LICENSE`\n- **License**（source_file）：Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ 证据：`sdk/python/LICENSE`\n- **License**（source_file）：Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ 证据：`sdk/typescript/LICENSE`\n- **Change description:**（documentation）：!IMPORTANT 1. We strictly follow a issue-first approach, please first open an issue https://github.com/openlit/openlit/issues relating to this Pull Request. 2. PR name follows conventional commit format: feat: ... or fix: .... 证据：`.github/PULL_REQUEST_TEMPLATE.md`\n- **Contributor Covenant Code of Conduct**（documentation）：Contributor Covenant Code of Conduct 证据：`CODE_OF_CONDUCT.md`\n- **OpenLIT OpAMP Server Deployment Guide**（documentation）：OpenLIT OpAMP Server Deployment Guide 证据：`OPAMP_DEPLOYMENT.md`\n- **Security Policy**（documentation）：We are committed to maintaining the security of OpenLIT and provide updates to address vulnerabilities. The following table shows which versions of our software currently receive security updates: 证据：`SECURITY.md`\n- **Changelog**（documentation）：All notable changes to the OpenLIT Go SDK will be documented in this file. 证据：`sdk/go/CHANGELOG.md`\n- **OpenLIT OpAMP Server - TLS Certificate Management**（documentation）：OpenLIT OpAMP Server - TLS Certificate Management 证据：`src/opamp-server/CERTIFICATES.md`\n- **Pricing**（structured_config）：{ \"embeddings\": { \"text-embedding-ada-002\": 0.0001, \"text-embedding-3-small\": 0.00002, \"text-embedding-3-large\": 0.00013, \"ada\": 0.0001, \"ada-v2\": 0.00010, \"text-ada-001\": 0.0001, \"azure text-embedding-ada-002\": 0.0001, \"azure text-embedding-3-small\": 0.00002, \"azure text-embedding-3-large\": 0.00013, \"azure ada\": 0.0001, \"azure ada-v2\": 0.00010, \"azure text-ada-001\": 0.0001, \"embed-english-v3.0\": 0.0001, \"embed-multilingual-v3.0\": 0.0001, \"embed-english-light-v3.0\": 0.0001, \"embed-multilingual-light-v3.0\": 0.0001, \"embed-english-v2.0\": 0.0001, \"embed-english-light-v2.0\": 0.0001, \"embed-multilingual-v2.0\": 0.0001, \"mistral-embed\": 0.0001, \"amazon.titan-embed-text-v1\": 0.0001, \"amazon.titan-e… 证据：`assets/pricing.json`\n- **Signoz Gpu Dashboard**（structured_config）：{ \"description\": \"This dashboard displays the GPU performance metrics like Utilization, Temperature, Power Consumption, Memory and more using the OpenTelemetry Metrics generated using OpenLIT SDK https://github.com/openlit/openlit or the OTel GPU Collector https://github.com/openlit/openlit/tree/main/otel-gpu-collector .\\n\", \"image\": \"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHZpZXdCb3g9IjAgMCAxOCAxOCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTE0Ljk0OTQgMTMuOTQyQzE2LjIzMTggMTIuNDI1OCAxNy4zMjY4IDkuNzAyMiAxNi4xOTU2IDYuNTc0ODdDMTUuNjQ0MyA1LjA1MjQ1IDE1LjAyMTkgNC4yMDI0OSAxNC4yOTY5IDMuNjYyNTJDMTMuODU1NyAzLjMzMzc5IDEyLjA5MzMgMi41MDYzMyA5Ljc1… 证据：`assets/signoz-gpu-dashboard.json`\n- **Signoz Openlit**（structured_config）：{ \"description\": \"This dashboard displays the usage of LLMs and VectorDBs, tracking OpenTelemetry Traces and Metrics sent using OpenLIT https://github.com/openlit/openlit .\", \"layout\": { \"h\": 2, \"i\": \"25009fee-69ae-46e0-9f7b-5570f56c66c0\", \"moved\": false, \"static\": false, \"w\": 4, \"x\": 0, \"y\": 0 }, { \"h\": 2, \"i\": \"7ba9f26e-5c17-4dcf-89c5-c81a6ce67330\", \"moved\": false, \"static\": false, \"w\": 4, \"x\": 4, \"y\": 0 }, { \"h\": 2, \"i\": \"1794131c-c3bd-44b9-abf8-bac0d6909900\", \"moved\": false, \"static\": false, \"w\": 4, \"x\": 8, \"y\": 0 }, { \"h\": 2, \"i\": \"be5be8ce-c6fb-4b99-b62b-58030ea09f67\", \"moved\": false, \"static\": false, \"w\": 8, \"x\": 0, \"y\": 2 }, { \"h\": 4, \"i\": \"38e3d7fa-db21-4900-9219-8e29ef624db5\", \"mo… 证据：`assets/signoz-openlit.json`\n- **Docs**（structured_config）：{ \"$schema\": \"https://mintlify.com/docs.json\", \"theme\": \"aspen\", \"name\": \"OpenLIT\", \"description\": \"OpenLIT is the leading open-source AI observability platform with zero-code instrumentation for LLMs, vector databases, and AI frameworks. Monitor OpenAI, Anthropic, LangChain, LlamaIndex with OpenTelemetry. Features include cost tracking, performance metrics, prompt management, and enterprise-grade security for production AI applications.\", \"colors\": { \"primary\": \" FFA500\", \"light\": \" FFA500\", \"dark\": \" FFA500\" }, \"favicon\": \"favicon.png\", \"feedback\": { \"thumbsRating\": true, \"suggestEdit\": true }, \"navigation\": { \"global\": { \"anchors\": { \"anchor\": \"GitHub\", \"href\": \"https://github.com/openli… 证据：`docs/docs.json`\n- **.Prettierrc**（structured_config）：{ \"printWidth\": 100, \"tabWidth\": 2, \"singleQuote\": true, \"jsxBracketSameLine\": true, \"trailingComma\": \"es5\" } 证据：`sdk/typescript/.prettierrc.json`\n- **Tsconfig**（structured_config）：{ \"compilerOptions\": { \"target\": \"ES2020\", \"resolveJsonModule\": true, \"module\": \"CommonJS\", \"outDir\": \"./dist\", \"strict\": true, \"esModuleInterop\": true, \"declaration\": true, \"skipLibCheck\": true, \"sourceMap\": true, \"forceConsistentCasingInFileNames\": true, \"baseUrl\": \"./src\", \"rootDir\": \"./src\", }, \"include\": \"src/ / \" , \"exclude\": \"node modules\", \" / .spec.ts\" } 证据：`sdk/typescript/tsconfig.json`\n- **.Eslintrc**（structured_config）：{ \"extends\": \"next/core-web-vitals\", \"rules\": { \"react-hooks/exhaustive-deps\": \"off\" } } 证据：`src/client/.eslintrc.json`\n- **Components**（structured_config）：{ \"$schema\": \"https://ui.shadcn.com/schema.json\", \"style\": \"default\", \"rsc\": true, \"tsx\": true, \"tailwind\": { \"config\": \"tailwind.config.ts\", \"css\": \"src/app/globals.css\", \"baseColor\": \"stone\", \"cssVariables\": false, \"prefix\": \"\" }, \"aliases\": { \"components\": \"@/components\", \"utils\": \"@/lib/utils\" } } 证据：`src/client/components.json`\n- **Openlit Dashboard Gpu Dashboard Layout**（structured_config）：{ \"id\": \"70072a30-a88c-4eb5-8058-a5dca6536b8d\", \"title\": \"GPU dashboard\", \"description\": \"The dashboard helps detect GPU performance bottlenecks, thermal or power inefficiencies, and optimize resource utilization across your infrastructure.\", \"parentId\": null, \"isMainDashboard\": false, \"isPinned\": true, \"createdAt\": \"2025-06-27 05:46:43\", \"updatedAt\": \"2025-06-27 05:46:43\", \"widgets\": { \"953b08e7-5158-4806-b52e-8b58880b0cfd\": { \"id\": \"953b08e7-5158-4806-b52e-8b58880b0cfd\", \"title\": \"Power Watt \", \"description\": \"Visualization to identify the Power over time\", \"type\": \"AREA CHART\", \"properties\": { \"xAxis\": \"request time\", \"yAxes\": { \"key\": \"power draw\", \"color\": \" F36C06\" }, { \"key\": \"power… 证据：`src/client/src/clickhouse/seed-data/openlit-dashboard-GPU-dashboard-layout.json`\n- **Openlit Dashboard Llm Dashboard Layout**（structured_config）：{ \"id\": \"f36c60be-5133-4727-b6f8-8999f0692943\", \"title\": \"LLM dashboard\", \"description\": \"The LLM dashboard helps monitor usage patterns, detect anomalies, and optimize performance and cost across large language model workloads.\", \"parentId\": null, \"isMainDashboard\": true, \"isPinned\": false, \"createdAt\": \"2025-06-16 07:39:17\", \"updatedAt\": \"2025-06-16 07:39:17\", \"widgets\": { \"3a680898-76da-4932-9499-ac8f13b0324d\": { \"id\": \"3a680898-76da-4932-9499-ac8f13b0324d\", \"title\": \"Total hallucination detected\", \"description\": \"This defines the total hallucination detected all in all for requests for the time period selected\", \"type\": \"STAT CARD\", \"properties\": { \"value\": \"0.total evaluation detected\"… 证据：`src/client/src/clickhouse/seed-data/openlit-dashboard-LLM-dashboard-layout.json`\n- **Openlit Dashboard Vector Db Layout**（structured_config）：{ \"id\": \"4b153228-45fb-46d9-88c9-5a2aa3674251\", \"title\": \"Vector DB\", \"description\": \"The vector DB dashboard helps track query performance, memory usage, and index efficiency to optimize similarity search and ensure reliable vector database operations.\", \"parentId\": null, \"isMainDashboard\": false, \"isPinned\": true, \"createdAt\": \"2025-06-25 08:41:39\", \"updatedAt\": \"2025-06-25 08:41:39\", \"widgets\": { \"af3786ef-5dd8-4b6c-929b-99005b27a784\": { \"id\": \"af3786ef-5dd8-4b6c-929b-99005b27a784\", \"title\": \"Generation by environment\", \"description\": \"This defines total number of request grouped by environment name\", \"type\": \"PIE CHART\", \"properties\": { \"labelPath\": \"environment\", \"valuePath\": \"count\",… 证据：`src/client/src/clickhouse/seed-data/openlit-dashboard-Vector-DB-layout.json`\n- **Tsconfig**（structured_config）：{ \"compilerOptions\": { \"target\": \"es5\", \"lib\": \"dom\", \"dom.iterable\", \"esnext\" , \"allowJs\": true, \"skipLibCheck\": true, \"strict\": true, \"noEmit\": true, \"esModuleInterop\": true, \"module\": \"esnext\", \"moduleResolution\": \"bundler\", \"resolveJsonModule\": true, \"isolatedModules\": true, \"jsx\": \"preserve\", \"incremental\": true, \"plugins\": { \"name\": \"next\" } , \"paths\": { \"@/ \": \"./src/ \" , \"@/lib/ \": \"./src/lib/ \" , \"@/components/ \": \"./src/components/ \" , \"@/components/ui/ \": \"./src/components/ui/ \" , \"@/prisma/ \": \"./prisma/ \" , \"@/utils/ \": \"./src/utils/ \" , \"@/constants/ \": \"./src/constants/ \" , \"@/store/ \": \"./src/store/ \" , \"@/helpers/ \": \"./src/helpers/ \" , \"@/selectors/ \": \"./src/selectors/ \"… 证据：`src/client/tsconfig.json`\n- **These are supported funding model platforms**（source_file）：These are supported funding model platforms 证据：`.github/FUNDING.yml`\n- **Dependabot**（source_file）：version: 2 updates: - package-ecosystem: \"github-actions\" directory: \"/\" schedule: interval: \"weekly\" - package-ecosystem: \"npm\" directory: \"/src/client/\" schedule: interval: \"weekly\" - package-ecosystem: \"pip\" directory: \"/sdk/python\" schedule: interval: \"weekly\" - package-ecosystem: \"pip\" directory: \"/sdk/python/tests/\" schedule: interval: \"weekly\" 证据：`.github/dependabot.yml`\n- **Labeler**（source_file）：python-sdk: - changed-files: - any-glob-to-any-file: 'sdk/python/ ' 证据：`.github/labeler.yml`\n- **.gitignore**（source_file）：node modules test.py .DS Store yala.py yala.yml speech.mp3 venv/ path/ pycache / bun.lockb logs/ .env .vscode/ .idea/ .cursor-rules/ .cursorrules .pem certs/index.txt .csr sdk/typescript-test/ 证据：`.gitignore`\n- **.gitmodules**（source_file）：submodule \"openlit-controller/.obi-src\" path = openlit-controller/.obi-src url = https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation.git branch = main 证据：`.gitmodules`\n- **.Vale**（source_file）：formats mdx = md 证据：`.vale.ini`\n- **Default owners for everything in the repo, unless a later match takes precedence.**（source_file）：Default owners for everything in the repo, unless a later match takes precedence. @openlit/litters 证据：`CODEOWNERS`\n- **.Openlit.Env**（source_file）：export INIT DB HOST=\"127.0.0.1\" export INIT DB PORT=\"9000\" export INIT DB DATABASE=\" \" export INIT DB USERNAME=\" \" export INIT DB PASSWORD=\" \" export SQLITE DATABASE URL=\"file:/app/client/data/data.db\" 证据：`assets/.openlit.env.example`\n- **Clickhouse Config**（source_file）：warning true 6 120000 604800 warning 604800 120000 1000 60000 604800 warning 60000 120000 604800 60000 120000 604800 warning 120000 604800 120000 604800 证据：`assets/clickhouse-config.xml`\n- **!/bin/bash**（source_file）：echo \"==================== ClickHouse Initialization ====================\" 证据：`assets/clickhouse-init.sh`\n- **80% of maximum memory up to 2G**（source_file）：receivers: otlp: protocols: grpc: endpoint: 0.0.0.0:4317 http: endpoint: 0.0.0.0:4318 证据：`assets/otel-collector-config.yaml`\n- **Supervisor Dynamic**（source_file）：server: endpoint: wss://localhost:4320/v1/opamp 证据：`assets/supervisor-dynamic.yaml`\n- **The endpoint of the OpAMP server**（source_file）：server: The endpoint of the OpAMP server endpoint: wss://your-openlit-server:4320/v1/opamp tls: Production configuration with proper certificate verification insecure skip verify: false 证据：`assets/supervisor-production.yaml`\n- **The endpoint of the OpAMP server**（source_file）：server: The endpoint of the OpAMP server endpoint: wss://0.0.0.0:4320/v1/opamp tls: For development: set to true to skip certificate verification For production: set to false and provide ca file insecure skip verify: true 证据：`assets/supervisor.yaml`\n- **OAuth Environment Variables**（source_file）：services: clickhouse: image: clickhouse/clickhouse-server:24.4.1 container name: clickhouse environment: CLICKHOUSE PASSWORD: ${OPENLIT DB PASSWORD:-OPENLIT} CLICKHOUSE USER: ${OPENLIT DB USER:-default} CLICKHOUSE DATABASE: ${OPENLIT DB NAME:-openlit} CLICKHOUSE ALWAYS RUN INITDB SCRIPTS: true volumes: - clickhouse-data:/var/lib/clickhouse - ./assets/clickhouse-config.xml:/etc/clickhouse-server/config.d/custom-config.xml:ro - ./assets/clickhouse-init.sh:/docker-entrypoint-initdb.d/init.sh:ro ports: - \"9000:9000\" - \"8123:8123\" healthcheck: test: \"CMD-SHELL\", \"clickhouse-client --user=$${CLICKHOUSE USER} --password=$${CLICKHOUSE PASSWORD} --query='SELECT 1' exit 1\" interval: 5s timeout: 3s re… 证据：`docker-compose.yml`\n- **OpenLIT Environment Configuration**（source_file）：OpenLIT Environment Configuration Copy this file to .env and customize the values for your deployment 证据：`env.example`\n- **libbpf headers copied by make setup-bpf-headers vmlinux.h is committed**（source_file）：openlit-controller .obi-src/ .tar.gz dist/ 证据：`openlit-controller/.gitignore`\n- **--- Build OBI from source with multi-provider GenAI support ---**（source_file）：--- Build OBI from source with multi-provider GenAI support --- FROM ghcr.io/open-telemetry/obi-generator:0.2.11 AS obi-builder 证据：`openlit-controller/Dockerfile`\n- **Copy libbpf headers needed for BPF compilation.**（source_file）：VERSION ?= $ shell git describe --tags --always --dirty 2 /dev/null echo dev LDFLAGS := -ldflags \"-X github.com/openlit/openlit/openlit-controller/internal/server.Version=$ VERSION \" SCANNER DIR := ./internal/scanner 证据：`openlit-controller/Makefile`\n- **Go**（source_file）：module github.com/openlit/openlit/openlit-controller 证据：`openlit-controller/go.mod`\n- **Binary**（source_file）：Generated eBPF Go bindings output of go generate / bpf2go internal/ebpf/gpuevent bpfel .go internal/ebpf/gpuevent bpfel .o 证据：`opentelemetry-gpu-collector/.gitignore`\n- **Stage 1: Build the eBPF programs and Go binary**（source_file）：Stage 1: Build the eBPF programs and Go binary FROM golang:1.25-bookworm AS builder 证据：`opentelemetry-gpu-collector/Dockerfile`\n- **Makefile**（source_file）：.PHONY: all build generate setup-bpf test lint clean docker 证据：`opentelemetry-gpu-collector/Makefile`\n- **Go**（source_file）：module github.com/openlit/openlit/opentelemetry-gpu-collector 证据：`opentelemetry-gpu-collector/go.mod`\n- **Git**（source_file）：Node modules will be installed in container client/node modules client/.next client/.env .local 证据：`src/.dockerignore`\n- **Node.js builder - pinned to alpine 3.21 with digest**（source_file）：Node.js builder - pinned to alpine 3.21 with digest FROM alpine:3.21@sha256:c3f8e73fdb79deaebaa2037150150191b9dcbfba68b4a46d70103204c53f4709 AS builder 证据：`src/Dockerfile`\n- 其余 2 条证据见 `AI_CONTEXT_PACK.json` 或 `EVIDENCE_INDEX.json`。\n\n## 宿主 AI 必须遵守的规则\n\n- **把本资产当作开工前上下文，而不是运行环境。**：AI Context Pack 只包含证据化项目理解，不包含目标项目的可执行状态。 证据：`README.md`, `opentelemetry-gpu-collector/README.md`, `src/README.md`\n- **回答用户时区分可预览内容与必须安装后才能验证的内容。**：安装前体验的消费者价值来自降低误装和误判，而不是伪装成真实运行。 证据：`README.md`, `opentelemetry-gpu-collector/README.md`, `src/README.md`\n\n## 用户开工前应该回答的问题\n\n- 你准备在哪个宿主 AI 或本地环境中使用它？\n- 你只是想先体验工作流，还是准备真实安装？\n- 你最在意的是安装成本、输出质量、还是和现有规则的冲突？\n\n## 验收标准\n\n- 所有能力声明都能回指到 evidence_refs 中的文件路径。\n- AI_CONTEXT_PACK.md 没有把预览包装成真实运行。\n- 用户能在 3 分钟内看懂适合谁、能做什么、如何开始和风险边界。\n\n---\n\n## Doramagic Context Augmentation\n\n下面内容用于强化 Repomix/AI Context Pack 主体。Human Manual 只提供阅读骨架；踩坑日志会被转成宿主 AI 必须遵守的工作约束。\n\n## Human Manual 骨架\n\n使用规则：这里只是项目阅读路线和显著性信号，不是事实权威。具体事实仍必须回到 repo evidence / Claim Graph。\n\n宿主 AI 硬性规则：\n- 不得把页标题、章节顺序、摘要或 importance 当作项目事实证据。\n- 解释 Human Manual 骨架时，必须明确说它只是阅读路线/显著性信号。\n- 能力、安装、兼容性、运行状态和风险判断必须引用 repo evidence、source path 或 Claim Graph。\n\n- **项目概述**：importance `high`\n  - source_paths: README.md, docker-compose.yml\n- **系统架构**：importance `high`\n  - source_paths: docker-compose.yml, src/dev-docker-compose.yml, src/client/prisma/schema.prisma\n- **Python SDK**：importance `high`\n  - source_paths: sdk/python/src/openlit/__init__.py, sdk/python/src/openlit/_instrumentors.py, sdk/python/pyproject.toml\n- **TypeScript SDK**：importance `medium`\n  - source_paths: sdk/typescript/src/index.ts, sdk/typescript/package.json, sdk/typescript/src/instrumentation/openai/wrapper.ts\n- **Go SDK**：importance `medium`\n  - source_paths: sdk/go/openlit.go, sdk/go/config.go, sdk/go/instrumentation/openai/instrumentor.go, sdk/go/go.mod\n- **可观测性功能**：importance `high`\n  - source_paths: sdk/python/src/openlit/otel/tracing.py, sdk/python/src/openlit/otel/metrics.py, sdk/python/src/openlit/otel/events.py\n- **评估功能**：importance `high`\n  - source_paths: sdk/python/src/openlit/guard/_base.py, sdk/python/src/openlit/guard/schema.py, src/client/src/lib/platform/evaluation/run-evaluation.ts\n- **Guardrails与规则引擎**：importance `medium`\n  - source_paths: sdk/python/src/openlit/guard/pii.py, sdk/python/src/openlit/guard/prompt_injection.py, sdk/python/src/openlit/guard/sensitive_topic.py, src/client/src/lib/platform/rule-engine/evaluate.ts\n\n## Repo Inspection Evidence / 源码检查证据\n\n- repo_clone_verified: true\n- repo_inspection_verified: true\n- repo_commit: `7ca59852f63177cdfd8f5b40924b6126c7b37fcc`\n- inspected_files: `README.md`, `docker-compose.yml`, `docs/docs.json`, `docs/snippets/helm-repo-setup.mdx`, `docs/snippets/llm-as-a-judge.mdx`, `docs/snippets/quickstart-gpu.mdx`, `docs/snippets/integration-methods-python.mdx`, `docs/snippets/quickstart-programmatic-evals.mdx`, `docs/snippets/quickstart-mcp.mdx`, `docs/snippets/quickstart-vectordb.mdx`, `docs/snippets/quickstart-guard.mdx`, `docs/snippets/integration-methods.mdx`, `docs/snippets/quickstart-observability.mdx`, `docs/snippets/openlit-platform-install.mdx`, `docs/latest/overview.mdx`, `docs/snippets/destinations/victoriametrics-stack/conclusion.mdx`, `docs/snippets/destinations/victoriametrics-stack/intro.mdx`, `docs/snippets/destinations/victoriametrics-stack/sdk.mdx`, `docs/snippets/destinations/signoz/conclusion.mdx`, `docs/snippets/destinations/signoz/intro.mdx`\n\n宿主 AI 硬性规则：\n- 没有 repo_clone_verified=true 时，不得声称已经读过源码。\n- 没有 repo_inspection_verified=true 时，不得把 README/docs/package 文件判断写成事实。\n- 没有 quick_start_verified=true 时，不得声称 Quick Start 已跑通。\n\n## Doramagic Pitfall Constraints / 踩坑约束\n\n这些规则来自 Doramagic 发现、验证或编译过程中的项目专属坑点。宿主 AI 必须把它们当作工作约束，而不是普通说明文字。\n\n### Constraint 1: 来源证据：Integration: Governance and compliance signals for LLM observability\n\n- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：Integration: Governance and compliance signals for LLM observability\n- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- Why it matters: 可能增加新用户试用和生产接入成本。\n- Evidence: community_evidence:github | cevd_16e8a1979e4646f18ae6d36da1fd46fe | https://github.com/openlit/openlit/issues/1106 | 来源类型 github_issue 暴露的待验证使用条件。\n- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。\n\n### Constraint 2: 来源证据：Proposal: gen_ai.agent.threat_detected span event helper for OTel-shaped detection observability\n\n- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：Proposal: gen_ai.agent.threat_detected span event helper for OTel-shaped detection observability\n- Host AI rule: 来源问题仍为 open，Pack Agent 需要复核是否仍影响当前版本。\n- Why it matters: 可能增加新用户试用和生产接入成本。\n- Evidence: community_evidence:github | cevd_9788255c9fb34a7eae64ba6413a52030 | https://github.com/openlit/openlit/issues/1186 | 来源讨论提到 python 相关条件，需在安装/试用前复核。\n- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。\n\n### Constraint 3: 来源证据：[Bug]: Docker Image doesn't run on windows 64bit\n\n- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：[Bug]: Docker Image doesn't run on windows 64bit\n- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- Why it matters: 可能增加新用户试用和生产接入成本。\n- Evidence: community_evidence:github | cevd_e25a08120daf4deb81b9193aeab1f929 | https://github.com/openlit/openlit/issues/786 | 来源讨论提到 docker 相关条件，需在安装/试用前复核。\n- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。\n\n### Constraint 4: 来源证据：openlit-1.19.0\n\n- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：openlit-1.19.0\n- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- Why it matters: 可能增加新用户试用和生产接入成本。\n- Evidence: community_evidence:github | cevd_0504e467960f4bbe919ff101c6a14d7b | https://github.com/openlit/openlit/releases/tag/openlit-1.19.0 | 来源类型 github_release 暴露的待验证使用条件。\n- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。\n\n### Constraint 5: 来源证据：controller-0.2.0\n\n- Trigger: GitHub 社区证据显示该项目存在一个配置相关的待验证问题：controller-0.2.0\n- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- Why it matters: 可能影响升级、迁移或版本选择。\n- Evidence: community_evidence:github | cevd_addec19eec37420da207487d5a685eaa | https://github.com/openlit/openlit/releases/tag/controller-0.2.0 | 来源类型 github_release 暴露的待验证使用条件。\n- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。\n\n### Constraint 6: 来源证据：openlit-1.20.0\n\n- Trigger: GitHub 社区证据显示该项目存在一个配置相关的待验证问题：openlit-1.20.0\n- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- Why it matters: 可能影响升级、迁移或版本选择。\n- Evidence: community_evidence:github | cevd_217968c917e9426f9f8fbb4b50bebdb5 | https://github.com/openlit/openlit/releases/tag/openlit-1.20.0 | 来源类型 github_release 暴露的待验证使用条件。\n- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。\n\n### Constraint 7: 能力判断依赖假设\n\n- Trigger: README/documentation is current enough for a first validation pass.\n- Host AI rule: 将假设转成下游验证清单。\n- Why it matters: 假设不成立时，用户拿不到承诺的能力。\n- Evidence: capability.assumptions | github_repo:747319327 | https://github.com/openlit/openlit | README/documentation is current enough for a first validation pass.\n- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。\n\n### Constraint 8: 维护活跃度未知\n\n- Trigger: 未记录 last_activity_observed。\n- Host AI rule: 补 GitHub 最近 commit、release、issue/PR 响应信号。\n- Why it matters: 新项目、停更项目和活跃项目会被混在一起，推荐信任度下降。\n- Evidence: evidence.maintainer_signals | github_repo:747319327 | https://github.com/openlit/openlit | last_activity_observed missing\n- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。\n\n### Constraint 9: 下游验证发现风险项\n\n- Trigger: no_demo\n- Host AI rule: 进入安全/权限治理复核队列。\n- Why it matters: 下游已经要求复核，不能在页面中弱化。\n- Evidence: downstream_validation.risk_items | github_repo:747319327 | https://github.com/openlit/openlit | no_demo; severity=medium\n- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。\n\n### Constraint 10: 存在评分风险\n\n- Trigger: no_demo\n- Host AI rule: 把风险写入边界卡，并确认是否需要人工复核。\n- Why it matters: 风险会影响是否适合普通用户安装。\n- Evidence: risks.scoring_risks | github_repo:747319327 | https://github.com/openlit/openlit | no_demo; severity=medium\n- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。\n",
      "summary": "给宿主 AI 的上下文和工作边界。",
      "title": "AI Context Pack / 带给我的 AI"
    },
    "boundary_risk_card": {
      "asset_id": "boundary_risk_card",
      "filename": "BOUNDARY_RISK_CARD.md",
      "markdown": "# Boundary & Risk Card / 安装前决策卡\n\n项目：openlit/openlit\n\n## Doramagic 试用结论\n\n当前结论：可以进入发布前推荐检查；首次使用仍应从最小权限、临时目录和可回滚配置开始。\n\n## 用户现在可以做\n\n- 可以先阅读 Human Manual，理解项目目的和主要工作流。\n- 可以复制 Prompt Preview 做安装前体验；这只验证交互感，不代表真实运行。\n- 可以把官方 Quick Start 命令放到隔离环境中验证，不要直接进主力环境。\n\n## 现在不要做\n\n- 不要把 Prompt Preview 当成项目实际运行结果。\n- 不要把 metadata-only validation 当成沙箱安装验证。\n- 不要把未验证能力写成“已支持、已跑通、可放心安装”。\n- 不要在首次试用时交出生产数据、私人文件、真实密钥或主力配置目录。\n\n## 安装前检查\n\n- 宿主 AI 是否匹配：local_cli\n- 官方安装入口状态：已发现官方入口\n- 是否在临时目录、临时宿主或容器中验证：必须是\n- 是否能回滚配置改动：必须能\n- 是否需要 API Key、网络访问、读写文件或修改宿主配置：未确认前按高风险处理\n- 是否记录了安装命令、实际输出和失败日志：必须记录\n\n## 当前阻塞项\n\n- 无阻塞项。\n\n## 项目专属踩坑\n\n- 来源证据：Integration: Governance and compliance signals for LLM observability（medium）：可能增加新用户试用和生产接入成本。 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 来源证据：Proposal: gen_ai.agent.threat_detected span event helper for OTel-shaped detection observability（medium）：可能增加新用户试用和生产接入成本。 建议检查：来源问题仍为 open，Pack Agent 需要复核是否仍影响当前版本。\n- 来源证据：[Bug]: Docker Image doesn't run on windows 64bit（medium）：可能增加新用户试用和生产接入成本。 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 来源证据：openlit-1.19.0（medium）：可能增加新用户试用和生产接入成本。 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 来源证据：controller-0.2.0（medium）：可能影响升级、迁移或版本选择。 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n\n## 风险与权限提示\n\n- no_demo: medium\n\n## 证据缺口\n\n- 暂未发现结构化证据缺口。\n",
      "summary": "安装、权限、验证和推荐前风险。",
      "title": "Boundary & Risk Card / 边界与风险卡"
    },
    "human_manual": {
      "asset_id": "human_manual",
      "filename": "HUMAN_MANUAL.md",
      "markdown": "# https://github.com/openlit/openlit 项目说明书\n\n生成时间：2026-05-16 21:10:55 UTC\n\n## 目录\n\n- [项目概述](#project-overview)\n- [系统架构](#system-architecture)\n- [Python SDK](#python-sdk)\n- [TypeScript SDK](#typescript-sdk)\n- [Go SDK](#go-sdk)\n- [可观测性功能](#observability)\n- [评估功能](#evaluations)\n- [Guardrails与规则引擎](#guardrails)\n- [OpenLIT Controller](#controller)\n- [GPU Collector](#gpu-collector)\n\n<a id='project-overview'></a>\n\n## 项目概述\n\n### 相关页面\n\n相关主题：[系统架构](#system-architecture), [Python SDK](#python-sdk)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [src/client/src/app/(playground)/getting-started/page.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/app/(playground)/getting-started/page.tsx)\n- [src/client/src/components/(playground)/getting-started/tracing/index.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/components/(playground)/getting-started/tracing/index.tsx)\n- [src/client/src/components/(playground)/openground/sdk-usage-dialog.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/components/(playground)/openground/sdk-usage-dialog.tsx)\n- [src/client/src/app/(playground)/evaluations/types/new/page.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/app/(playground)/evaluations/types/new/page.tsx)\n- [src/client/src/components/(playground)/agents/version-drawer.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/components/(playground)/agents/version-drawer.tsx)\n- [src/client/src/app/(playground)/context/page.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/app/(playground)/context/page.tsx)\n- [src/client/src/components/(auth)/auth-form.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/components/(auth)/auth-form.tsx)\n- [src/client/src/app/(playground)/pricing/page.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/app/(playground)/pricing/page.tsx)\n</details>\n\n# 项目概述\n\n## 1. 项目简介\n\nOpenLIT 是一个基于 OpenTelemetry 原生设计的 **GenAI 和 LLM 应用程序可观测性工具**。它旨在简化将可观测性功能集成到 LLM 应用中的过程，使开发者能够轻松地收集、监控和分析 AI 应用产生的追踪数据和指标数据。\n\n资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:130-132]()\n\n### 1.1 核心定位\n\nOpenLIT 的主要目标是为 GenAI 和 LLM 应用程序提供全面的可观测性支持。通过集成 OpenTelemetry 标准，OpenLIT 能够：\n\n- 自动收集 AI 应用中的追踪数据（Traces）\n- 采集关键性能指标（Metrics）\n- 提供可视化的监控仪表板\n- 支持多语言 SDK（Python、TypeScript）\n\n资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:131-133]()\n\n### 1.2 技术架构\n\nOpenLIT 采用现代化的微服务架构设计，核心组件包括：\n\n| 组件 | 功能描述 | 技术栈 |\n|------|---------|--------|\n| 前端界面 | 提供可视化监控和配置界面 | React/Next.js |\n| 后端服务 | 处理数据存储和 API 请求 | Node.js/Go |\n| OpenTelemetry 接收器 | 接收并处理 OTLP 数据 | OpenTelemetry SDK |\n| 数据库 | 存储追踪和指标数据 | PostgreSQL/TimescaleDB |\n\n资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:135-140]()\n\n## 2. 快速部署\n\n### 2.1 Docker Compose 部署\n\nOpenLIT 支持通过 Docker Compose 进行快速部署，适合本地开发和测试环境。\n\n```bash\n# 克隆仓库\ngit clone git@github.com:openlit/openlit.git\n\n# 启动服务\ncd openlit\ndocker compose up -d\n```\n\n资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:145-150]()\n\n### 2.2 服务访问\n\n部署完成后，通过以下地址访问 OpenLIT：\n\n- **访问地址**：http://127.0.0.1:3000\n- **OTLP 端点**：http://127.0.0.1:4318\n\n默认登录凭证：\n\n| 字段 | 默认值 |\n|------|--------|\n| 邮箱 | user@openlit.io |\n| 密码 | openlituser |\n\n资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:127-130]()\n\n## 3. SDK 集成\n\nOpenLIT 提供多语言 SDK，支持在不同技术栈中快速集成可观测性功能。\n\n### 3.1 Python SDK\n\n```python\nimport openlit\n\nopenlit.init(otlp_endpoint=\"http://127.0.0.1:4318\")\n```\n\n安装命令：\n\n```bash\npip install openlit\n```\n\n资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:165-175]()\n\n### 3.2 TypeScript SDK\n\n```typescript\nimport openlit from 'openlit';\n\nopenlit.init({\n  otlpEndpoint: \"http://127.0.0.1:4318\"\n});\n```\n\n安装命令：\n\n```bash\nnpm install openlit\n```\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:85-95]()\n\n### 3.3 环境变量配置\n\n除代码配置外，也可通过环境变量设置 OTLP 端点：\n\n```bash\nexport OTEL_EXPORTER_OTLP_ENDPOINT=\"http://127.0.0.1:4318\"\n```\n\n资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:178-180]()\n\n## 4. 核心功能模块\n\n### 4.1 追踪功能（Tracing）\n\nOpenLIT 的追踪模块提供对 AI 应用请求链路的完整可视化。通过追踪，开发者可以：\n\n- 查看完整的请求调用链路\n- 分析各环节的延迟和性能\n- 识别潜在的性能瓶颈\n- 追踪 prompt 和响应内容\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:1-10]()\n\n### 4.2 评估功能（Evaluations）\n\n评估模块允许用户创建和管理自定义评估类型，用于衡量 AI 应用输出的质量：\n\n| 字段 | 说明 |\n|------|------|\n| 名称 | 评估类型的标识名称 |\n| 描述 | 评估目的和使用场景的说明 |\n| 评估 Prompt | LLM 评判使用的提示词模板 |\n\n资料来源：[src/client/src/app/(playground)/evaluations/types/new/page.tsx:1-25]()\n\n### 4.3 上下文管理（Context）\n\n上下文管理功能用于存储和管理 AI 应用中的共享上下文数据，包括：\n\n- 上下文描述\n- 状态管理（ACTIVE/INACTIVE）\n- 创建者和创建时间\n- 版本控制\n\n资料来源：[src/client/src/app/(playground)/context/page.tsx:1-25]()\n\n### 4.4 代理管理（Agents）\n\n代理模块追踪和展示 AI 代理的行为信息：\n\n| 属性 | 说明 |\n|------|------|\n| first_seen | 首次发现时间 |\n| last_seen | 最后活动 时间 |\n| request_count | 请求计数 |\n| primary_model | 主要使用的模型 |\n\n资料来源：[src/client/src/components/(playground)/agents/version-drawer.tsx:1-15]()\n\n## 5. 认证与授权\n\nOpenLIT 支持多种认证方式：\n\n| 认证方式 | 描述 |\n|---------|------|\n| Google OAuth | 通过 Google 账户登录 |\n| GitHub OAuth | 通过 GitHub 账户登录 |\n| 邮箱密码 | 本地账户密码认证 |\n\n资料来源：[src/client/src/components/(auth)/auth-form.tsx:1-20]()\n\n## 6. 数据流向架构\n\n```mermaid\ngraph TD\n    A[AI Application] -->|SDK Instrumentation| B[OpenLIT SDK]\n    B -->|OTLP Protocol| C[OTLP Endpoint :4318]\n    C -->|Traces & Metrics| D[OpenLIT Backend]\n    D -->|Storage| E[(Database)]\n    D -->|Query| F[Frontend Dashboard :3000]\n    G[User] -->|Authentication| H[Auth Provider]\n    H -->|Session| F\n```\n\n资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:127-145]()\n\n## 7. 定价模式\n\nOpenLIT 支持灵活的计费模式，包括自动计费功能。系统按以下流程运作：\n\n1. 用户配置使用计划\n2. 系统自动监控使用量\n3. 实时更新计费信息\n4. 支持多种支付方式\n\n资料来源：[src/client/src/app/(playground)/pricing/page.tsx:1-20]()\n\n## 8. SDK 使用示例\n\n### 8.1 Python 与 OpenAI 集成\n\n```python\nimport openlit\nfrom openai import OpenAI\n\nopenlit.init(otlp_endpoint=\"http://127.0.0.1:4318\")\n\nclient = OpenAI(api_key=os.environ.get(\"OPENAI_API_KEY\"))\n\nresponse = client.chat.completions.create(\n    model=\"gpt-3.5-turbo\",\n    messages=[{\"role\": \"user\", \"content\": \"What is LLM Observability?\"}]\n)\n```\n\n### 8.2 TypeScript 与 OpenAI 集成\n\n```typescript\nimport OpenAI from 'openai';\nimport openlit from 'openlit';\n\nopenlit.init({ otlpEndpoint: \"http://127.0.0.1:4318\" });\n\nconst client = new OpenAI({\n  apiKey: process.env.OPENAI_API_KEY\n});\n\nconst chatCompletion = await client.chat.completions.create({\n  messages: [{ role: 'user', content: 'What is LLM Observability?' }],\n  model: 'gpt-3.5-turbo',\n});\n```\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:95-115]()\n\n## 9. 项目结构\n\n```\nopenlit/\n├── sdk/\n│   ├── python/          # Python SDK\n│   └── typescript/      # TypeScript SDK\n├── src/\n│   └── client/          # 前端应用\n│       └── src/\n│           ├── app/             # Next.js 应用页面\n│           ├── components/      # React 组件\n│           └── lib/             # 工具库\n├── docker-compose.yml    # Docker 编排配置\n└── README.md             # 项目说明文档\n```\n\n## 10. 总结\n\nOpenLIT 作为一个开源的 LLM 可观测性平台，通过以下优势为 AI 开发者提供价值：\n\n- **OpenTelemetry 原生**：遵循行业标准，便于与现有监控体系集成\n- **多语言支持**：提供 Python 和 TypeScript SDK，覆盖主流 AI 开发场景\n- **快速部署**：支持 Docker Compose 一键部署\n- **开箱即用**：提供完整的监控面板和可视化界面\n\n开发者可以通过访问官方文档 https://docs.openlit.io 获取更多信息和技术支持。\n\n---\n\n<a id='system-architecture'></a>\n\n## 系统架构\n\n### 相关页面\n\n相关主题：[项目概述](#project-overview), [Python SDK](#python-sdk), [OpenLIT Controller](#controller)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [src/client/src/components/(playground)/getting-started/tracing/index.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/components/(playground)/getting-started/tracing/index.tsx)\n- [src/client/src/app/(playground)/agents/no-controller.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/app/(playground)/agents/no-controller.tsx)\n- [src/client/src/app/(playground)/getting-started/page.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/app/(playground)/getting-started/page.tsx)\n- [src/client/src/components/(playground)/agents/observability-block.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/components/(playground)/agents/observability-block.tsx)\n- [src/client/src/app/(playground)/agents/controller/[instance_id]/page.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/app/(playground)/agents/controller/[instance_id]/page.tsx)\n- [src/client/README.md](https://github.com/openlit/openlit/blob/main/src/client/README.md)\n</details>\n\n# 系统架构\n\n## 概述\n\nOpenLIT 是一个基于 OpenTelemetry 原生设计的 **GenAI 和 LLM 应用可观测性平台**。平台通过采集、传输和处理来自 LLM 应用的遥测数据（Traces 和 Metrics），为开发者提供全面的 AI 应用监控能力。资料来源：[src/client/README.md:1]()\n\n## 核心设计理念\n\nOpenLIT 的架构遵循以下核心原则：\n\n| 原则 | 说明 |\n|------|------|\n| OpenTelemetry 原生 | 完全兼容 OpenTelemetry 标准协议和 SDK |\n| 无侵入集成 | 通过 SDK 初始化即可完成自动埋点 |\n| 多语言支持 | 提供 Python 和 TypeScript 双语言 SDK |\n| 灵活部署 | 支持 Linux、Docker 和 Kubernetes 多种部署方式 |\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:42-60]()\n\n## 系统组件架构\n\n### 整体架构图\n\n```mermaid\ngraph TD\n    subgraph \"LLM 应用层\"\n        A[Python SDK] \n        B[TypeScript SDK]\n    end\n    \n    subgraph \"数据采集层\"\n        C[OpenTelemetry Collector]\n    end\n    \n    subgraph \"OpenLIT 平台层\"\n        D[前端界面]\n        E[后端服务]\n        F[数据库]\n    end\n    \n    A --> C\n    B --> C\n    C --> E\n    E --> F\n    E --> D\n```\n\n### SDK 层\n\nOpenLIT 提供两种语言的 SDK 用于在应用中埋点：\n\n#### Python SDK\n\n```python\nimport openlit\n\nopenlit.init(otlp_endpoint=\"http://127.0.0.1:4318\")\n```\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:70-75]()\n\n#### TypeScript SDK\n\n```typescript\nimport openlit from 'openlit';\n\nopenlit.init({\n  otlpEndpoint: \"http://127.0.0.1:4318\"\n});\n```\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:48-54]()\n\n### 数据流向\n\n```mermaid\ngraph LR\n    A[LLM 应用] -->|OTLP Protocol| B[OTEL Collector]\n    B -->|Traces| C[OpenLIT Backend]\n    B -->|Metrics| C\n    C -->|存储| D[(Database)]\n    D -->|查询| E[Web UI]\n```\n\n## 部署架构\n\nOpenLIT 支持三种主要的部署模式，适用于不同的基础设施环境。\n\n### Linux 系统部署\n\n适用于直接在 Linux 主机上运行监控代理的场景。使用 systemd 管理服务生命周期：\n\n```bash\ncat <<EOF | sudo tee /etc/systemd/system/openlit-controller.service\n[Unit]\nDescription=OpenLIT Controller\n\n[Service]\nExecStart=/usr/local/bin/openlit-controller\nEnvironment=\"OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318\"\nRestart=always\n\n[Install]\nWantedBy=multi-user.target\nEOF\n\nsystemctl daemon-reload\nsystemctl enable --now openlit-controller\n```\n\n资料来源：[src/client/src/app/(playground)/agents/no-controller.tsx:10-22]()\n\n### Docker 容器部署\n\n适用于 Docker 容器化环境，提供隔离的运行环境：\n\n```bash\ndocker run -d --privileged --pid=host \\\n  -e OPENLIT_URL=\"${openlitUrl}\" \\\n  -e OTEL_EXPORTER_OTLP_ENDPOINT=\"${openlitUrl.replace(/:\\d+$/, \":4318\")}\" \\\n  -e OPENLIT_PROC_ROOT=\"/host/proc\" \\\n  -v /proc:/host/proc:ro \\\n  -v /sys/kernel/debug:/sys/kernel/debug:ro \\\n  -v /sys/fs/bpf:/sys/fs/bpf:rw \\\n  -v /var/run/docker.sock:/var/run/docker.sock \\\n  ghcr.io/openlit/controller:latest\n```\n\n资料来源：[src/client/src/app/(playground)/agents/no-controller.tsx:24-36]()\n\n### Kubernetes 部署\n\n适用于大规模容器编排环境，通过 Helm Chart 进行管理：\n\n```bash\nhelm repo add openlit https://openlit.github.io/helm\nhelm repo update\nhelm upgrade --install openlit openlit/openlit \\\n  --set openlit-controller.enabled=true\n```\n\n资料来源：[src/client/src/app/(playground)/agents/no-controller.tsx:38-45]()\n\n### 部署模式对比\n\n| 部署方式 | 适用场景 | 复杂度 | 资源占用 |\n|----------|----------|--------|----------|\n| Linux (systemd) | 物理机/虚拟机 | 低 | 中 |\n| Docker | 容器化环境 | 中 | 中 |\n| Kubernetes | 微服务/云原生 | 高 | 高 |\n\n## 可观测性数据模型\n\n### 资源属性\n\nOpenLIT 采集多种资源属性用于标识和分类服务：\n\n| 属性名 | 说明 | 示例 |\n|--------|------|------|\n| `node_name` | 节点名称 | `prod-server-01` |\n| `version` | 控制器版本 | `v1.2.0` |\n| `mode` | 运行环境模式 | `kubernetes` / `docker` / `linux` |\n| `last_heartbeat` | 最后心跳时间 | `2024-01-15T10:30:00Z` |\n\n资料来源：[src/client/src/app/(playground)/agents/controller/[instance_id]/page.tsx:5-8]()\n\n### 统计指标\n\n控制器实例页面展示以下核心指标：\n\n| 指标名 | 说明 |\n|--------|------|\n| `services_discovered` | 发现的服务数量 |\n| `services_instrumented` | 已接入（埋点）的服务数量 |\n\n资料来源：[src/client/src/app/(playground)/agents/controller/[instance_id]/page.tsx:11-12]()\n\n### 工具 Schema\n\nAI Agent 的工具定义包含以下结构：\n\n| 字段 | 类型 | 说明 |\n|------|------|------|\n| `description` | string | 工具功能描述 |\n| `schema` | JSON | 工具参数 JSON Schema |\n\n资料来源：[src/client/src/components/(playground)/agents/tools-card.tsx:8-18]()\n\n## 前端架构\n\n### 页面路由结构\n\n```mermaid\ngraph TD\n    A[Playground] --> B[Getting Started]\n    A --> C[Agents]\n    A --> D[Context]\n    \n    C --> C1[Controller Instance]\n    C --> C2[Tools]\n    \n    D --> D1[New Context]\n    D --> D2[Context Detail]\n```\n\n### 技术栈\n\nOpenLIT 前端基于 Next.js 框架构建，使用以下核心组件库：\n\n| 组件 | 用途 |\n|------|------|\n| `Tabs` | 语言/模式切换 |\n| `Card` | 内容区块展示 |\n| `Accordion` | 可折叠面板 |\n| `CodeBlock` | 代码高亮显示 |\n| `Dialog` | 模态对话框 |\n\n资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:80-95]()\n\n### 主题支持\n\n平台支持亮色和暗色主题，通过 Tailwind CSS 的 dark mode 类实现：\n\n| 主题 | 类名前缀 |\n|------|----------|\n| 亮色 | 默认 |\n| 暗色 | `dark:` |\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:5-6]()\n\n## 接入流程\n\n### 快速接入步骤\n\n```mermaid\ngraph LR\n    A[安装 SDK] --> B[初始化配置]\n    B --> C[设置 OTLP Endpoint]\n    C --> D[启动应用]\n    D --> E[查看监控数据]\n```\n\n### 环境变量配置\n\n除了代码初始化外，还可以通过环境变量配置端点：\n\n```bash\nOTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318\n```\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:6-8]()\n\n## 上下文管理\n\nOpenLIT 提供上下文（Context）管理功能，允许用户创建和管理监控上下文：\n\n| 功能 | 说明 |\n|------|------|\n| 创建上下文 | 支持描述和 Markdown 内容 |\n| 编辑上下文 | 提供 Write/Preview 双模式 |\n| 关联规则 | 可为上下文绑定业务规则 |\n\n资料来源：[src/client/src/app/(playground)/context/[id]/page.tsx:45-55]()\n\n## 版本管理\n\n控制器实例支持版本历史追踪，每个版本记录：\n\n| 属性 | 说明 |\n|------|------|\n| `first_seen` | 首次发现时间 |\n| `last_seen` | 最后活跃时间 |\n| `request_count` | 请求计数 |\n| `primary_model` | 主要使用的 LLM 模型 |\n\n资料来源：[src/client/src/components/(playground)/agents/version-drawer.tsx:10-20]()\n\n## 安全配置\n\n### API Key 认证\n\n在生产环境中部署时，可通过 API Key 进行认证：\n\n```bash\nhelm upgrade --install openlit openlit/openlit \\\n  --set openlit-controller.apiKey=\"${apiKey}\"\n```\n\n资料来源：[src/client/src/app/(playground)/agents/no-controller.tsx:42-45]()\n\n## 默认凭证\n\n平台提供默认登录凭证供初次使用：\n\n| 字段 | 值 |\n|------|-----|\n| 访问地址 | `http://127.0.0.1:3000` |\n| 邮箱 | `user@openlit.io` |\n| 密码 | `openlituser` |\n\n资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:45-48]()\n\n## 总结\n\nOpenLIT 采用现代化的微服务架构设计，通过 OpenTelemetry 标准协议实现与各类 LLM 框架的无缝集成。平台提供了从 SDK 埋点到数据可视化展示的完整链路，支持灵活的部署方式和多种运行环境，能够满足从开发测试到生产部署的不同场景需求。\n\n---\n\n<a id='python-sdk'></a>\n\n## Python SDK\n\n### 相关页面\n\n相关主题：[TypeScript SDK](#typescript-sdk), [Go SDK](#go-sdk), [可观测性功能](#observability)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [sdk/python/src/openlit/instrumentation/claude_agent_sdk/__init__.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/instrumentation/claude_agent_sdk/__init__.py)\n- [sdk/python/src/openlit/instrumentation/claude_agent_sdk/claude_agent_sdk.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/instrumentation/claude_agent_sdk/claude_agent_sdk.py)\n- [sdk/python/src/openlit/guard/__init__.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/guard/__init__.py)\n- [sdk/python/src/openlit/__helpers.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/__helpers.py)\n- [sdk/python/src/openlit/instrumentation/agent_framework/utils.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/instrumentation/agent_framework/utils.py)\n- [sdk/python/src/openlit/instrumentation/google_adk/utils.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/instrumentation/google_adk/utils.py)\n</details>\n\n# Python SDK\n\nOpenLIT Python SDK 是一个基于 OpenTelemetry 原生的 GenAI 和 LLM 应用可观测性工具。它通过自动插桩主流 AI 框架和模型提供商，自动捕获追踪（traces）、指标（metrics）和日志，帮助开发者实现对 AI 应用的深度可视化监控。\n\n## 核心架构\n\nOpenLIT Python SDK 的架构围绕三个主要模块展开：\n\n```mermaid\ngraph TD\n    A[用户应用代码] --> B[OpenLIT Python SDK]\n    B --> C[插桩模块 Instrumentation]\n    B --> D[防护模块 Guardrails]\n    B --> E[辅助工具 Helpers]\n    \n    C --> C1[Claude Agent SDK]\n    C --> C2[Google ADK]\n    C --> C3[Agent Framework]\n    C --> C4[LangGraph]\n    C --> C5[CrewAI]\n    \n    D --> D1[PII 检测]\n    D --> D2[提示注入检测]\n    D --> D3[敏感话题检测]\n    D --> D4[内容审核]\n    D --> D5[主题限制]\n    \n    E --> E1[工具定义构建]\n    E --> E2[系统指令构建]\n    E --> E3[自定义属性应用]\n```\n\n## 快速开始\n\n### 安装\n\n```bash\npip install openlit\n```\n\n### 初始化\n\n在应用代码中添加以下两行：\n\n```python\nimport openlit\n\nopenlit.init(otlp_endpoint=\"http://127.0.0.1:4318\")\n```\n\n### 与 OpenAI 配合使用\n\n```python\nfrom openai import OpenAI\nimport openlit\n\nopenlit.init(otlp_endpoint=\"http://127.0.0.1:4318\")\n\nclient = OpenAI(api_key=\"YOUR_OPENAI_KEY\")\n\nchat_completion = client.chat.completions.create(\n    messages=[\n        {\n            \"role\": \"user\",\n            \"content\": \"What is LLM Observability?\",\n        }\n    ],\n    model=\"gpt-3.5-turbo\",\n)\n```\n\n## 插桩模块（Instrumentation）\n\n插桩模块是 SDK 的核心，负责自动捕获 AI 框架调用并生成符合 OTel GenAI 语义约定的追踪数据。\n\n### 支持的框架\n\n| 框架 | 版本要求 | 功能 |\n|------|----------|------|\n| Claude Agent SDK | >= 0.1.0 | `invoke_agent` 和 `execute_tool` span |\n| Google ADK | - | 工具执行追踪 |\n| Agent Framework | - | Agent 和工作流追踪 |\n| LangGraph | - | 图执行追踪 |\n| CrewAI | - | Agent 和任务追踪 |\n\n### Claude Agent SDK 插桩\n\nClaude Agent SDK 插桩模块实现了对 `query()` 方法和 `ClaudeSDKClient` 的包装，生成 `invoke_agent` 和 `execute_tool` 两种 span 类型。\n\n```python\nfrom openlit.instrumentation.claude_agent_sdk import ClaudeAgentSDKInstrumentor\n\n# 启用插桩\nClaudeAgentSDKInstrumentor().instrument()\n```\n\n插桩模块通过 SDK 的 Hook 系统（`PreToolUse` / `PostToolUse` / `PostToolUseFailure`）创建工具 span，并使用基于消息流的回退机制处理 Hook 无法注入的场景。\n\n资料来源：[sdk/python/src/openlit/instrumentation/claude_agent_sdk/__init__.py:1-35]()\n\n### Agent Framework 插桩\n\nAgent Framework 插桩提供标准化的 span 命名和操作类型映射：\n\n| 端点 | 操作类型 | Span 名称格式 |\n|------|----------|---------------|\n| `agent_init` | agent | `create_agent {name}` |\n| `agent_run` | agent | `invoke_agent {name}` |\n| `tool_execute` | tools | `execute_tool {name}` |\n| `workflow_run` | workflow | `invoke_workflow {name}` |\n\n```python\n# 工具执行 span 名称生成逻辑\ndef generate_span_name(endpoint, instance, args=None, kwargs=None):\n    operation_type = get_operation_type(endpoint)\n    \n    if endpoint == \"agent_init\":\n        name = getattr(instance, \"name\", None) or getattr(instance, \"id\", None) or \"agent\"\n        return f\"create_agent {name}\"\n    \n    if endpoint == \"tool_execute\":\n        name = getattr(instance, \"name\", None) or type(instance).__name__\n        return f\"execute_tool {name}\"\n```\n\n资料来源：[sdk/python/src/openlit/instrumentation/agent_framework/utils.py:1-70]()\n\n### Google ADK 插桩\n\nGoogle ADK 插桩为工具调用添加 OTel GenAI 语义约定属性：\n\n```python\nspan.set_attribute(SemanticConvention.GEN_AI_OPERATION, \n                   SemanticConvention.GEN_AI_OPERATION_TYPE_TOOLS)\nspan.set_attribute(SemanticConvention.GEN_AI_PROVIDER_NAME,\n                   SemanticConvention.GEN_AI_SYSTEM_GOOGLE_ADK)\n```\n\n资料来源：[sdk/python/src/openlit/instrumentation/google_adk/utils.py:1-50]()\n\n## 防护模块（Guardrails）\n\nOpenLIT 提供了生产级的 LLM 应用防护栏功能，用于过滤和验证输入输出内容。\n\n### 可用防护类型\n\n| 防护类型 | 功能说明 |\n|----------|----------|\n| `PII` | 检测并处理个人身份信息 |\n| `PromptInjection` | 检测提示注入攻击 |\n| `SensitiveTopic` | 检测敏感话题内容 |\n| `TopicRestriction` | 限制允许的话题范围 |\n| `Moderation` | 内容审核 |\n| `Schema` | 输出结构验证 |\n| `Custom` | 自定义防护规则 |\n\n### 使用方法\n\n防护类可以直接在 `openlit.init()` 中配置：\n\n```python\nimport openlit\n\nopenlit.init(\n    otlp_endpoint=\"http://127.0.0.1:4318\",\n    guards=[openlit.PII(action=\"redact\")]\n)\n```\n\n或者直接导入使用：\n\n```python\nfrom openlit import PII, PromptInjection, Moderation\n\n# 单独使用\npii_guard = PII(action=\"redact\")\nresult = pii_guard.check(user_input)\n```\n\n### 核心类结构\n\n| 类名 | 说明 |\n|------|------|\n| `Guard` | 防护基类 |\n| `GuardAction` | 防护动作枚举 |\n| `GuardConfigError` | 配置错误异常 |\n| `GuardDeniedError` | 防护拒绝异常 |\n| `GuardPhase` | 执行阶段枚举 |\n| `GuardResult` | 防护结果数据类 |\n| `GuardTimeoutError` | 超时异常 |\n| `PipelineResult` | 管道执行结果 |\n\n资料来源：[sdk/python/src/openlit/guard/__init__.py:1-55]()\n\n## 辅助工具（Helpers）\n\n`__helpers.py` 模块提供通用的辅助函数，用于处理 AI 请求中的常见数据结构。\n\n### 构建工具定义\n\n`build_tool_definitions()` 函数从聊天请求的 `tools` 参数中提取工具/函数定义：\n\n```python\ndef build_tool_definitions(tools):\n    \"\"\"\n    支持两种模式：\n    1. OpenAI 风格: {\"type\": \"function\", \"function\": {...}}\n    2. 扁平模式: {\"name\": ..., \"description\": ..., \"parameters\": ...}\n    \"\"\"\n```\n\n返回值格式：\n\n```python\n{\n    \"type\": \"function\",\n    \"name\": str,\n    \"description\": str,\n    \"parameters\": dict\n}\n```\n\n### 构建系统指令\n\n`build_system_instructions()` 函数从各种格式中提取系统指令：\n\n```python\ninstructions = [\n    {\"type\": \"text\", \"content\": str(content)},\n    {\"type\": \"resource\", \"uri\": str(uri), \"content\": str(content)}\n]\n```\n\n### 异常处理\n\n`handle_exception()` 函数用于统一处理插桩过程中的异常，确保不影响主业务流程。\n\n资料来源：[sdk/python/src/openlit/__helpers.py:1-100]()\n\n## 配置选项\n\n### 初始化参数\n\n| 参数 | 类型 | 默认值 | 说明 |\n|------|------|--------|------|\n| `otlp_endpoint` | str | 环境变量 | OTLP 接收端点 |\n| `application_name` | str | \"default\" | 应用名称 |\n| `environment` | str | \"default\" | 环境名称 |\n| `pricing_info` | dict | {} | 价格信息映射 |\n| `capture_message_content` | bool | False | 是否捕获消息内容 |\n| `disable_metrics` | bool | None | 是否禁用指标 |\n| `guards` | list | [] | 防护配置列表 |\n\n### 环境变量\n\n| 变量名 | 说明 |\n|--------|------|\n| `OTEL_EXPORTER_OTLP_ENDPOINT` | OTLP 接收端点 |\n| `OTEL_SERVICE_NAME` | 服务名称 |\n\n## 追踪数据模型\n\n### Span 类型与属性\n\nOpenLIT 使用 OTel GenAI 语义约定定义 span 属性：\n\n| 属性键 | 值 | 适用 Span |\n|--------|-----|-----------|\n| `gen_ai.operation.name` | `agent` / `tools` / `workflow` | Agent 调用 |\n| `gen_ai.operation.type` | `create` / `invoke` | 操作类型 |\n| `gen_ai.system` | `openai` / `anthropic` 等 | AI 系统 |\n| `gen_ai.tool.name` | 工具名称 | 工具调用 |\n| `gen_ai.tool.type` | `function` 等 | 工具类型 |\n| `gen_ai.tool.call.arguments` | 调用参数 | 工具调用 |\n| `gen_ai.tool.call.id` | 调用 ID | 工具调用 |\n| `gen_ai.response.id` | 响应 ID | 模型响应 |\n| `gen_ai.prompt.token_count` | 提示 token 数 | 请求 |\n| `gen_ai.completion.token_count` | 完成 token 数 | 响应 |\n\n### SpanKind 映射\n\n| 操作类型 | SpanKind |\n|----------|----------|\n| `agent` | `CLIENT` |\n| `tools` | `INTERNAL` |\n| `workflow` | `INTERNAL` |\n\n## 工作流程\n\n### 自动插桩流程\n\n```mermaid\nsequenceDiagram\n    participant App as 应用代码\n    participant Inst as 插桩器\n    participant SDK as AI SDK\n    participant OTel as OpenTelemetry\n    \n    App->>Inst: instrument()\n    Inst->>SDK: 包装目标函数\n    App->>SDK: 调用 AI 方法\n    SDK->>Inst: 触发包装函数\n    Inst->>OTel: 创建 Span\n    Inst->>Inst: 提取模型/工具信息\n    Inst->>OTel: 设置语义属性\n    SDK-->>App: 返回结果\n    Inst->>OTel: 结束 Span\n```\n\n### 防护检查流程\n\n```mermaid\ngraph LR\n    A[用户输入] --> B{PII 检测}\n    B -->|通过| C{提示注入检测}\n    B -->|发现 PII| D[处理/拒绝]\n    C -->|通过| E{内容审核}\n    C -->|检测到注入| F[拒绝]\n    E -->|通过| G[发送给 LLM]\n    E -->|违规| H[拒绝]\n```\n\n## 与 TypeScript SDK 的对比\n\n| 特性 | Python SDK | TypeScript SDK |\n|------|------------|----------------|\n| 安装命令 | `pip install openlit` | `npm install openlit` |\n| 初始化语法 | `openlit.init(otlp_endpoint=\"...\")` | `openlit.init({ otlpEndpoint: \"...\" })` |\n| 插桩方式 | 自动包装函数 | 自动包装函数 |\n| 防护模块 | 完整支持 | 完整支持 |\n\n## 下一步\n\n- 访问 [OpenLIT 官方文档](https://docs.openlit.io) 获取更多详细信息\n- 查看 [GitHub 仓库](https://github.com/openlit/openlit) 获取最新更新\n- 加入 [Slack 社区](https://join.slack.com/t/openlit/shared_invite/zt-2etnfttwg-TjP_7BZXfYg84oAukY8QRQ) 参与讨论\n\n---\n\n<a id='typescript-sdk'></a>\n\n## TypeScript SDK\n\n### 相关页面\n\n相关主题：[Python SDK](#python-sdk), [Go SDK](#go-sdk)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [src/client/src/components/(playground)/getting-started/tracing/index.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/components/(playground)/getting-started/tracing/index.tsx)\n- [src/client/src/app/(playground)/getting-started/page.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/app/(playground)/getting-started/page.tsx)\n- [src/client/src/components/(playground)/openground/sdk-usage-dialog.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/components/(playground)/openground/sdk-usage-dialog.tsx)\n- [src/client/src/components/(playground)/agents/observability-block.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/components/(playground)/agents/observability-block.tsx)\n- [src/client/src/components/(playground)/agents/tools-card.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/components/(playground)/agents/tools-card.tsx)\n</details>\n\n# TypeScript SDK\n\n## 概述\n\nOpenLIT TypeScript SDK 是一个用于为 GenAI 和 LLM 应用程序添加可观测性的客户端库。它基于 OpenTelemetry 标准设计，能够自动捕获 LLM 调用、追踪请求链路、收集指标数据，并将其发送至 OpenLIT 后端进行可视化分析。\n\nSDK 通过简单的初始化配置即可集成到现有的 TypeScript/Node.js 应用中，支持与 OpenAI 等主流 LLM 提供商的自动集成。\n\n资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:1-50]()\n\n## 核心功能\n\n### 自动插桩\n\nSDK 提供开箱即用的自动插桩功能，能够拦截并追踪 LLM API 调用。主要支持以下功能：\n\n| 功能 | 说明 |\n|------|------|\n| 请求捕获 | 自动捕获发送给 LLM 的所有请求 |\n| 响应记录 | 记录 LLM 返回的完整响应 |\n| Token 统计 | 统计输入/输出 Token 数量 |\n| 延迟追踪 | 测量请求处理耗时 |\n| 错误捕获 | 记录请求过程中发生的错误 |\n\n### 环境变量配置\n\n除代码配置外，SDK 还支持通过环境变量进行配置：\n\n```bash\nexport OTEL_EXPORTER_OTLP_ENDPOINT=\"http://127.0.0.1:4318\"\n```\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:80-85]()\n\n## 安装与快速开始\n\n### 安装 SDK\n\n使用 npm 安装 OpenLIT SDK：\n\n```bash\nnpm install openlit\n```\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:25-30]()\n\n### 初始化配置\n\n在应用入口处初始化 SDK：\n\n```typescript\nimport openlit from 'openlit';\n\nopenlit.init({\n  otlpEndpoint: \"http://127.0.0.1:4318\"\n});\n```\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:35-42]()\n\n### OpenAI 集成示例\n\nSDK 与 OpenAI API 完美集成：\n\n```typescript\nimport OpenAI from 'openai';\nimport openlit from 'openlit';\n\nopenlit.init({ otlpEndpoint: \"http://127.0.0.1:4318\" });\n\nconst client = new OpenAI({\n  apiKey: process.env.OPENAI_API_KEY\n});\n\nconst chatCompletion = await client.chat.completions.create({\n  messages: [{ role: 'user', content: 'What is LLM Observability?' }],\n  model: 'gpt-3.5-turbo',\n});\n```\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:55-70]()\n\n## 配置参数\n\n### init() 方法参数\n\n| 参数 | 类型 | 必填 | 默认值 | 说明 |\n|------|------|------|--------|------|\n| otlpEndpoint | string | 否 | OTEL_EXPORTER_OTLP_ENDPOINT 环境变量 | OTLP 接收端点地址 |\n\n### 环境变量\n\n| 变量名 | 说明 |\n|--------|------|\n| OTEL_EXPORTER_OTLP_ENDPOINT | OTLP exporter 的服务端点 |\n| OPENAI_API_KEY | OpenAI API 密钥（如使用 OpenAI） |\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:45-50]()\n\n## SDK 启用状态指示\n\n在 OpenLIT 前端界面中，已通过 SDK 接入的 Agent 会显示特定的标识状态：\n\n```typescript\n<span className=\"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md border border-emerald-200 dark:border-emerald-900 text-emerald-700 dark:text-emerald-400 bg-emerald-50/60 dark:bg-emerald-900/20\">\n  <span className=\"w-1.5 h-1.5 rounded-full bg-emerald-500\" />\n  {getMessage().AGENTS_SDK_ENABLED_VIA}\n</span>\n```\n\n资料来源：[src/client/src/components/(playground)/agents/observability-block.tsx:30-38]()\n\n### 状态标识说明\n\n| 状态 | 样式 | 含义 |\n|------|------|------|\n| SDK 已启用 | 绿色边框、绿色圆点 | 通过 OpenLIT SDK 进行追踪 |\n| 静态分析 | 绿色边框、绿色圆点 | 源代码已集成 SDK |\n| 等待确认 | 禁用按钮 | 等待 SDK 连接确认 |\n\n## 可观测性数据捕获\n\n### 工具定义捕获\n\nSDK 能够自动捕获 Agent 使用的工具定义和 schema：\n\n```typescript\n{tool.description && (\n  <p className=\"text-xs text-stone-600 dark:text-stone-300 whitespace-pre-wrap\">\n    {tool.description}\n  </p>\n)}\n{hasSchema(tool.schema) ? (\n  <div className=\"rounded-md bg-stone-100 dark:bg-stone-900 p-3 text-xs overflow-x-auto\">\n    <JSONViewer value={tool.schema} />\n  </div>\n) : (\n  <div className=\"rounded-md border border-dashed border-stone-200 dark:border-stone-800 p-3 text-xs text-stone-500 dark:text-stone-400\">\n    {getMessage().AGENTS_DEFINITION_SCHEMA_NOT_CAPTURED}\n  </div>\n)}\n```\n\n资料来源：[src/client/src/components/(playground)/agents/tools-card.tsx:20-35]()\n\n## 架构流程\n\n```mermaid\ngraph TD\n    A[TypeScript 应用] --> B[OpenLIT SDK]\n    B --> C[自动插桩层]\n    C --> D[OpenAI API]\n    D --> E[响应数据]\n    C --> F[OTLP Exporter]\n    F --> G[OpenLIT Collector]\n    G --> H[数据存储]\n    G --> I[前端可视化]\n    \n    J[环境变量配置] --> B\n    K[otlpEndpoint 参数] --> B\n    \n    style A fill:#e1f5fe\n    style D fill:#fff3e0\n    style G fill:#e8f5e9\n    style I fill:#f3e5f5\n```\n\n## 多语言 SDK 支持\n\nOpenLIT 提供多种语言的 SDK，TypeScript SDK 是其中之一：\n\n| SDK | 安装命令 | 初始化方式 |\n|-----|----------|------------|\n| Python | `pip install openlit` | `openlit.init(otlp_endpoint=\"...\")` |\n| TypeScript | `npm install openlit` | `openlit.init({ otlpEndpoint: \"...\" })` |\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:10-45]()\n\n## 使用场景\n\n### 场景一：LLM 应用监控\n\n在生产环境中部署 LLM 应用时，通过 SDK 实时监控：\n\n- API 调用频率和响应时间\n- Token 消耗统计\n- 错误率追踪\n\n### 场景二：Agent 行为分析\n\n结合 OpenLIT 的 Agent 可视化功能，分析：\n\n- 工具调用模式\n- 决策链路追踪\n- 上下文使用效率\n\n### 场景三：性能优化\n\n基于收集的遥测数据：\n\n- 识别性能瓶颈\n- 优化 Prompt 设计\n- 降低 API 成本\n\n## 高级配置\n\n### 异步初始化\n\nSDK 支持在异步环境中初始化：\n\n```typescript\nimport openlit from 'openlit';\n\nasync function initializeApp() {\n  await openlit.init({\n    otlpEndpoint: process.env.OTEL_EXPORTER_OTLP_ENDPOINT\n  });\n}\n```\n\n### 条件初始化\n\n在开发环境中可选择性地禁用追踪：\n\n```typescript\nopenlit.init({\n  otlpEndpoint: process.env.NODE_ENV === 'production' \n    ? \"http://127.0.0.1:4318\" \n    : undefined\n});\n```\n\n## 注意事项\n\n1. **端点配置优先级**：代码中的 `otlpEndpoint` 参数优先于环境变量\n2. **网络要求**：确保应用能够访问配置的 OTLP 端点\n3. **性能影响**：SDK 设计为低侵入性，对应用性能影响极小\n4. **数据类型**：自动捕获的数据包括文本内容，可能涉及敏感信息，请确保合规处理\n\n## 相关资源\n\n- 官方文档：https://docs.openlit.io\n- SDK 仓库：https://github.com/openlit/openlit/tree/main/sdk/typescript\n- OpenTelemetry 官方：https://opentelemetry.io\n\n---\n\n<a id='go-sdk'></a>\n\n## Go SDK\n\n### 相关页面\n\n相关主题：[Python SDK](#python-sdk), [TypeScript SDK](#typescript-sdk)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [sdk/go/openlit.go](https://github.com/openlit/openlit/blob/main/sdk/go/openlit.go)\n- [sdk/go/config.go](https://github.com/openlit/openlit/blob/main/sdk/go/config.go)\n- [sdk/go/instrumentation/openai/instrumentor.go](https://github.com/openlit/openlit/blob/main/sdk/go/instrumentation/openai/instrumentor.go)\n- [sdk/go/instrumentation/anthropic/instrumentor.go](https://github.com/openlit/openlit/blob/main/sdk/go/instrumentation/anthropic/instrumentor.go)\n- [sdk/go/go.mod](https://github.com/openlit/openlit/blob/main/sdk/go/go.mod)\n- [sdk/go/README.md](https://github.com/openlit/openlit/blob/main/sdk/go/README.md)\n</details>\n\n# Go SDK\n\nOpenLIT Go SDK 是一个原生支持 OpenTelemetry 的观测工具，专为 Go 语言开发的 GenAI 应用和 LLM 应用设计。该 SDK 提供自动化的链路追踪（Tracing）和指标收集（Metrics）功能，使开发者能够轻松地将应用程序的观测数据导出至 OpenLIT 平台进行可视化和分析。\n\n## 核心架构\n\n```mermaid\ngraph TD\n    A[Go 应用] --> B[OpenLIT SDK]\n    B --> C[OpenAI Instrumentation]\n    B --> D[Anthropic Instrumentation]\n    C --> E[OpenTelemetry Collector]\n    D --> E\n    E --> F[OpenLIT Dashboard]\n    \n    G[Rule Engine] --> H[HTTP API 调用]\n    H --> F\n```\n\nOpenLIT Go SDK 采用模块化架构，核心模块负责 SDK 初始化和配置管理，而插桩（Instrumentation）模块则负责拦截和追踪具体的 AI SDK 调用。Rule Engine 模块独立运行，无需调用 `Init()`，通过 HTTP 与 OpenLIT 平台通信。\n\n## 快速开始\n\n### 环境要求\n\n- Go 1.21 或更高版本\n- OpenLIT 后端服务运行中\n\n### 安装 SDK\n\n```bash\ngo get github.com/openlit/openlit/sdk/go\n```\n\n### 初始化 OpenLIT\n\n在应用程序启动时调用初始化方法：\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"log\"\n    \n    \"github.com/openlit/openlit/sdk/go\"\n)\n\nfunc main() {\n    err := openlit.Init(openlit.Config{\n        OtlpEndpoint:    \"http://127.0.0.1:4318\",\n        Environment:     \"production\",\n        ApplicationName: \"my-go-app\",\n    })\n    if err != nil {\n        log.Fatalf(\"初始化 OpenLIT 失败: %v\", err)\n    }\n    defer openlit.Shutdown(context.Background())\n}\n```\n\n资料来源：[sdk/go/README.md:Quick Start]()\n\n## 配置选项\n\n`Config` 结构体是 SDK 的核心配置单元，支持多种自定义选项：\n\n| 配置项 | 类型 | 说明 | 默认值 |\n|--------|------|------|--------|\n| `OtlpEndpoint` | string | OTLP 导出端点地址 | `http://localhost:4318` |\n| `Environment` | string | 运行环境名称 | `\"default\"` |\n| `ApplicationName` | string | 应用名称 | `\"default\"` |\n| `PricingInfo` | `map[string]ModelPricing` | 自定义模型定价信息 | 空 |\n| `OtlpHeaders` | `map[string]string` | 自定义 OTLP 导出头 | 空 |\n\n### 自定义模型定价\n\n```go\nconfig := openlit.Config{\n    PricingInfo: map[string]openlit.ModelPricing{\n        \"gpt-4-custom\": {\n            InputCostPerToken:  0.00003,\n            OutputCostPerToken: 0.00006,\n        },\n    },\n}\n```\n\n资料来源：[sdk/go/README.md:Custom Pricing]()\n\n### 自定义 Headers\n\n```go\nconfig := openlit.Config{\n    OtlpHeaders: map[string]string{\n        \"Authorization\": \"Bearer token\",\n        \"X-Custom-Header\": \"value\",\n    },\n}\n```\n\n资料来源：[sdk/go/README.md:Custom Headers]()\n\n## OpenAI 插桩\n\nOpenAI 插桩模块提供了对 `sashabaranov/go-openai` 客户端的自动追踪支持。\n\n### 使用方式\n\n```go\nimport (\n    \"github.com/openlit/openlit/sdk/go/instrumentation/openai\"\n    openai_sdk \"github.com/sashabaranov/go-openai\"\n)\n\n// 创建并插桩 OpenAI 客户端\nclient := openai_sdk.NewClient(\"your-api-key\")\ninstrumentedClient := openai.Instrument(client)\n\n// 使用方式与普通客户端完全相同，自动产生追踪数据\nresp, err := instrumentedClient.CreateChatCompletion(ctx, openai_sdk.ChatCompletionRequest{\n    Model: openai_sdk.GPT4,\n    Messages: []openai_sdk.ChatCompletionMessage{\n        {\n            Role:    openai_sdk.ChatMessageRoleUser,\n            Content: \"Hello!\",\n        },\n    },\n})\n```\n\n资料来源：[sdk/go/README.md:Instrument OpenAI]()\n\n### 工作原理\n\n```mermaid\nsequenceDiagram\n    participant App as 应用代码\n    participant Inst as InstrumentedClient\n    participant OpenAI as OpenAI API\n    participant OTel as OpenTelemetry\n    \n    App->>Inst: CreateChatCompletion()\n    Inst->>OpenAI: 调用 OpenAI API\n    OpenAI-->>Inst: 返回响应\n    Inst->>OTel: 创建 Span 和 Metrics\n    Inst-->>App: 返回响应结果\n```\n\n插桩客户端内部自动拦截所有 API 调用，创建相应的 OpenTelemetry Span，并记录输入/输出 token 数量、成本等指标数据。\n\n## Anthropic 插桩\n\nAnthropic 插桩模块支持对 Anthropic Claude API 的追踪。\n\n### 使用方式\n\n```go\nimport (\n    \"github.com/openlit/openlit/sdk/go/instrumentation/anthropic\"\n)\n\n// 创建并插桩 Anthropic 客户端\nclient := anthropic.NewClient(\"your-api-key\")\ninstrumentedClient := anthropic.Instrument(client)\n```\n\n资料来源：[sdk/go/README.md:Instrument Anthropic]()\n\n## 规则引擎\n\nOpenLIT Go SDK 提供独立的规则引擎评估功能，允许开发者对追踪属性进行规则匹配，并获取关联的实体信息。\n\n### 核心函数\n\n```go\nresult := openlit.EvaluateRule(ruleConfig)\n```\n\n### 特性\n\n- **独立运行**：无需调用 `openlit.Init()`，仅需 HTTP 连接即可使用\n- **规则匹配**：根据追踪属性评估匹配规则\n- **实体获取**：返回关联的上下文、提示词和评估配置\n\n资料来源：[sdk/go/README.md:Rule Engine]()\n\n## 与 OpenLIT Dashboard 集成\n\n### 1. 启动 OpenLIT 堆栈\n\n```bash\ndocker compose up -d\n```\n\n### 2. 配置 SDK 发送数据\n\n```go\nopenlit.Init(openlit.Config{\n    OtlpEndpoint: \"http://localhost:4318\",\n})\n```\n\n### 3. 查看追踪数据\n\n访问 http://localhost:3000 查看可视化追踪和指标数据。\n\n资料来源：[sdk/go/README.md:Integration with OpenLIT Dashboard]()\n\n## 示例项目\n\nSDK 仓库包含完整的可运行示例：\n\n| 示例路径 | 说明 |\n|----------|------|\n| `examples/openai/chat/` | OpenAI 聊天补全示例 |\n| `examples/openai/streaming/` | OpenAI 流式响应示例 |\n| `examples/anthropic/messages/` | Anthropic 消息 API 示例 |\n| `examples/anthropic/streaming/` | Anthropic 流式响应示例 |\n\n资料来源：[sdk/go/README.md:Examples]()\n\n## 模块结构\n\n```\nsdk/go/\n├── openlit.go              # 核心初始化和配置\n├── config.go               # 配置结构体定义\n├── go.mod                  # 模块依赖声明\n├── instrumentation/\n│   ├── openai/\n│   │   └── instrumentor.go  # OpenAI 插桩实现\n│   └── anthropic/\n│       └── instrumentor.go  # Anthropic 插桩实现\n└── examples/               # 示例代码\n```\n\n## 环境变量\n\n除代码配置外，SDK 也支持通过环境变量进行配置：\n\n| 环境变量 | 说明 |\n|----------|------|\n| `OTEL_EXPORTER_OTLP_ENDPOINT` | OTLP 导出端点 |\n\n## 关闭 SDK\n\n应用程序结束时，应优雅地关闭 SDK 以确保所有数据被正确刷新：\n\n```go\ndefer openlit.Shutdown(context.Background())\n\n---\n\n<a id='observability'></a>\n\n## 可观测性功能\n\n### 相关页面\n\n相关主题：[Python SDK](#python-sdk), [GPU Collector](#gpu-collector), [评估功能](#evaluations)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [src/client/src/app/(playground)/getting-started/page.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/app/(playground)/getting-started/page.tsx)\n- [sdk/python/src/openlit/instrumentation/claude_agent_sdk/__init__.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/instrumentation/claude_agent_sdk/__init__.py)\n- [sdk/python/src/openlit/instrumentation/llamaindex/utils.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/instrumentation/llamaindex/utils.py)\n- [sdk/python/src/openlit/instrumentation/langgraph/__init__.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/instrumentation/langgraph/__init__.py)\n- [sdk/python/src/openlit/instrumentation/openai/async_openai.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/instrumentation/openai/async_openai.py)\n- [sdk/typescript/src/instrumentation/llamaindex/index.ts](https://github.com/openlit/openlit/blob/main/sdk/typescript/src/instrumentation/llamaindex/index.ts)\n- [src/client/src/components/(playground)/getting-started/tracing/index.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/components/(playground)/getting-started/tracing/index.tsx)\n- [src/client/src/components/(playground)/agents/observability-block.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/components/(playground)/agents/observability-block.tsx)\n</details>\n\n# 可观测性功能\n\n## 概述\n\nOpenLIT 是一个基于 OpenTelemetry 原生的 GenAI 和 LLM 应用可观测性工具，旨在简化 LLM 应用与 OpenTelemetry 追踪和指标系统的集成过程。OpenLIT 通过自动插桩技术，为开发者提供开箱即用的可观测性能力，无需对现有代码进行大规模改造。资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:50]()\n\n### 核心设计理念\n\nOpenLIT 的可观测性功能遵循以下设计原则：\n\n1. **OpenTelemetry 原生支持**：完全兼容 OpenTelemetry 标准协议\n2. **零侵入式集成**：通过自动插桩（Auto-Instrumentation）实现透明监控\n3. **多框架支持**：覆盖主流 LLM 框架和应用框架\n4. **语义约定合规**：遵循 GenAI 语义约定规范\n\n---\n\n## 架构设计\n\n### 系统架构图\n\n```mermaid\ngraph TD\n    A[用户应用] --> B[OpenLIT SDK]\n    B --> C[自动插桩层]\n    C --> D[OpenTelemetry Collector]\n    D --> E[追踪数据]\n    D --> F[指标数据]\n    D --> G[事件数据]\n    \n    H[Python SDK] --> C\n    I[TypeScript SDK] --> C\n    \n    J[OpenAI] --> C\n    K[Anthropic] --> C\n    L[LlamaIndex] --> C\n    M[LangGraph] --> C\n    N[Claude Agent SDK] --> C\n    \n    E --> H1[追踪后端]\n    F --> M1[指标后端]\n    G --> E1[事件后端]\n```\n\n### 组件层次结构\n\n| 层级 | 组件 | 说明 |\n|------|------|------|\n| 应用层 | 用户代码 | 集成 OpenLIT SDK 的业务应用 |\n| SDK 层 | Python/TypeScript SDK | 提供初始化和配置接口 |\n| 插桩层 | 自动插桩模块 | 拦截并增强框架调用 |\n| 传输层 | OTLP 导出器 | 将遥测数据传输至后端 |\n| 后端层 | OpenTelemetry Collector | 收集和处理遥测数据 |\n\n---\n\n## 核心功能模块\n\n### 1. 追踪功能（Tracing）\n\nOpenLIT 的追踪功能通过包装框架的核心方法来创建分布式追踪 span，记录 LLM 调用的完整生命周期。\n\n#### 1.1 支持的框架和操作\n\n| 框架 | 操作类型 | 语义约定 |\n|------|----------|----------|\n| OpenAI | `chat`、`embedding` | `gen_ai.operation.type` |\n| Anthropic | `chat` | `gen_ai.operation.type` |\n| LlamaIndex | `query_engine_query`、`document_load`、`document_split`、`response_synthesize` | `gen_ai.operation.type` |\n| LangGraph | `execution`、`construction`、`checkpointing` | `gen_ai.operation.type` |\n| Claude Agent SDK | `invoke_agent`、`execute_tool` | `gen_ai.operation.type` |\n\n#### 1.2 LlamaIndex 操作映射\n\nOpenLIT 为 LlamaIndex 定义了精细的操作类型映射，采用简化的语义约定以提高处理效率：\n\n```python\nOPERATION_MAP = {\n    # 文档加载与处理\n    \"document_load\": SemanticConvention.GEN_AI_OPERATION_TYPE_RETRIEVE,\n    \"document_transform\": SemanticConvention.GEN_AI_OPERATION_TYPE_FRAMEWORK,\n    \"document_split\": SemanticConvention.GEN_AI_OPERATION_TYPE_FRAMEWORK,\n    \n    # 索引构建与管理\n    \"index_construct\": SemanticConvention.GEN_AI_OPERATION_TYPE_FRAMEWORK,\n    \"index_insert\": SemanticConvention.GEN_AI_OPERATION_TYPE_FRAMEWORK,\n    \n    # 查询引擎操作\n    \"query_engine_query\": SemanticConvention.GEN_AI_OPERATION_TYPE_RETRIEVE,\n    \"query_engine_query_async\": SemanticConvention.GEN_AI_OPERATION_TYPE_RETRIEVE,\n    \n    # 检索器操作\n    \"retriever_retrieve\": SemanticConvention.GEN_AI_OPERATION_TYPE_RETRIEVE,\n}\n```\n\n资料来源：[sdk/python/src/openlit/instrumentation/llamaindex/utils.py:14-36]()\n\n#### 1.3 TypeScript SDK 的 LlamaIndex 插桩\n\nTypeScript SDK 采用原型方法打补丁的方式实现 LlamaIndex 插桩：\n\n```typescript\n// 文档操作（框架 / 检索 span）\nthis._patchProto(m, ['SimpleDirectoryReader'], 'loadData',\n  LlamaIndexWrapper._patchFrameworkMethod(tracer, 'document_load'));\n\n// 文本分割\nthis._patchProto(m, ['SentenceSplitter', 'NodeParser'], 'getNodesFromDocuments',\n  LlamaIndexWrapper._patchFrameworkMethod(tracer, 'document_split'));\n\n// 检索操作\nthis._patchProto(m, ['BaseRetriever'], 'retrieve',\n  LlamaIndexWrapper._patchFrameworkMethod(tracer, 'retriever_retrieve'));\n```\n\n资料来源：[sdk/typescript/src/instrumentation/llamaindex/index.ts:78-92]()\n\n### 2. 指标功能（Metrics）\n\nOpenLIT 自动收集并记录关键性能指标，包括：\n\n| 指标类型 | 说明 | 记录方式 |\n|----------|------|----------|\n| 请求计数 | LLM 调用总次数 | 计数器 |\n| 令牌使用 | 输入/输出令牌数 | 计量器 |\n| 响应延迟 | 请求到响应的耗时 | 直方图 |\n| 错误率 | 失败请求的比例 | 计数器 |\n\n#### 指标收集流程\n\n```mermaid\ngraph LR\n    A[LLM 调用] --> B[插桩包装器]\n    B --> C{是否禁用指标?}\n    C -->|否| D[记录完成指标]\n    C -->|是| E[跳过指标记录]\n    D --> F[record_completion_metrics]\n    F --> G[更新指标后端]\n    \n    style C fill:#f9f,stroke:#333\n    style D fill:#bbf,stroke:#333\n```\n\n### 3. 事件功能（Events）\n\nOpenLIT 通过事件提供者（Event Provider）记录重要的应用事件，支持日志级别的事件追踪：\n\n```python\nevent_provider = _logs.get_logger_provider().get_logger(__name__)\n```\n\n事件功能允许开发者在追踪 span 之外记录额外的上下文信息，增强问题的排查能力。\n\n### 4. 异常处理\n\nOpenLIT 的插桩层实现了完善的异常处理机制，确保即使在监控过程中发生错误也不会影响应用正常运行：\n\n```python\nexcept Exception as e:\n    handle_exception(span, e)\n    if not disable_metrics and metrics:\n        record_completion_metrics(\n            metrics,\n            # ... 参数配置\n            error_type=type(e).__name__ or \"_OTHER\",\n        )\n```\n\n资料来源：[sdk/python/src/openlit/instrumentation/openai/async_openai.py:95-108]()\n\n---\n\n## SDK 使用指南\n\n### Python SDK\n\n#### 安装\n\n```bash\npip install openlit\n```\n\n#### 初始化配置\n\n```python\nimport openlit\n\nopenlit.init(otlp_endpoint=\"http://127.0.0.1:4318\")\n```\n\n或者通过环境变量配置：\n\n```bash\nexport OTEL_EXPORTER_OTLP_ENDPOINT=\"http://127.0.0.1:4318\"\n```\n\n#### 完整使用示例\n\n```python\nfrom openai import OpenAI\nimport openlit\n\nopenlit.init(otlp_endpoint=\"http://127.0.0.1:4318\")\n\nclient = OpenAI(api_key=\"YOUR_OPENAI_KEY\")\n\nchat_completion = client.chat.completions.create(\n    messages=[\n        {\n            \"role\": \"user\",\n            \"content\": \"What is LLM Observability?\",\n        }\n    ],\n    model=\"gpt-3.5-turbo\",\n)\n```\n\n资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:90-110]()\n\n### TypeScript SDK\n\n#### 安装\n\n通过 npm 或 yarn 安装 TypeScript SDK\n\n#### 初始化配置\n\n```typescript\nimport openlit from 'openlit';\n\nopenlit.init({\n  otlpEndpoint: \"http://127.0.0.1:4318\"\n});\n```\n\n#### 完整使用示例\n\n```typescript\nimport OpenAI from 'openai';\nimport openlit from 'openlit';\n\nopenlit.init({ otlpEndpoint: \"http://127.0.0.1:4318\" });\n\nconst client = new OpenAI({\n  apiKey: process.env.OPENAI_API_KEY\n});\n\nconst chatCompletion = await client.chat.completions.create({\n  messages: [{ role: 'user', content: 'What is LLM Observability?' }],\n  model: 'gpt-3.5-turbo',\n});\n```\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:95-110]()\n\n---\n\n## 插桩模块架构\n\n### 基类设计\n\nOpenLIT 的所有插桩模块都继承自 `BaseInstrumentor` 基类，提供统一的接口规范：\n\n```python\nclass ClaudeAgentSDKInstrumentor(BaseInstrumentor):\n    \"\"\"OTel GenAI semantic convention compliant instrumentor for Claude Agent SDK.\"\"\"\n    \n    def instrumentation_dependencies(self) -> Collection[str]:\n        return _instruments  # 声明依赖版本\n    \n    def _instrument(self, **kwargs):\n        # 执行插桩逻辑\n        tracer = trace.get_tracer(__name__)\n        # ... 配置和包装逻辑\n```\n\n资料来源：[sdk/python/src/openlit/instrumentation/claude_agent_sdk/__init__.py:26-38]()\n\n### LangGraph 插桩分类\n\nLangGraph 的插桩功能分为三大类：\n\n| 操作类别 | 说明 | 包含操作 |\n|----------|------|----------|\n| 执行操作 | 图执行相关 | `invoke`、`ainvoke`、`stream` 等 |\n| 构建操作 | 组件构建 | `add_node`、`add_edge` 等 |\n| 检查点操作 | 状态保存 | `get`、`put` 等 |\n\n```python\n# 执行操作包装\nself._wrap_execution_operations(\n    EXECUTION_OPERATIONS,\n    version,\n    environment,\n    application_name,\n    tracer,\n    pricing_info,\n    capture_message_content,\n    metrics,\n    disable_metrics,\n)\n\n# 检查点操作包装\nself._wrap_checkpoint_operations(\n    version,\n    environment,\n    application_name,\n    tracer,\n    pricing_info,\n    capture_message_content,\n    metrics,\n    disable_metrics,\n)\n```\n\n资料来源：[sdk/python/src/openlit/instrumentation/langgraph/__init__.py:50-100]()\n\n---\n\n## 配置选项\n\n### 初始化参数\n\n| 参数 | 类型 | 默认值 | 说明 |\n|------|------|--------|------|\n| `otlp_endpoint` | string | - | OTLP 导出器端点 |\n| `environment` | string | \"default\" | 运行环境标识 |\n| `application_name` | string | \"default\" | 应用名称 |\n| `pricing_info` | dict | {} | 定价信息映射 |\n| `capture_message_content` | bool | False | 是否捕获消息内容 |\n| `metrics` | bool | True | 是否启用指标收集 |\n| `disable_metrics` | bool | False | 是否禁用指标 |\n\n### 环境变量\n\n| 变量名 | 说明 |\n|--------|------|\n| `OTEL_EXPORTER_OTLP_ENDPOINT` | OTLP 端点地址 |\n| `OTEL_SERVICE_NAME` | 服务名称 |\n\n---\n\n## 前端可视化\n\n### 可观测性状态显示\n\nOpenLIT 前端提供了实时的可观测性状态展示功能：\n\n```typescript\n// SDK 启用状态标识\n{isStatic ? (\n    <span className=\"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md border border-emerald-200 dark:border-emerald-900 text-emerald-700 dark:text-emerald-400 bg-emerald-50/60 dark:bg-emerald-900/20\">\n        <span className=\"w-1.5 h-1.5 rounded-full bg-emerald-500\" />\n        {getMessage().AGENTS_SDK_ENABLED_VIA}\n    </span>\n) : pending ? (\n    // 待处理状态\n)}\n```\n\n资料来源：[src/client/src/components/(playground)/agents/observability-block.tsx:45-55]()\n\n### 版本追踪\n\n前端组件支持追踪不同版本的代理（Agent）使用情况：\n\n| 显示字段 | 说明 |\n|----------|------|\n| 首次出现时间 | `first_seen` |\n| 最后出现时间 | `last_seen` |\n| 请求计数 | `request_count` |\n| 主要模型 | `primary_model` |\n\n资料来源：[src/client/src/components/(playground)/agents/version-drawer.tsx:80-95]()\n\n---\n\n## 默认凭证\n\n首次部署 OpenLIT 后，访问前端界面需要使用以下默认登录凭证：\n\n| 字段 | 值 |\n|------|-----|\n| Email | user@openlit.io |\n| Password | openlituser |\n\n资料来源：[src/client/src/app/(playground)/getting-started/page.tsx:60-65]()\n\n---\n\n## 技术栈总结\n\n### 核心技术依赖\n\n| 组件 | 用途 |\n|------|------|\n| OpenTelemetry | 遥测数据标准 |\n| wrapt | 函数包装 |\n| opentelemetry-instrumentation | 自动插桩框架 |\n\n### 支持的框架版本\n\n| 框架 | 最低版本要求 |\n|------|--------------|\n| Claude Agent SDK | >= 0.1.0 |\n| OpenAI | - |\n| LlamaIndex | - |\n| LangGraph | - |\n\n---\n\n## 总结\n\nOpenLIT 的可观测性功能通过标准化的 OpenTelemetry 集成，为 LLM 应用提供了全面的监控能力。其核心优势包括：\n\n- **多框架支持**：统一覆盖主流 GenAI 和 LLM 框架\n- **零侵入集成**：通过自动插桩实现快速部署\n- **标准化输出**：遵循 OpenTelemetry 和 GenAI 语义约定\n- **灵活配置**：支持多种初始化方式和配置参数\n- **优雅降级**：异常情况下不影响应用运行\n\n---\n\n<a id='evaluations'></a>\n\n## 评估功能\n\n### 相关页面\n\n相关主题：[Guardrails与规则引擎](#guardrails), [可观测性功能](#observability)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [sdk/python/src/openlit/guard/__init__.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/guard/__init__.py)\n- [src/client/src/utils/breadcrumbs.ts](https://github.com/openlit/openlit/blob/main/src/client/src/utils/breadcrumbs.ts)\n- [src/client/src/components/(playground)/getting-started/tracing/index.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/components/(playground)/getting-started/tracing/index.tsx)\n- [src/client/README.md](https://github.com/openlit/openlit/blob/main/src/client/README.md)\n- [sdk/python/src/openlit/instrumentation/claude_agent_sdk/__init__.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/instrumentation/claude_agent_sdk/__init__.py)\n\n</details>\n\n# 评估功能\n\n## 概述\n\nOpenLIT 的评估功能（Evaluation）是平台核心能力之一，旨在为 LLM 应用提供可量化的质量评估机制。通过集成 OpenTelemetry 原生架构，OpenLIT 能够对 AI 应用的响应质量、成本效率和性能表现进行全面的监控与评估。\n\n> **注意**：当前从源码中获取的评估功能相关文档较为有限，以下内容基于可观察到的系统架构和组件进行阐述。\n\n## 评估设置页面\n\n### 路由配置\n\n评估功能在客户端应用中具有独立的路由入口。根据路由配置，评估相关页面包括：\n\n| 路由路径 | 页面标题 | 面包屑导航 |\n|---------|---------|-----------|\n| `/evaluations/settings` | 评估设置（Evaluation Settings） | Settings → Evaluation Settings |\n\n资料来源：[src/client/src/utils/breadcrumbs.ts:1-150]()\n\n### 评估设置界面\n\n评估设置页面允许用户配置评估相关的参数和行为。页面采用标准的设置界面布局，与平台其他设置页面保持一致的交互模式。\n\n## 评估执行机制\n\n### SDK 层面的评估支持\n\nOpenLIT Python SDK 提供了多层次的支持机制，虽然直接的评估执行文件在当前源码上下文中未完全展示，但从系统架构可以看出评估功能与其他 SDK 组件的集成关系。\n\n```mermaid\ngraph TB\n    subgraph \"Python SDK\"\n        A[openlit.init] --> B[Guard System]\n        B --> C[PII Detection]\n        B --> D[Prompt Injection Detection]\n        B --> E[Moderation]\n        B --> F[Topic Restriction]\n    end\n    \n    subgraph \"Evaluation Layer\"\n        G[Evaluation Settings] --> H[Run Evaluation]\n        H --> I[Results Analysis]\n    end\n    \n    C --> G\n    D --> G\n    E --> G\n    F --> G\n```\n\n## Guard 系统与评估质量保障\n\n### Guard 组件架构\n\nOpenLIT 的 Guard 系统是评估功能的重要组成部分，提供生产级的安全保障机制。Guard 组件可以作为评估流程中的质量过滤器使用。\n\n资料来源：[sdk/python/src/openlit/guard/__init__.py:1-47]()\n\n### 核心 Guard 类\n\n| 类名 | 功能描述 | 使用场景 |\n|-----|---------|---------|\n| `PII` | 个人身份信息检测与处理 | 隐私合规评估 |\n| `PromptInjection` | 提示词注入攻击检测 | 安全性评估 |\n| `SensitiveTopic` | 敏感话题识别 | 内容安全评估 |\n| `TopicRestriction` | 话题范围限制 | 主题一致性评估 |\n| `Moderation` | 内容审核 | 合规性评估 |\n| `Schema` | 输出结构验证 | 格式正确性评估 |\n| `Custom` | 自定义 Guard 逻辑 | 定制化评估规则 |\n\n### Guard 基础类型\n\n```python\n# 基础类型定义\nGuard              # Guard 基类\nGuardAction        # Guard 执行动作\nGuardPhase         # Guard 执行阶段\nGuardResult        # Guard 执行结果\nPipelineResult     # 管道执行结果\n```\n\n资料来源：[sdk/python/src/openlit/guard/__init__.py:11-24]()\n\n### Guard 错误类型\n\n| 错误类 | 说明 |\n|-------|------|\n| `GuardError` | 基础 Guard 错误 |\n| `GuardDeniedError` | Guard 拒绝执行错误 |\n| `GuardTimeoutError` | Guard 执行超时错误 |\n| `GuardConfigError` | Guard 配置错误 |\n\n资料来源：[sdk/python/src/openlit/guard/__init__.py:26-31]()\n\n## 评估集成方式\n\n### 初始化配置\n\n在应用代码中集成评估功能的标准方式：\n\n```python\nimport openlit\n\n# 初始化 OpenLIT\nopenlit.init(\n    otlp_endpoint=\"http://127.0.0.1:4318\",\n    # 评估相关配置\n)\n```\n\n资料来源：[src/client/src/components/(playground)/getting-started/tracing/index.tsx:1-100]()\n\n### Guard 与评估结合使用\n\n```python\nimport openlit\n\n# 初始化并启用 Guard\nopenlit.init(\n    guards=[\n        openlit.PII(action=\"redact\"),\n        openlit.Moderation(threshold=0.8)\n    ]\n)\n```\n\n## 技术架构\n\n### OpenTelemetry 原生集成\n\nOpenLIT 采用 OpenTelemetry 标准进行数据采集和传输，确保评估数据与追踪、指标数据的一致性。\n\n```mermaid\ngraph LR\n    A[Application] -->|Traces/Metrics| B[OpenLIT SDK]\n    B -->|OTLP| C[OpenTelemetry Collector]\n    C -->|Data| D[OpenLIT Backend]\n    D -->|Display| E[UI Dashboard]\n    \n    F[Evaluation Engine] -->|Quality Scores| D\n    G[Guard System] -->|Security Results| F\n```\n\n### 追踪与评估关联\n\n评估结果与应用的追踪数据关联存储，用户可以在 OpenLIT 前端界面中同时查看：\n\n- 追踪详情（Traces）\n- 评估分数（Evaluation Scores）\n- Guard 事件（Guard Events）\n- 成本与延迟指标（Cost & Latency Metrics）\n\n## 前端组件结构\n\n### 评估相关路由\n\n客户端应用使用 Next.js 的文件路由系统，评估功能页面位于：\n\n```\nsrc/client/src/app/(playground)/evaluations/\n```\n\n### 导航与面包屑\n\n评估功能通过统一的导航系统与平台其他功能整合，用户可以从主导航直接访问评估设置。\n\n资料来源：[src/client/src/utils/breadcrumbs.ts:60-75]()\n\n## SDK 仪器化支持\n\n### Claude Agent SDK 仪器化\n\nOpenLIT 支持对 Claude Agent SDK 进行仪器化，自动采集代理执行过程中的评估相关数据：\n\n资料来源：[sdk/python/src/openlit/instrumentation/claude_agent_sdk/__init__.py:1-50]()\n\n支持的仪器化操作：\n\n| 操作类型 | 追踪事件 | 说明 |\n|---------|---------|------|\n| `invoke_agent` | Agent 调用 | 追踪代理执行 |\n| `execute_tool` | 工具执行 | 追踪工具使用 |\n| `query` | 查询操作 | 追踪查询请求 |\n\n## 使用限制与注意事项\n\n### 当前源码限制\n\n从当前获取的源码上下文来看，评估功能的具体实现细节（如评估算法、评分标准等）需要在以下方面获取更多源码：\n\n1. 评估执行核心逻辑文件\n2. 评估结果存储与查询 API\n3. 前端评估配置界面组件\n4. 评估报告生成模块\n\n### 建议\n\n- 访问 OpenLIT 官方文档获取完整的评估功能使用指南\n- 查看 `sdk/python/src/openlit/evaluation/` 目录下的具体实现\n- 参考前端 `src/client/src/lib/platform/evaluation/` 目录了解评估流程\n\n## 相关资源\n\n| 资源 | 链接 |\n|------|------|\n| OpenLIT 官方文档 | https://docs.openlit.io |\n| GitHub 仓库 | https://github.com/openlit/openlit |\n| Python SDK | https://github.com/openlit/openlit/tree/main/sdk/python |\n| TypeScript SDK | https://github.com/openlit/openlit/tree/main/sdk/typescript |\n\n---\n\n*本文档基于 OpenLIT 开源项目源码生成，如有疏漏或更新延迟，请以官方最新文档为准。*\n\n---\n\n<a id='guardrails'></a>\n\n## Guardrails与规则引擎\n\n### 相关页面\n\n相关主题：[评估功能](#evaluations), [可观测性功能](#observability)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [sdk/python/src/openlit/guard/__init__.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/guard/__init__.py)\n- [sdk/python/src/openlit/guard/pii.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/guard/pii.py)\n- [sdk/python/src/openlit/guard/_base.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/guard/_base.py)\n- [sdk/python/src/openlit/guard/_pipeline.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/guard/_pipeline.py)\n- [sdk/python/src/openlit/guard/prompt_injection.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/guard/prompt_injection.py)\n- [sdk/python/src/openlit/guard/sensitive_topic.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/guard/sensitive_topic.py)\n</details>\n\n# Guardrails与规则引擎\n\n## 概述\n\nOpenLIT Guardrails是面向LLM应用的生产级安全防护系统，提供开箱即用的防护栏（Guardrails）和灵活可扩展的规则引擎（Rule Engine）。该系统通过在LLM应用的关键阶段注入检测逻辑，自动识别并处理敏感信息泄露、提示词注入攻击、违禁内容等安全风险。\n\nGuardrails系统基于OpenTelemetry语义约定设计，支持preflight（前置检查）和postflight（后置检查）两个执行阶段，可无缝集成到现有LLM应用架构中。资料来源：[sdk/python/src/openlit/guard/__init__.py:1-12]()\n\n## 架构设计\n\n### 核心组件\n\nOpenLIT Guardrails系统由以下核心组件构成：\n\n| 组件 | 文件路径 | 职责 |\n|------|----------|------|\n| Guard基类 | `guard/_base.py` | 定义所有Guard的通用接口和生命周期 |\n| Pipeline管道 | `guard/_pipeline.py` | 编排多个Guard的执行顺序和结果聚合 |\n| PII检测器 | `guard/pii.py` | 识别API密钥、个人身份信息等敏感数据 |\n| 提示词注入检测器 | `guard/prompt_injection.py` | 识别恶意提示词注入攻击 |\n| 敏感话题检测器 | `guard/sensitive_topic.py` | 检测涉及敏感话题的内容 |\n| 主题限制器 | `guard/topic_restriction.py` | 限制对话内容的主题范围 |\n| 内容审核器 | `guard/moderation.py` | 审核生成内容是否合规 |\n| Schema验证器 | `guard/schema.py` | 验证输出是否符合预定义Schema |\n| 自定义Guard | `guard/custom.py` | 支持用户自定义检测规则 |\n\n资料来源：[sdk/python/src/openlit/guard/__init__.py:14-36]()\n\n### 架构流程图\n\n```mermaid\ngraph TD\n    A[LLM请求入口] --> B[Preflight阶段]\n    B --> C{Guard Pipeline}\n    C --> D1[PII检测]\n    C --> D2[提示词注入检测]\n    C --> D3[敏感话题检测]\n    C --> D4[自定义Guard]\n    D1 --> E{检测结果}\n    D2 --> E\n    D3 --> E\n    D4 --> E\n    E -->|通过| F[调用LLM]\n    E -->|拒绝| G[返回GuardDeniedError]\n    E -->|警告| H[记录日志继续执行]\n    F --> I[Postflight阶段]\n    I --> J1[输出PII检测]\n    I --> J2[内容审核]\n    I --> J3[Schema验证]\n    J1 --> K[返回结果]\n    J2 --> K\n    J3 --> K\n```\n\n## Guard基类设计\n\n### 执行阶段\n\nGuard系统定义了两个核心执行阶段：\n\n| 阶段 | 说明 | 适用场景 |\n|------|------|----------|\n| `PREFLIGHT` | 在LLM调用前执行 | 输入内容检测、提示词保护 |\n| `POSTFLIGHT` | 在LLM调用后执行 | 输出内容审核、数据脱敏 |\n\n资料来源：[sdk/python/src/openlit/guard/_base.py]()\n\n### 动作类型\n\n每个Guard支持三种响应动作：\n\n| 动作 | 行为 | 返回结果 |\n|------|------|----------|\n| `redact` | 自动脱敏/替换敏感内容 | 返回脱敏后的文本 |\n| `deny` | 直接拒绝请求 | 抛出`GuardDeniedError` |\n| `warn` | 仅记录事件不阻断 | 返回原始文本并附带警告信息 |\n\n资料来源：[sdk/python/src/openlit/guard/_base.py]()\n\n### 错误类型\n\n| 错误类 | 触发条件 |\n|--------|----------|\n| `GuardError` | 通用Guard异常 |\n| `GuardDeniedError` | 内容被拒绝时抛出 |\n| `GuardTimeoutError` | 检测超时 |\n| `GuardConfigError` | 配置错误 |\n\n## PII检测器详解\n\n### 功能概述\n\nPII检测器是OpenLIT Guardrails最核心的组件之一，使用约25种高置信度正则表达式模式，在小于1毫秒的时间内完成本地检测。该检测器支持识别API密钥、PII个人信息和各类敏感凭证。\n\n### 支持的检测类型\n\n| 类别 | 检测项目 | 正则模式示例 |\n|------|----------|--------------|\n| API密钥 | OpenAI API Key | `sk-(?:proj-)?[A-Za-z0-9_-]{20,}` |\n| API密钥 | Anthropic API Key | `sk-ant-[A-Za-z0-9_-]{20,}` |\n| API密钥 | AWS Access Key | `AKIA[0-9A-Z]{16}` |\n| API密钥 | GCP API Key | `AIza[0-9A-Za-z_-]{35}` |\n| 令牌 | GitHub Token | `(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9_]{36,}` |\n| 证书 | 客户端证书 | PEM格式证书检测 |\n| 凭证 | 私钥检测 | RSA/DSA/EC私钥模式 |\n| 凭证 | Azure凭据 | Azure服务主体格式 |\n\n资料来源：[sdk/python/src/openlit/guard/pii.py:1-45]()\n\n### 使用方式\n\n```python\nimport openlit\n\n# 基础使用 - 自动脱敏\nopenlit.init(guards=[openlit.PII(action=\"redact\")])\n\n# 自定义检测模式\nopenlit.init(guards=[\n    openlit.PII(\n        action=\"deny\",\n        custom_patterns={\n            \"custom-secret\": r\"secret-[A-Za-z0-9]{16}\",\n            \"internal-id\": r\"INT-\\d{8}\"\n        }\n    )\n])\n```\n\n### 脱敏机制\n\n当检测到敏感信息时，PII检测器会将匹配内容替换为标准化的占位符格式：\n\n```\n[REDACTED:<label>]\n```\n\n其中`<label>`为检测类型的标签名称（如`openai-api-key`、`github-token`等）。脱敏过程采用从后向前替换策略，确保位置索引准确性。\n\n资料来源：[sdk/python/src/openlit/guard/pii.py:95-120]()\n\n## Pipeline管道编排\n\n### 功能说明\n\nPipeline用于将多个Guard组合成检测链，支持顺序执行和结果聚合。Pipeline接受一个Guard列表，按声明顺序依次执行每个Guard的检测逻辑。\n\n### 执行结果\n\n```python\n@dataclass\nclass PipelineResult:\n    guard_results: List[GuardResult]  # 各Guard的检测结果\n    final_action: GuardAction          # 最终采取的动作\n    transformed_text: Optional[str]    # 转换后的文本\n```\n\n资料来源：[sdk/python/src/openlit/guard/_base.py]()\n\n### 配置选项\n\n| 参数 | 类型 | 默认值 | 说明 |\n|------|------|--------|------|\n| `guards` | List[Guard] | [] | Guard实例列表 |\n| `timeout` | float | 5.0 | 检测超时时间（秒） |\n\n## 集成方式\n\n### 方式一：初始化时配置\n\n```python\nimport openlit\n\n# 在应用初始化时配置Guardrails\nopenlit.init(\n    guards=[\n        openlit.PII(action=\"redact\"),\n        openlit.PromptInjection(action=\"deny\"),\n        openlit.Moderation(action=\"warn\")\n    ]\n)\n```\n\n### 方式二：直接导入使用\n\n```python\nfrom openlit import PII, PromptInjection, Moderation\n\n# 独立使用单个Guard\npii_guard = PII(action=\"redact\")\nresult = pii_guard.evaluate(\"请帮我分析这个API密钥: sk-abc123...\")\n\nif result.action == GuardAction.DENY:\n    print(\"检测到敏感信息，请求被拒绝\")\n```\n\n资料来源：[sdk/python/src/openlit/guard/__init__.py:4-12]()\n\n## 性能特性\n\n| 特性 | 指标 | 说明 |\n|------|------|------|\n| 本地执行 | <1ms | 所有检测在本地完成，无外部依赖 |\n| 内存占用 | 低 | 使用预编译正则表达式 |\n| 并发支持 | 高 | 无状态设计，支持高并发场景 |\n| 可扩展性 | 自定义模式 | 支持用户添加自定义正则表达式 |\n\n## 最佳实践\n\n### 输入保护策略\n\n建议在`PREFLIGHT`阶段启用PII检测和提示词注入检测，防止敏感信息进入LLM处理流程：\n\n```python\nopenlit.init(guards=[\n    openlit.PII(action=\"redact\"),           # 脱敏输入中的敏感信息\n    openlit.PromptInjection(action=\"deny\")  # 拒绝明显的注入攻击\n])\n```\n\n### 输出审核策略\n\n建议在`POSTFLIGHT`阶段启用内容审核和Schema验证，确保输出符合预期：\n\n```python\nopenlit.init(guards=[\n    openlit.Moderation(action=\"warn\"),  # 审核输出内容\n    openlit.Schema(action=\"deny\")        # 验证输出格式\n])\n```\n\n### 混合策略\n\n生产环境推荐使用Pipeline组合多种Guard：\n\n```python\nopenlit.init(guards=[\n    openlit.PII(action=\"redact\"),\n    openlit.PromptInjection(action=\"deny\"),\n    openlit.SensitiveTopic(action=\"warn\"),\n    openlit.TopicRestriction(allowed_topics=[\"技术\", \"产品\"], action=\"deny\")\n])\n```\n\n## 扩展开发\n\n### 创建自定义Guard\n\n```python\nfrom openlit.guard._base import Guard, GuardAction, GuardPhase, GuardResult\nimport re\n\nclass MyCustomGuard(Guard):\n    name = \"my_custom_guard\"\n    phases = (GuardPhase.PREFLIGHT, GuardPhase.POSTFLIGHT)\n    \n    def __init__(self, pattern: str, action: str = \"warn\", **kwargs):\n        super().__init__(action=action, **kwargs)\n        self._pattern = re.compile(pattern)\n    \n    def evaluate(self, text: str) -> GuardResult:\n        matches = self._pattern.findall(text)\n        if matches:\n            return GuardResult(\n                guard_name=self.name,\n                action=self._action,\n                classification=f\"matched_{len(matches)}_times\"\n            )\n        return GuardResult(guard_name=self.name)\n```\n\n### 注册自定义Guard\n\n```python\nfrom openlit import Custom\n\n# 使用Custom Guard注册自定义检测逻辑\nopenlit.init(guards=[\n    Custom(\n        name=\"my_detector\",\n        evaluate_fn=lambda text: detect_custom_pattern(text),\n        action=\"deny\"\n    )\n])\n```\n\n## 总结\n\nOpenLIT Guardrails系统提供了完整的企业级LLM安全防护解决方案，其设计遵循以下核心原则：\n\n- **高性能**：本地化检测，毫秒级响应\n- **低侵入**：通过`openlit.init()`一行代码即可启用\n- **可扩展**：支持自定义Guard和检测模式\n- **标准化**：符合OpenTelemetry GenAI语义约定\n\n通过合理配置Guardrails与规则引擎，开发者可以在不影响用户体验的前提下，有效防止数据泄露、内容滥用和安全攻击等风险。\n\n---\n\n<a id='controller'></a>\n\n## OpenLIT Controller\n\n### 相关页面\n\n相关主题：[GPU Collector](#gpu-collector), [Python SDK](#python-sdk)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [src/client/src/app/(playground)/agents/no-controller.tsx](https://github.com/openlit/openlit/blob/main/src/client/src/app/(playground)/agents/no-controller.tsx)\n- [src/client/src/lib/platform/controller/features/agent.ts](https://github.com/openlit/openlit/blob/main/src/client/src/lib/platform/controller/features/agent.ts)\n- [sdk/python/src/openlit/guard/__init__.py](https://github.com/openlit/openlit/blob/main/sdk/python/src/openlit/guard/__init__.py)\n- [sdk/go/README.md](https://github.com/openlit/openlit/blob/main/sdk/go/README.md)\n- [sdk/typescript/README.md](https://github.com/openlit/openlit/blob/main/sdk/typescript/README.md)\n</details>\n\n# OpenLIT Controller\n\n## 概述\n\nOpenLIT Controller 是 OpenLIT 平台的核心组件之一，负责在运行时自动检测和插桩 Python 应用程序。它作为一个独立的守护进程运行，能够自动发现用户环境中的 LLM 应用并进行零侵入式的可观测性数据采集，无需修改应用程序代码。\n\nOpenLIT Controller 的主要职责包括：\n\n- **自动检测**：扫描目标环境中的 Python 应用\n- **运行时插桩**：在运行时动态修改 Python 代码，注入 OpenTelemetry 埋点\n- **自动配置**：根据检测到的框架自动应用相应的配置\n- **进程管理**：管理被插桩进程的完整生命周期\n\n## 架构设计\n\n### 组件关系\n\n```mermaid\ngraph TD\n    A[OpenLIT Controller] --> B[Scanner 扫描器]\n    A --> C[Engine 引擎]\n    A --> D[Server 服务器]\n    \n    B --> B1[Python 应用检测]\n    B --> B2[框架识别]\n    B --> B3[依赖分析]\n    \n    C --> C1[运行时插桩]\n    C --> C2[进程管理]\n    C --> C3[配置应用]\n    \n    D --> D1[HTTP API]\n    D --> D2[状态查询]\n    D --> D3[操作指令]\n    \n    E[用户环境] --> B\n    E --> F[Python 应用]\n    F --> C\n    G[OpenLIT Dashboard] --> D\n    D --> H[OTLP 端点]\n```\n\n### 技术栈\n\n| 组件 | 技术选型 | 说明 |\n|------|----------|------|\n| 核心语言 | Go | 高性能、跨平台支持 |\n| 检测引擎 | Python AST 分析 | 精确的代码结构理解 |\n| 通信协议 | OTLP | OpenTelemetry 标准协议 |\n| 部署方式 | Systemd / Docker | 灵活的部署选项 |\n\n## 部署方式\n\nOpenLIT Controller 支持多种部署方式，适应不同的运行环境需求。\n\n### Linux 系统部署\n\n在 Linux 环境中，Controller 可以作为 systemd 服务运行，提供稳定的长期运行能力。\n\n```bash\ncurl -fsSL https://github.com/openlit/openlit/releases/latest/download/openlit-controller-linux-amd64 \\\n  -o /usr/local/bin/openlit-controller\nchmod +x /usr/local/bin/openlit-controller\n\n# 创建 systemd 服务\ncat > /etc/systemd/system/openlit-controller.service << 'EOF'\n[Unit]\nDescription=OpenLIT Controller\nAfter=network.target\n\n[Service]\nEnvironment=\"OPENLIT_URL=${openlitUrl}\"\nEnvironment=\"OTEL_EXPORTER_OTLP_ENDPOINT=${openlitUrl.replace(/:\\d+$/, \":4318\")}\"\nEnvironment=\"OPENLIT_API_KEY=${apiKey}\"\nExecStart=/usr/local/bin/openlit-controller\nRestart=always\n\n[Install]\nWantedBy=multi-user.target\nEOF\n\nsystemctl daemon-reload\nsystemctl enable --now openlit-controller\n```\n\n### Docker 容器部署\n\n对于容器化环境，Controller 可以以特权模式运行，以便进行进程间通信和系统级操作。\n\n```bash\ndocker run -d --privileged --pid=host \\\n  openlit/openlit-controller:latest\n```\n\n## 环境变量配置\n\nController 通过环境变量接收配置信息，这些变量定义了与主平台的连接方式和认证凭证。\n\n| 环境变量 | 说明 | 示例值 |\n|----------|------|--------|\n| `OPENLIT_URL` | OpenLIT 平台 URL | `http://127.0.0.1:3000` |\n| `OTEL_EXPORTER_OTLP_ENDPOINT` | OTLP 导出端点 | `http://127.0.0.1:4318` |\n| `OPENLIT_API_KEY` | API 认证密钥 | `sk-xxx` |\n\n环境变量通过模板字符串进行配置，支持动态插值：\n\n```typescript\nconst systemdKey = apiKey\n    ? `\\nEnvironment=\"OPENLIT_API_KEY=${apiKey}\"`\n    : \"\";\n```\n\n资料来源：[src/client/src/app/(playground)/agents/no-controller.tsx:18-22]()\n\n## 功能特性\n\n### 自动框架检测\n\nController 内置了对多种主流 LLM 框架的自动检测能力，能够识别以下框架：\n\n| 框架类型 | 检测方式 | 支持语言 |\n|----------|----------|----------|\n| OpenAI SDK | 导入语句分析 | Python |\n| Anthropic SDK | 导入语句分析 | Python |\n| LangChain | 依赖检测 | Python |\n| LlamaIndex | 依赖检测 | Python |\n| LiteLLM | 导入语句分析 | Python |\n\n### 运行时插桩机制\n\nController 采用无代理（Agentless）方式的动态插桩技术：\n\n```mermaid\nsequenceDiagram\n    participant Scanner as 扫描器\n    participant Engine as 插桩引擎\n    participant App as Python 应用\n    participant OTLP as OTLP 端点\n\n    Scanner->>App: 检测运行环境\n    Scanner->>Engine: 报告检测结果\n    Engine->>App: 注入埋点代码\n    App->>OTLP: 发送追踪数据\n    Engine->>App: 监控运行状态\n```\n\n### 进程生命周期管理\n\nController 负责管理被插桩进程的完整生命周期，包括：\n\n- **启动**：在检测到目标应用后自动启动插桩\n- **监控**：持续监控进程状态和健康状况\n- **重启**：在进程异常终止时自动重启\n- **停止**：在收到停止指令后优雅终止\n\n## API 接口\n\nController 提供 HTTP API 用于外部控制和状态查询。\n\n### 状态查询\n\n```bash\ncurl http://localhost:8080/status\n```\n\n响应示例：\n\n```json\n{\n  \"status\": \"enabled\",\n  \"mode\": \"kubernetes\",\n  \"service\": \"my-llm-app\",\n  \"namespace\": \"default\",\n  \"transitioning\": false\n}\n```\n\n### 操作指令\n\n| 操作 | 说明 | 参数 |\n|------|------|------|\n| `enable` | 启用自动插桩 | `serviceId` |\n| `disable` | 禁用自动插桩 | `serviceId` |\n| `status` | 查询当前状态 | `serviceId` |\n\n## 与 Python SDK 的集成\n\nOpenLIT Controller 与 Python SDK 形成互补关系，提供端到端的可观测性解决方案：\n\n```python\n# Python SDK - 手动初始化\nimport openlit\n\nopenlit.init(otlp_endpoint=\"http://127.0.0.1:4318\")\n\n# 与 Controller 配合时，Controller 自动处理\n# 未初始化的 Python 应用\n```\n\n当 Python 应用未显式初始化 OpenLIT 时，Controller 可以自动注入初始化代码，实现零配置的可观测性。\n\n资料来源：[sdk/python/src/openlit/guard/__init__.py:1-45]()\n\n## 安全特性\n\n### 认证机制\n\nController 支持 API Key 认证，确保只有授权的客户端可以访问控制接口：\n\n```bash\ncurl -H \"Authorization: Bearer <API_KEY>\" \\\n  http://localhost:8080/status\n```\n\n### 网络隔离\n\nController 支持通过环境变量配置 OTLP 端点，支持 TLS 加密传输，适用于生产环境部署：\n\n```bash\nEnvironment=\"OTEL_EXPORTER_OTLP_ENDPOINT=https://collector.internal:4318\"\n```\n\n## 故障排除\n\n### 常见问题\n\n| 问题 | 可能原因 | 解决方案 |\n|------|----------|----------|\n| Controller 无法启动 | 端口被占用 | 检查 8080 端口占用情况 |\n| 无法连接 OTLP 端点 | 网络隔离 | 检查防火墙规则 |\n| 应用未被检测 | 非 Python 应用 | 确认应用语言运行时 |\n| 数据未上报 | 端点配置错误 | 验证 OTEL_EXPORTER_OTLP_ENDPOINT |\n\n### 日志查看\n\n```bash\n# Systemd 日志\njournalctl -u openlit-controller -f\n\n# Docker 日志\ndocker logs -f openlit-controller\n```\n\n## 最佳实践\n\n### 生产环境部署建议\n\n1. **高可用配置**：使用 Kubernetes 部署时，配置多副本保障可用性\n2. **资源限制**：为 Controller 设置适当的 CPU 和内存限制\n3. **网络安全**：使用 TLS 加密 OTLP 通信，确保数据传输安全\n4. **监控告警**：对 Controller 进程本身进行监控，及时发现异常\n\n### 性能优化\n\n- Controller 本身资源消耗极低，不会影响目标应用性能\n- 插桩开销主要在数据序列化阶段，可通过批量发送优化\n- 建议使用 gRPC 协议的 OTLP 端点以获得更好的性能\n\n## 相关文档\n\n- [OpenLIT Python SDK 文档](https://github.com/openlit/openlit/tree/main/sdk/python)\n- [OpenLIT TypeScript SDK 文档](https://github.com/openlit/openlit/tree/main/sdk/typescript)\n- [OpenLIT Go SDK 文档](https://github.com/openlit/openlit/tree/main/sdk/go)\n- [OpenLIT 官方文档](https://docs.openlit.io/)\n\n---\n\n<a id='gpu-collector'></a>\n\n## GPU Collector\n\n### 相关页面\n\n相关主题：[OpenLIT Controller](#controller), [可观测性功能](#observability)\n\n<details>\n<summary>相关源码文件</summary>\n\n以下源码文件用于生成本页说明：\n\n- [opentelemetry-gpu-collector/README.md](https://github.com/openlit/openlit/blob/main/opentelemetry-gpu-collector/README.md)\n- [sdk/go/README.md](https://github.com/openlit/openlit/blob/main/sdk/go/README.md)\n- [src/client/README.md](https://github.com/openlit/openlit/blob/main/src/client/README.md)\n</details>\n\n# GPU Collector\n\nGPU Collector 是 OpenLIT 项目中的一个核心组件，负责从 NVIDIA、AMD、Intel 等主流 GPU 设备中采集硬件遥测数据，并以 OpenTelemetry 标准格式导出供监控和分析使用。该组件基于 OpenTelemetry Collector 架构构建，支持通过 eBPF 技术实现 CUDA 内核级别的追踪能力。\n\n## 概述\n\nGPU Collector 旨在为人工智能和高性能计算场景提供统一的 GPU 硬件监控解决方案。它能够实时采集 GPU 的功耗、时钟频率、内存使用、计算利用率等关键指标，并将这些数据通过 OTLP（OpenTelemetry Protocol）协议发送到后端监控系统。资料来源：[opentelemetry-gpu-collector/README.md](https://github.com/openlit/openlit/blob/main/opentelemetry-gpu-collector/README.md)\n\n该组件的主要设计目标包括：\n\n- 提供跨厂商（NVIDIA、AMD、Intel）的 GPU 监控支持\n- 遵循 OpenTelemetry 语义约定（`hw.gpu.*`）确保指标命名标准化\n- 支持通过 Prometheus `/metrics` 端点暴露数据（规划中）\n- 利用 eBPF 技术实现低开销的内核级追踪\n- 支持 Docker Compose 和独立二进制等多种部署方式\n\n## 功能特性\n\nGPU Collector 目前已完成的功能和规划中的特性如下表所示：\n\n| 功能特性 | 状态 |\n|---------|------|\n| NVIDIA GPU 硬件遥测（NVML） | 已完成 |\n| AMD GPU 硬件遥测（sysfs/hwmon） | 已完成 |\n| Intel GPU 硬件遥测（sysfs/hwmon） | 已完成 |\n| eBPF CUDA 内核追踪 | 已完成 |\n| OTel 语义约定合规（`hw.gpu.*`） | 已完成 |\n| Prometheus `/metrics` 端点 | 规划中 |\n| ROCm HIP 追踪（AMD eBPF） | 规划中 |\n| 每进程 GPU 利用率（DRM fdinfo） | 规划中 |\n\n资料来源：[opentelemetry-gpu-collector/README.md](https://github.com/openlit/openlit/blob/main/opentelemetry-gpu-collector/README.md)\n\n## 指标体系\n\nGPU Collector 定义了一套完整的 GPU 硬件指标体系，涵盖功耗、时钟频率、能耗和错误等多个维度。\n\n### 核心指标\n\n| 指标名称 | 类型 | 单位 | 描述 | NVIDIA | AMD | Intel |\n|---------|------|------|------|:------:|:---:|:-----:|\n| `hw.gpu.power.draw` | Gauge | W | 当前功耗 | ✓ | ✓ | ✓ |\n| `hw.gpu.power.limit` | Gauge | W | 功率限制 | ✓ | ✓ | ✓ |\n| `hw.gpu.energy.consumed` | Counter | J | 累计能耗 | ✓ | ✓ | ✓ |\n| `hw.gpu.clock.graphics` | Gauge | MHz | 图形/SM 时钟频率 | ✓ | ✓ | ✓* |\n| `hw.gpu.clock.memory` | Gauge | MHz | 内存时钟频率 | ✓ | ✓ | — |\n| `hw.errors` | Counter | {error} | ECC 和 PCIe 错误 | ✓ | — | — |\n\n> * Intel 支持取决于驱动程序（i915/Xe）和内核版本\n\n资料来源：[opentelemetry-gpu-collector/README.md](https://github.com/openlit/openlit/blob/main/opentelemetry-gpu-collector/README.md)\n\n### 指标属性\n\n所有 GPU 指标都携带以下标识属性，用于唯一定位和区分设备：\n\n| 属性名称 | 描述 | 示例值 |\n|---------|------|--------|\n| `hw.id` | 设备唯一标识符（规范要求） | `GPU-a1b2c3d4-...` |\n| `hw.name` | 产品名称 | `NVIDIA A100-SXM4-80GB` |\n| `hw.vendor` | 厂商名称 | `nvidia`、`amd`、`intel` |\n| `gpu.index` | 设备索引 | `0`、`1` |\n| `gpu.pci_address` | PCI 总线地址 | `0000:01:00.0` |\n\n### 额外属性\n\n某些指标还包含额外的上下文属性：\n\n| 指标名称 | 额外属性 | 可选值 |\n|---------|---------|--------|\n| `hw.gpu.utilization` | `hw.gpu.task` | `general`、`encoder`、`decoder` |\n\n资料来源：[opentelemetry-gpu-collector/README.md](https://github.com/openlit/openlit/blob/main/opentelemetry-gpu-collector/README.md)\n\n## 系统架构\n\nGPU Collector 的系统架构遵循模块化设计原则，主要包含以下核心模块：\n\n```mermaid\ngraph TD\n    A[GPU Collector 入口] --> B[GPU 数据采集层]\n    A --> C[eBPF 内核追踪层]\n    B --> D[指标处理与聚合]\n    C --> D\n    D --> E[OpenTelemetry 导出器]\n    E --> F[OTLP Endpoint]\n    E --> G[Prometheus Endpoint]\n    \n    B --> B1[NVML NVIDIA]\n    B --> B2[sysfs hwmon AMD]\n    B --> B3[sysfs hwmon Intel]\n    \n    style A fill:#e1f5fe\n    style E fill:#fff3e0\n    style F fill:#e8f5e9\n    style G fill:#f3e5f5\n```\n\n### 采集层\n\n采集层负责与底层 GPU 驱动和硬件接口交互，根据不同厂商采用相应的采集方式：\n\n- **NVIDIA**：通过 NVML（NVIDIA Management Library）API 直接查询 GPU 状态\n- **AMD**：通过 sysfs/hwmon 文件系统读取硬件传感器数据\n- **Intel**：通过 sysfs/hwmon 文件系统读取硬件传感器数据（依赖特定驱动）\n\n### eBPF 追踪层\n\neBPF（Extended Berkeley Packet Filter）模块用于实现 CUDA 内核级别的追踪能力，能够捕获 GPU 上的计算任务执行信息，提供细粒度的性能分析数据。\n\n### 导出层\n\n导出层负责将采集和处理的指标数据以标准格式输出。当前支持：\n\n- **OTLP 协议**：通过 `OTEL_EXPORTER_OTLP_ENDPOINT` 配置发送至 OpenTelemetry Collector 或后端服务\n- **Prometheus 格式**（规划中）：通过 `/metrics` 端点暴露数据供 Prometheus 抓取\n\n## 部署方式\n\nGPU Collector 提供多种部署方式以适应不同的使用场景。\n\n### Docker 镜像\n\n使用预构建的 Docker 镜像是最简便的部署方式：\n\n```bash\ndocker run -d \\\n    --gpus all \\\n    --name otel-gpu-collector \\\n    -e OTEL_SERVICE_NAME=my-app \\\n    -e OTEL_RESOURCE_ATTRIBUTES=\"deployment.environment=production\" \\\n    -e OTEL_EXPORTER_OTLP_ENDPOINT=\"http://otel-collector:4317\" \\\n    ghcr.io/openlit/otel-gpu-collector:latest\n```\n\n资料来源：[opentelemetry-gpu-collector/README.md](https://github.com/openlit/openlit/blob/main/opentelemetry-gpu-collector/README.md)\n\n### Docker Compose 集成\n\n在已有 OpenLIT 栈的环境中，可以通过 Docker Compose 部署 GPU Collector：\n\n```yaml\nservices:\n  otel-gpu-collector:\n    image: ghcr.io/openlit/otel-gpu-collector:latest\n    environment:\n      OTEL_SERVICE_NAME: my-app\n      OTEL_RESOURCE_ATTRIBUTES: \"deployment.environment=production\"\n      OTEL_EXPORTER_OTLP_ENDPOINT: \"http://otel-collector:4317\"\n    deploy:\n      resources:\n        reservations:\n          devices:\n            - driver: nvidia\n              count: all\n              capabilities: [gpu]\n    depends_on:\n      - otel-collector\n    restart: always\n```\n\n资料来源：[opentelemetry-gpu-collector/README.md](https://github.com/openlit/openlit/blob/main/opentelemetry-gpu-collector/README.md)\n\n### 二进制部署\n\n对于无法使用 Docker 的环境，可以下载预编译的二进制文件：\n\n```sh\n# Linux amd64\ncurl -L https://github.com/openlit/openlit/releases/latest/download/opentelemetry-gpu-collector-<version>-linux-amd64 \\\n    -o opentelemetry-gpu-collector\nchmod +x opentelemetry-gpu-collector\n\nOTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317 ./opentelemetry-gpu-collector\n```\n\n资料来源：[opentelemetry-gpu-collector/README.md](https://github.com/openlit/openlit/blob/main/opentelemetry-gpu-collector/README.md)\n\n### 源码构建\n\n从源码构建需要 Go 编译环境：\n\n```sh\ngit clone https://github.com/openlit/openlit.git\ncd openlit/opentelemetry-gpu-collector\nmake build\n./opentelemetry-gpu-collector\n```\n\n## 配置说明\n\nGPU Collector 通过标准 OpenTelemetry 环境变量进行配置，所有配置项如下表所示：\n\n| 环境变量 | 默认值 | 描述 |\n|---------|-------|------|\n| `OTEL_EXPORTER_OTLP_ENDPOINT` | （必需） | OTLP 导出器端点地址 |\n| `OTEL_SERVICE_NAME` | - | 服务名称标识 |\n| `OTEL_RESOURCE_ATTRIBUTES` | - | 资源属性键值对 |\n\n资料来源：[opentelemetry-gpu-collector/README.md](https://github.com/openlit/openlit/blob/main/opentelemetry-gpu-collector/README.md)\n\n## 与 SDK 的集成\n\nGPU Collector 通常与 OpenLIT 提供的多语言 SDK 配合使用，形成完整的可观测性解决方案。SDK 负责在应用层面采集 LLM 调用追踪和指标，而 GPU Collector 则负责基础设施层面的硬件指标采集。\n\n### Go SDK 配置示例\n\nGo SDK 支持自定义定价信息和 OTLP 导出配置：\n\n```go\nconfig := openlit.Config{\n    OtlpEndpoint: \"http://localhost:4318\",\n    OtlpHeaders: map[string]string{\n        \"Authorization\": \"Bearer token\",\n        \"X-Custom-Header\": \"value\",\n    },\n    PricingInfo: map[string]openlit.ModelPricing{\n        \"gpt-4-custom\": {\n            InputCostPerToken:  0.00003,\n            OutputCostPerToken: 0.00006,\n        },\n    },\n}\n\nopenlit.Init(config)\n```\n\n资料来源：[sdk/go/README.md](https://github.com/openlit/openlit/blob/main/sdk/go/README.md)\n\n### 集成流程\n\n完整的集成流程如下：\n\n1. 启动 OpenLIT 基础设施栈（包含 OpenTelemetry Collector、存储和可视化组件）\n2. 在应用服务器上部署 GPU Collector 并配置 OTLP 端点\n3. 在应用代码中集成 OpenLIT SDK，配置相同的 OTLP 端点\n4. 在 OpenLIT Dashboard 中查看追踪和指标数据\n\n```mermaid\ngraph LR\n    A[应用代码 + SDK] -->|OTLP Traces| B[OpenTelemetry Collector]\n    C[GPU Collector] -->|OTLP Metrics| B\n    B --> D[OpenLIT Backend]\n    D --> E[Dashboard]\n```\n\n## 技术依赖\n\nGPU Collector 的正常运行依赖以下技术组件：\n\n| 组件 | 用途 | 平台支持 |\n|-----|------|---------|\n| NVML | NVIDIA GPU 管理接口 | NVIDIA GPU |\n| sysfs/hwmon | Linux 硬件传感器接口 | AMD、Intel GPU |\n| eBPF | 内核级追踪 | Linux 4.x+ |\n| OpenTelemetry Collector | 指标导出协议 | 全平台 |\n\n## 许可说明\n\nOpenTelemetry GPU Collector 由 OpenLIT 团队构建和维护，采用 Apache-2.0 开源许可证。资料来源：[opentelemetry-gpu-collector/README.md](https://github.com/openlit/openlit/blob/main/opentelemetry-gpu-collector/README.md)\n\n---\n\n---\n\n## Doramagic 踩坑日志\n\n项目：openlit/openlit\n\n摘要：发现 15 个潜在踩坑项，其中 0 个为 high/blocking；最高优先级：安装坑 - 来源证据：Integration: Governance and compliance signals for LLM observability。\n\n## 1. 安装坑 · 来源证据：Integration: Governance and compliance signals for LLM observability\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个安装相关的待验证问题：Integration: Governance and compliance signals for LLM observability\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_16e8a1979e4646f18ae6d36da1fd46fe | https://github.com/openlit/openlit/issues/1106 | 来源类型 github_issue 暴露的待验证使用条件。\n\n## 2. 安装坑 · 来源证据：Proposal: gen_ai.agent.threat_detected span event helper for OTel-shaped detection observability\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个安装相关的待验证问题：Proposal: gen_ai.agent.threat_detected span event helper for OTel-shaped detection observability\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源问题仍为 open，Pack Agent 需要复核是否仍影响当前版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_9788255c9fb34a7eae64ba6413a52030 | https://github.com/openlit/openlit/issues/1186 | 来源讨论提到 python 相关条件，需在安装/试用前复核。\n\n## 3. 安装坑 · 来源证据：[Bug]: Docker Image doesn't run on windows 64bit\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个安装相关的待验证问题：[Bug]: Docker Image doesn't run on windows 64bit\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_e25a08120daf4deb81b9193aeab1f929 | https://github.com/openlit/openlit/issues/786 | 来源讨论提到 docker 相关条件，需在安装/试用前复核。\n\n## 4. 安装坑 · 来源证据：openlit-1.19.0\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个安装相关的待验证问题：openlit-1.19.0\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_0504e467960f4bbe919ff101c6a14d7b | https://github.com/openlit/openlit/releases/tag/openlit-1.19.0 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 5. 配置坑 · 来源证据：controller-0.2.0\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个配置相关的待验证问题：controller-0.2.0\n- 对用户的影响：可能影响升级、迁移或版本选择。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_addec19eec37420da207487d5a685eaa | https://github.com/openlit/openlit/releases/tag/controller-0.2.0 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 6. 配置坑 · 来源证据：openlit-1.20.0\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个配置相关的待验证问题：openlit-1.20.0\n- 对用户的影响：可能影响升级、迁移或版本选择。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_217968c917e9426f9f8fbb4b50bebdb5 | https://github.com/openlit/openlit/releases/tag/openlit-1.20.0 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 7. 能力坑 · 能力判断依赖假设\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：README/documentation is current enough for a first validation pass.\n- 对用户的影响：假设不成立时，用户拿不到承诺的能力。\n- 建议检查：将假设转成下游验证清单。\n- 防护动作：假设必须转成验证项；没有验证结果前不能写成事实。\n- 证据：capability.assumptions | github_repo:747319327 | https://github.com/openlit/openlit | README/documentation is current enough for a first validation pass.\n\n## 8. 维护坑 · 维护活跃度未知\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：未记录 last_activity_observed。\n- 对用户的影响：新项目、停更项目和活跃项目会被混在一起，推荐信任度下降。\n- 建议检查：补 GitHub 最近 commit、release、issue/PR 响应信号。\n- 防护动作：维护活跃度未知时，推荐强度不能标为高信任。\n- 证据：evidence.maintainer_signals | github_repo:747319327 | https://github.com/openlit/openlit | last_activity_observed missing\n\n## 9. 安全/权限坑 · 下游验证发现风险项\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：no_demo\n- 对用户的影响：下游已经要求复核，不能在页面中弱化。\n- 建议检查：进入安全/权限治理复核队列。\n- 防护动作：下游风险存在时必须保持 review/recommendation 降级。\n- 证据：downstream_validation.risk_items | github_repo:747319327 | https://github.com/openlit/openlit | no_demo; severity=medium\n\n## 10. 安全/权限坑 · 存在评分风险\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：no_demo\n- 对用户的影响：风险会影响是否适合普通用户安装。\n- 建议检查：把风险写入边界卡，并确认是否需要人工复核。\n- 防护动作：评分风险必须进入边界卡，不能只作为内部分数。\n- 证据：risks.scoring_risks | github_repo:747319327 | https://github.com/openlit/openlit | no_demo; severity=medium\n\n## 11. 安全/权限坑 · 来源证据：Bug: OpenAI API key in operator example test-application is not using OPENAI_API_KEY env var\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个安全/权限相关的待验证问题：Bug: OpenAI API key in operator example test-application is not using OPENAI_API_KEY env var\n- 对用户的影响：可能影响授权、密钥配置或安全边界。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_bfba0945570d4cbbaead1257e8f70dfe | https://github.com/openlit/openlit/issues/1135 | 来源讨论提到 python 相关条件，需在安装/试用前复核。\n\n## 12. 安全/权限坑 · 来源证据：openlit-1.19.1\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个安全/权限相关的待验证问题：openlit-1.19.1\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_b5088506959947828f2d740f9297d5b5 | https://github.com/openlit/openlit/releases/tag/openlit-1.19.1 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 13. 安全/权限坑 · 来源证据：py-1.41.2\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个安全/权限相关的待验证问题：py-1.41.2\n- 对用户的影响：可能影响授权、密钥配置或安全边界。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_ff3f4dfa2dc04616be73482b2145ac5c | https://github.com/openlit/openlit/releases/tag/py-1.41.2 | 来源讨论提到 docker 相关条件，需在安装/试用前复核。\n\n## 14. 维护坑 · issue/PR 响应质量未知\n\n- 严重度：low\n- 证据强度：source_linked\n- 发现：issue_or_pr_quality=unknown。\n- 对用户的影响：用户无法判断遇到问题后是否有人维护。\n- 建议检查：抽样最近 issue/PR，判断是否长期无人处理。\n- 防护动作：issue/PR 响应未知时，必须提示维护风险。\n- 证据：evidence.maintainer_signals | github_repo:747319327 | https://github.com/openlit/openlit | issue_or_pr_quality=unknown\n\n## 15. 维护坑 · 发布节奏不明确\n\n- 严重度：low\n- 证据强度：source_linked\n- 发现：release_recency=unknown。\n- 对用户的影响：安装命令和文档可能落后于代码，用户踩坑概率升高。\n- 建议检查：确认最近 release/tag 和 README 安装命令是否一致。\n- 防护动作：发布节奏未知或过期时，安装说明必须标注可能漂移。\n- 证据：evidence.maintainer_signals | github_repo:747319327 | https://github.com/openlit/openlit | release_recency=unknown\n\n<!-- canonical_name: openlit/openlit; human_manual_source: deepwiki_human_wiki -->\n",
      "summary": "DeepWiki/Human Wiki 完整输出，末尾追加 Discovery Agent 踩坑日志。",
      "title": "Human Manual / 人类版说明书"
    },
    "pitfall_log": {
      "asset_id": "pitfall_log",
      "filename": "PITFALL_LOG.md",
      "markdown": "# Pitfall Log / 踩坑日志\n\n项目：openlit/openlit\n\n摘要：发现 15 个潜在踩坑项，其中 0 个为 high/blocking；最高优先级：安装坑 - 来源证据：Integration: Governance and compliance signals for LLM observability。\n\n## 1. 安装坑 · 来源证据：Integration: Governance and compliance signals for LLM observability\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个安装相关的待验证问题：Integration: Governance and compliance signals for LLM observability\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_16e8a1979e4646f18ae6d36da1fd46fe | https://github.com/openlit/openlit/issues/1106 | 来源类型 github_issue 暴露的待验证使用条件。\n\n## 2. 安装坑 · 来源证据：Proposal: gen_ai.agent.threat_detected span event helper for OTel-shaped detection observability\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个安装相关的待验证问题：Proposal: gen_ai.agent.threat_detected span event helper for OTel-shaped detection observability\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源问题仍为 open，Pack Agent 需要复核是否仍影响当前版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_9788255c9fb34a7eae64ba6413a52030 | https://github.com/openlit/openlit/issues/1186 | 来源讨论提到 python 相关条件，需在安装/试用前复核。\n\n## 3. 安装坑 · 来源证据：[Bug]: Docker Image doesn't run on windows 64bit\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个安装相关的待验证问题：[Bug]: Docker Image doesn't run on windows 64bit\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_e25a08120daf4deb81b9193aeab1f929 | https://github.com/openlit/openlit/issues/786 | 来源讨论提到 docker 相关条件，需在安装/试用前复核。\n\n## 4. 安装坑 · 来源证据：openlit-1.19.0\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个安装相关的待验证问题：openlit-1.19.0\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_0504e467960f4bbe919ff101c6a14d7b | https://github.com/openlit/openlit/releases/tag/openlit-1.19.0 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 5. 配置坑 · 来源证据：controller-0.2.0\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个配置相关的待验证问题：controller-0.2.0\n- 对用户的影响：可能影响升级、迁移或版本选择。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_addec19eec37420da207487d5a685eaa | https://github.com/openlit/openlit/releases/tag/controller-0.2.0 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 6. 配置坑 · 来源证据：openlit-1.20.0\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个配置相关的待验证问题：openlit-1.20.0\n- 对用户的影响：可能影响升级、迁移或版本选择。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_217968c917e9426f9f8fbb4b50bebdb5 | https://github.com/openlit/openlit/releases/tag/openlit-1.20.0 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 7. 能力坑 · 能力判断依赖假设\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：README/documentation is current enough for a first validation pass.\n- 对用户的影响：假设不成立时，用户拿不到承诺的能力。\n- 建议检查：将假设转成下游验证清单。\n- 防护动作：假设必须转成验证项；没有验证结果前不能写成事实。\n- 证据：capability.assumptions | github_repo:747319327 | https://github.com/openlit/openlit | README/documentation is current enough for a first validation pass.\n\n## 8. 维护坑 · 维护活跃度未知\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：未记录 last_activity_observed。\n- 对用户的影响：新项目、停更项目和活跃项目会被混在一起，推荐信任度下降。\n- 建议检查：补 GitHub 最近 commit、release、issue/PR 响应信号。\n- 防护动作：维护活跃度未知时，推荐强度不能标为高信任。\n- 证据：evidence.maintainer_signals | github_repo:747319327 | https://github.com/openlit/openlit | last_activity_observed missing\n\n## 9. 安全/权限坑 · 下游验证发现风险项\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：no_demo\n- 对用户的影响：下游已经要求复核，不能在页面中弱化。\n- 建议检查：进入安全/权限治理复核队列。\n- 防护动作：下游风险存在时必须保持 review/recommendation 降级。\n- 证据：downstream_validation.risk_items | github_repo:747319327 | https://github.com/openlit/openlit | no_demo; severity=medium\n\n## 10. 安全/权限坑 · 存在评分风险\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：no_demo\n- 对用户的影响：风险会影响是否适合普通用户安装。\n- 建议检查：把风险写入边界卡，并确认是否需要人工复核。\n- 防护动作：评分风险必须进入边界卡，不能只作为内部分数。\n- 证据：risks.scoring_risks | github_repo:747319327 | https://github.com/openlit/openlit | no_demo; severity=medium\n\n## 11. 安全/权限坑 · 来源证据：Bug: OpenAI API key in operator example test-application is not using OPENAI_API_KEY env var\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个安全/权限相关的待验证问题：Bug: OpenAI API key in operator example test-application is not using OPENAI_API_KEY env var\n- 对用户的影响：可能影响授权、密钥配置或安全边界。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_bfba0945570d4cbbaead1257e8f70dfe | https://github.com/openlit/openlit/issues/1135 | 来源讨论提到 python 相关条件，需在安装/试用前复核。\n\n## 12. 安全/权限坑 · 来源证据：openlit-1.19.1\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个安全/权限相关的待验证问题：openlit-1.19.1\n- 对用户的影响：可能增加新用户试用和生产接入成本。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_b5088506959947828f2d740f9297d5b5 | https://github.com/openlit/openlit/releases/tag/openlit-1.19.1 | 来源类型 github_release 暴露的待验证使用条件。\n\n## 13. 安全/权限坑 · 来源证据：py-1.41.2\n\n- 严重度：medium\n- 证据强度：source_linked\n- 发现：GitHub 社区证据显示该项目存在一个安全/权限相关的待验证问题：py-1.41.2\n- 对用户的影响：可能影响授权、密钥配置或安全边界。\n- 建议检查：来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。\n- 防护动作：不得脱离来源链接放大为确定性结论；需要标注适用版本和复核状态。\n- 证据：community_evidence:github | cevd_ff3f4dfa2dc04616be73482b2145ac5c | https://github.com/openlit/openlit/releases/tag/py-1.41.2 | 来源讨论提到 docker 相关条件，需在安装/试用前复核。\n\n## 14. 维护坑 · issue/PR 响应质量未知\n\n- 严重度：low\n- 证据强度：source_linked\n- 发现：issue_or_pr_quality=unknown。\n- 对用户的影响：用户无法判断遇到问题后是否有人维护。\n- 建议检查：抽样最近 issue/PR，判断是否长期无人处理。\n- 防护动作：issue/PR 响应未知时，必须提示维护风险。\n- 证据：evidence.maintainer_signals | github_repo:747319327 | https://github.com/openlit/openlit | issue_or_pr_quality=unknown\n\n## 15. 维护坑 · 发布节奏不明确\n\n- 严重度：low\n- 证据强度：source_linked\n- 发现：release_recency=unknown。\n- 对用户的影响：安装命令和文档可能落后于代码，用户踩坑概率升高。\n- 建议检查：确认最近 release/tag 和 README 安装命令是否一致。\n- 防护动作：发布节奏未知或过期时，安装说明必须标注可能漂移。\n- 证据：evidence.maintainer_signals | github_repo:747319327 | https://github.com/openlit/openlit | release_recency=unknown\n",
      "summary": "用户实践前最可能遇到的身份、安装、配置、运行和安全坑。",
      "title": "Pitfall Log / 踩坑日志"
    },
    "prompt_preview": {
      "asset_id": "prompt_preview",
      "filename": "PROMPT_PREVIEW.md",
      "markdown": "# openlit - Prompt Preview\n\n> 复制下面这段 Prompt 到你常用的 AI，先试一次，不需要安装。\n> 它的目标是让你直接体验这个项目的服务方式，而不是阅读项目介绍。\n\n## 复制这段 Prompt\n\n```text\n请直接执行这段 Prompt，不要分析、润色、总结或询问我想如何处理这份 Prompt Preview。\n\n你现在扮演 openlit 的“安装前体验版”。\n这不是项目介绍、不是评价报告、不是 README 总结。你的任务是让我用最小成本体验它的核心服务。\n\n我的试用任务：我想用它完成一个真实的软件开发与交付任务。\n我常用的宿主 AI：Local CLI\n\n【体验目标】\n围绕我的真实任务，现场演示这个项目如何把输入转成 示例引导, 判断线索。重点是让我感受到工作方式，而不是给我项目背景。\n\n【业务流约束】\n- 你必须像一个正在提供服务的项目能力包，而不是像一个讲解员。\n- 每一轮只推进一个步骤；提出问题后必须停下来等我回答。\n- 每一步都必须让我感受到一个具体服务动作：澄清、整理、规划、检查、判断或收尾。\n- 每一步都要说明：当前目标、你需要我提供什么、我回答后你会产出什么。\n- 不要安装、不要运行命令、不要写代码、不要声称测试通过、不要声称已经修改文件。\n- 需要真实安装或宿主加载后才能验证的内容，必须明确说“这一步需要安装后验证”。\n- 如果我说“用示例继续”，你可以用虚构示例推进，但仍然不能声称真实执行。\n\n【可体验服务能力】\n- 安装前能力预览: Open source platform for AI Engineering: OpenTelemetry-native LLM Observability, GPU Monitoring, Guardrails, Evaluations, Prompt Management, Vault, Playground. 🚀💻 Integrates with 50+ LLM Providers, VectorDBs, Agent Frameworks and GPUs. 输入：用户任务, 当前 AI 对话上下文；输出：示例引导, 判断线索。\n\n【必须安装后才可验证的能力】\n- 命令行启动或安装流程: 项目文档中存在可执行命令，真实使用需要在本地或宿主环境中运行这些命令。 输入：终端环境, 包管理器, 项目依赖；输出：安装结果, 列表/更新/运行结果。\n\n【核心服务流】\n请严格按这个顺序带我体验。不要一次性输出完整流程：\n1. project-overview：项目概述。围绕“项目概述”模拟一次用户任务，不展示安装或运行结果。\n2. system-architecture：系统架构。围绕“系统架构”模拟一次用户任务，不展示安装或运行结果。\n3. python-sdk：Python SDK。围绕“Python SDK”模拟一次用户任务，不展示安装或运行结果。\n4. observability：可观测性功能。围绕“可观测性功能”模拟一次用户任务，不展示安装或运行结果。\n5. evaluations：评估功能。围绕“评估功能”模拟一次用户任务，不展示安装或运行结果。\n\n【核心能力体验剧本】\n每一步都必须按“输入 -> 服务动作 -> 中间产物”执行。不要只说流程名：\n1. project-overview\n输入：用户提供的“项目概述”相关信息。\n服务动作：模拟项目在这一步的核心判断和整理方式。\n中间产物：一个可检查的小结果。\n\n2. system-architecture\n输入：用户提供的“系统架构”相关信息。\n服务动作：模拟项目在这一步的核心判断和整理方式。\n中间产物：一个可检查的小结果。\n\n3. python-sdk\n输入：用户提供的“Python SDK”相关信息。\n服务动作：模拟项目在这一步的核心判断和整理方式。\n中间产物：一个可检查的小结果。\n\n4. observability\n输入：用户提供的“可观测性功能”相关信息。\n服务动作：模拟项目在这一步的核心判断和整理方式。\n中间产物：一个可检查的小结果。\n\n5. evaluations\n输入：用户提供的“评估功能”相关信息。\n服务动作：模拟项目在这一步的核心判断和整理方式。\n中间产物：一个可检查的小结果。\n\n【项目服务规则】\n这些规则决定你如何服务用户。不要解释规则本身，而要在每一步执行时遵守：\n- 先确认用户任务、输入材料和成功标准，再模拟项目能力。\n- 每一步都必须形成可检查的小产物，并等待用户确认后再继续。\n- 凡是需要安装、调用工具或访问外部服务的能力，都必须标记为安装后验证。\n\n【每一步的服务约束】\n- Step 1 / project-overview：Step 1 必须围绕“项目概述”形成一个小中间产物，并等待用户确认。\n- Step 2 / system-architecture：Step 2 必须围绕“系统架构”形成一个小中间产物，并等待用户确认。\n- Step 3 / python-sdk：Step 3 必须围绕“Python SDK”形成一个小中间产物，并等待用户确认。\n- Step 4 / observability：Step 4 必须围绕“可观测性功能”形成一个小中间产物，并等待用户确认。\n- Step 5 / evaluations：Step 5 必须围绕“评估功能”形成一个小中间产物，并等待用户确认。\n\n【边界与风险】\n- 不要声称已经安装、运行、调用 API、读写本地文件或完成真实任务。\n- 安装前预览只能展示工作方式，不能证明兼容性、性能或输出质量。\n- 涉及安装、插件加载、工具调用或外部服务的能力必须安装后验证。\n\n【可追溯依据】\n这些路径只用于你内部校验或在我追问“依据是什么”时简要引用。不要在首次回复主动展开：\n- https://github.com/openlit/openlit\n- https://github.com/openlit/openlit#readme\n- README.md\n- docker-compose.yml\n- src/dev-docker-compose.yml\n- src/client/prisma/schema.prisma\n- sdk/python/src/openlit/__init__.py\n- sdk/python/src/openlit/_instrumentors.py\n- sdk/python/pyproject.toml\n- sdk/python/src/openlit/otel/tracing.py\n- sdk/python/src/openlit/otel/metrics.py\n- sdk/python/src/openlit/otel/events.py\n\n【首次问题规则】\n- 首次三问必须先确认用户目标、成功标准和边界，不要提前进入工具、安装或实现细节。\n- 如果后续需要技术条件、文件路径或运行环境，必须等用户确认目标后再追问。\n\n首次回复必须只输出下面 4 个部分：\n1. 体验开始：用 1 句话说明你将带我体验 openlit 的核心服务。\n2. 当前步骤：明确进入 Step 1，并说明这一步要解决什么。\n3. 你会如何服务我：说明你会先改变我完成任务的哪个动作。\n4. 只问我 3 个问题，然后停下等待回答。\n\n首次回复禁止输出：后续完整流程、证据清单、安装命令、项目评价、营销文案、已经安装或运行的说法。\n\nStep 1 / brainstorming 的二轮协议：\n- 我回答首次三问后，你仍然停留在 Step 1 / brainstorming，不要进入 Step 2。\n- 第二次回复必须产出 6 个部分：澄清后的任务定义、成功标准、边界条件、\n  2-3 个可选方案、每个方案的权衡、推荐方案。\n- 第二次回复最后必须问我是否确认推荐方案；只有我明确确认后，才能进入下一步。\n- 第二次回复禁止输出 git worktree、代码计划、测试文件、命令或真实执行结果。\n\n后续对话规则：\n- 我回答后，你先完成当前步骤的中间产物并等待确认；只有我确认后，才能进入下一步。\n- 每一步都要生成一个小的中间产物，例如澄清后的目标、计划草案、测试意图、验证清单或继续/停止判断。\n- 所有演示都写成“我会建议/我会引导/这一步会形成”，不要写成已经真实执行。\n- 不要声称已经测试通过、文件已修改、命令已运行或结果已产生。\n- 如果某个能力必须安装后验证，请直接说“这一步需要安装后验证”。\n- 如果证据不足，请明确说“证据不足”，不要补事实。\n```\n",
      "summary": "不安装项目也能感受能力节奏的安全试用 Prompt。",
      "title": "Prompt Preview / 安装前试用 Prompt"
    },
    "quick_start": {
      "asset_id": "quick_start",
      "filename": "QUICK_START.md",
      "markdown": "# Quick Start / 官方入口\n\n项目：openlit/openlit\n\n## 官方安装入口\n\n### Python / pip · 官方安装入口\n\n```bash\npip install openlit\n```\n\n来源：https://github.com/openlit/openlit#readme\n\n## 来源\n\n- repo: https://github.com/openlit/openlit\n- docs: https://github.com/openlit/openlit#readme\n",
      "summary": "从项目官方 README 或安装文档提取的开工入口。",
      "title": "Quick Start / 官方入口"
    }
  },
  "validation_id": "dval_bc021b9f126d4942b10ce3ce4d4df599"
}
