new-project
它能做什么
这项技能指导创建一个从一开始就连接到 Olakai 的新 AI 智能体项目。适合希望在上线前就具备分析和管控能力的构建者。
适用场景
- ✓当你开始一个新的 AI 智能体,并希望从第一天起就有监控的时候。
- ✓当你想获得 Olakai SDK 和 CLI 的引导式设置的时候。
- ✓当你需要定义能体现智能体表现的 KPI 的时候。
技能链接
https://github.com/andrewyng/context-hub/blob/main/content/olakai/skills/new-project/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我想启动一个带有 Olakai 监控的新 AI 智能体项目,并定义它的 KPI。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会搭建项目、添加 Olakai SDK、为智能体创建密钥、定义 KPI,并测试结果。它会按固定的顺序遵循该技能中的步骤。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Build a New AI Agent Project with Olakai
This skill guides you through creating a new AI agent that is fully integrated with Olakai for analytics, KPI tracking, and governance.
Prerequisites
Before starting, ensure:
- Olakai CLI installed:
npm install -g olakai-cli - CLI authenticated:
olakai login - API key for SDK (generated per-agent via CLI — see Step 2.2)
Why Custom KPIs Are Essential
Olakai's core value is tracking business-specific KPIs for your AI agents. Without KPIs, you're tracking events without gaining actionable insights.
What you can measure with KPIs:
- Business outcomes (items processed, success rates, revenue impact)
- Operational data (step counts, retry rates, execution time)
- Quality indicators (error rates, user satisfaction signals)
Without KPIs configured:
- No dashboard KPIs beyond basic token counts
- No aggregated performance views
- No alerting thresholds
- No ROI calculations
Every agent should have 2-4 KPIs that answer: "How do I know this agent is performing well?"
KPIs created here belong to this specific agent only. If you later create additional agents, each one needs its own KPI definitions — KPIs cannot be shared or reused across agents.
Understanding the customData to KPI Pipeline
Before diving into implementation, understand how data flows through Olakai:
SDK customData → CustomDataConfig (Schema) → Context Variable → KPI Formula → kpiData
How It Works
- customData (SDK): Raw JSON you send with each event
- CustomDataConfig (Platform): Schema defining which fields are processed
- Context Variables: CustomDataConfig fields become available for formulas
- KPI Formula: Expression that computes a value (e.g.,
SuccessRate * 100) - kpiData (Response): Computed KPI values returned with each event
Critical Rules
| Rule | Consequence |
|---|---|
| Only CustomDataConfig fields become variables | Unregistered customData fields are NOT usable in KPIs |
| Formula evaluation is case-insensitive | stepCount, STEPCOUNT, StepCount all work in formulas |
| NUMBER configs need numeric values | Don't send "5" (string), send 5 (number) |
| KPIs are unique per agent | Each KPI belongs to exactly one agent — create separately for each |
Built-in Context Variables (Always Available)
| Variable | Type | Description |
|---|---|---|
Prompt |
string | The prompt text sent to the LLM |
Response |
string | The LLM response text |
Documents count |
number | Number of attached documents |
PII detected |
boolean | Whether PII was detected |
PHI detected |
boolean | Whether PHI was detected |
CODE detected |
boolean | Whether code was detected |
SECRET detected |
boolean | Whether secrets were detected |
Step 1: Design the Agent Architecture
1.1 Determine Agent Type
Agentic AI (Multi-step autonomous workflows):
- Research agents, document processors, data pipelines
- Track as SINGLE events aggregating all internal LLM calls
- Focus on workflow-level KPIs (total tokens, total time, success/failure)
Assistive AI (Interactive chatbots/copilots):
- Customer support agents, coding assistants, Q&A systems
- Track EACH interaction as separate events
- Focus on conversation-level KPIs (per-message tokens, response quality)
1.2 Design Your KPI Schema (CRITICAL)
Design your KPIs BEFORE writing any SDK code. This ensures only meaningful data is sent and tracked.
Step A: Identify Business Questions
What do stakeholders need to know about this agent?
- "How many items does it process per run?"
- "What's the success/failure rate?"
- "How efficient is each execution?"
Step B: Map Questions to Data Fields
| Business Question | Field Name | Type | KPI Formula | Aggregation |
|---|---|---|---|---|
| Throughput | ItemsProcessed | NUMBER | ItemsProcessed |
SUM |
| Reliability | SuccessRate | NUMBER | SuccessRate * 100 |
AVERAGE |
| Error count | SuccessRate | NUMBER | IF(SuccessRate < 1, 1, 0) |
SUM |
| Correlation | ExecutionId | STRING | (for filtering only) | - |
Step C: Plan Your customData Structure
// ONLY include fields you'll register as CustomDataConfigs
customData: {
// Business KPIs
ItemsProcessed: number, // Count of items handled
SuccessRate: number, // 0-1 success ratio
// Performance KPIs
StepCount: number,
常见问题
开始之前需要先安装 CLI 吗?
需要。该技能要求已安装 Olakai CLI,并且你已登录。
这项技能中的 KPI 是什么?
KPI 是一项业务指标,例如处理的条目数、成功率或重试率,用来显示智能体的表现。
我可以把同样的 KPI 用于另一个智能体吗?
不可以。KPI 属于某一个智能体,因此每个新智能体都需要自己的一套。
详情
作者的原始描述
Build a new AI agent with Olakai monitoring from scratch — project setup, SDK integration, KPI configuration, and end-to-end validation
repo: andrewyng/context-hub
热度
- GitHub 星标
- 14k
- 排名
- #11274
- 许可证
- MIT
- 更新时间
- 2026/5/31
评论
- …
同一仓库的更多技能
get-api-docs
14k帮你的智能体在编写代码之前获取第三方 API 和库的最新文档,而不是依赖旧的记忆。
bloc-cubit
14k教你的智能体如何用 Bloc 或 Cubit 管理 Flutter 应用的状态,包括何时选择哪一个,以及便于测试的安全默认设置。
riverpod
14k教你的智能体如何用 Riverpod 管理 Flutter 应用的状态,涵盖 provider、异步数据和测试,并为每种情况提供合理的默认设置。
document-extraction
14k帮你的智能体读取 PDF、图片和电子表格,将其转换为干净的文本,并使用 LandingAI 的 ADE 服务提取发票总额等字段。