Chuyển đến nội dung
Skillpedia
Agent14k · #11273

integrate

Skill này làm gì

Skill này thêm giám sát Olakai vào một agent hoặc ứng dụng LLM AI đang hoạt động. Skill dành cho lập trình viên muốn theo dõi mức sử dụng và kết quả kinh doanh của các tính năng AI.

Khi nào nên dùng

  • ✓Khi bạn có một ứng dụng AI đang chạy và muốn theo dõi hiệu quả của nó.
  • ✓Khi bạn muốn thiết lập KPI tùy chỉnh như số mục đã xử lý hoặc tỷ lệ thành công.
  • ✓Khi bạn cần kiểm tra giám sát hoạt động từ đầu đến cuối.

Liên kết skill

https://github.com/andrewyng/context-hub/blob/main/content/olakai/skills/integrate/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/andrewyng/context-hub/blob/main/content/olakai/skills/integrate/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tôi muốn thêm giám sát Olakai vào chatbot OpenAI hiện có của mình và thiết lập hai KPI.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent bọc client LLM bằng SDK Olakai, thiết lập một vài KPI cho agent này, rồi chạy kiểm tra để xác nhận dữ liệu được gửi đến. Agent dùng Olakai CLI để thiết lập.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Integrate Olakai into Existing AI Code

This skill guides you through adding Olakai monitoring to an existing AI agent or LLM-powered application with minimal code changes.

For full SDK documentation, see: https://app.olakai.ai/llms.txt

Prerequisites

  • Existing working AI agent/application using OpenAI, Anthropic, or other LLM
  • Olakai CLI installed and authenticated (npm install -g olakai-cli && olakai login)
  • Olakai API key for your agent (get via CLI: olakai agents get AGENT_ID --json | jq '.apiKey')
  • Node.js 18+ (for TypeScript) or Python 3.7+ (for Python)

Note: Each agent can have its own API key. Create one with olakai agents create --name "Name" --with-api-key

Why Custom KPIs Are Essential

Adding monitoring is only the first step. The real value of Olakai comes from tracking custom KPIs specific to your agent's business purpose.

Without KPIs configured:

  • Only basic token counts and request data
  • No aggregated business KPIs on dashboard
  • No alerting capabilities
  • No ROI tracking

With KPIs configured:

  • Custom KPIs (items processed, success rates, quality scores)
  • Trend analysis and performance dashboards
  • Threshold-based alerting
  • Business value calculations

Plan to configure at least 2-4 KPIs that answer: "How do I know this agent is performing well?"

KPIs are unique per agent. If adding monitoring to an agent that needs the same KPIs as another already-configured agent, you must still create new KPI definitions for this agent. KPIs cannot be shared or reused across agents.

Understanding the customData to KPI Pipeline

Before adding monitoring, understand how custom data flows through Olakai:

SDK customData → CustomDataConfig (Schema) → Context Variable → KPI Formula → kpiData

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)

IMPORTANT: The SDK accepts any JSON in customData, but only fields registered as CustomDataConfigs are processed. Unregistered fields are stored but cannot be used in KPIs.

Quick Start (5-Minute Integration)

For TypeScript/JavaScript

1. Install the SDK:

npm install @olakai/sdk

2. Add tracking after your LLM call:

Before:

import OpenAI from "openai";
const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });

const response = await openai.chat.completions.create({
  model: "gpt-4o",
  messages: [{ role: "user", content: userMessage }],
});

After:

import OpenAI from "openai";
import { olakaiConfig, olakai } from "@olakai/sdk";

olakaiConfig({ apiKey: process.env.OLAKAI_API_KEY });

const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });

const response = await openai.chat.completions.create({
  model: "gpt-4o",
  messages: [{ role: "user", content: userMessage }],
});

// Track the interaction (fire-and-forget)
olakai("event", "ai_activity", {
  prompt: userMessage,
  response: response.choices[0].message.content,
  tokens: response.usage?.total_tokens,
  userEmail: user.email,
  task: "Customer Experience",
});

For Python

1. Install the SDK:

pip install olakai-sdk

2. Add tracking after your LLM call:

Before:

from openai import OpenAI
client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": user_message}],
)

After:

from openai import OpenAI
from olakaisdk import olakai_config, olakai, OlakaiEventParams

olakai_config(os.getenv("OLAKAI_API_KEY"))
client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": user_message}],
)

# Track the interaction
olakai("event", "ai_activity", OlakaiEventParams(
    prompt=user_message,
    response=response.choices[0].message.content,
    tokens=response.usage.total_tokens,
    userEmail=user.email,
    task="Customer Experience",
))

Detailed Integration Guide

Step 1: Identify Your Integration Pattern

Pattern A: Single LLM Client You have one OpenAI/Anthropic client used throughout your app. Use the fire

Câu hỏi thường gặp

Tôi nên thiết lập bao nhiêu KPI?

Skill gợi ý lên kế hoạch ít nhất hai đến bốn KPI cho mỗi agent.

KPI có thể chia sẻ giữa các agent không?

Không. Skill nói mỗi agent cần định nghĩa KPI riêng.

Tôi cần chuẩn bị gì trước khi bắt đầu?

Một tài khoản đăng nhập Olakai CLI, một khóa API của agent, và Node.js 18 hoặc Python 3.7 trở lên.

Chi tiết

Mô tả gốc của tác giả

Add Olakai monitoring to existing AI code — wrap your LLM client, configure custom KPIs, and validate the integration end-to-end

repo: andrewyng/context-hub

Độ phổ biến

Sao GitHub
14k
Vị trí xếp hạng
#11273
Giấy phép
MIT
Cập nhật
31/5/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự