generate-analytics-reports

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Generate Analytics Reports

生成分析报告

This skill enables terminal-based analytics report generation using the Olakai CLI, eliminating the need to access the web UI for analytics insights.
For full documentation, see: https://app.olakai.ai/llms.txt
本技能支持使用Olakai CLI在终端中生成分析报告,无需访问Web UI即可获取分析洞察。
完整文档请查看:https://app.olakai.ai/llms.txt

Prerequisites

前置条件

Before generating reports, ensure:
bash
undefined
在生成报告前,请确保:
bash
undefined

1. CLI is authenticated

1. CLI已完成认证

olakai whoami
olakai whoami

2. You have the agent ID (if reporting on specific agent)

2. 拥有Agent ID(如果要针对特定Agent生成报告)

olakai agents list --json | jq '.[] | {id, name}'

---
olakai agents list --json | jq '.[] | {id, name}'

---

Report Generation Workflow

报告生成流程

  1. Gather context - Determine agent ID, date range, and report type
  2. Query data - Use CLI commands with
    --json
    flag
  3. Process output - Extract relevant metrics using
    jq
  4. Generate visualizations - Create ASCII charts and markdown tables
  5. Present report - Format and display the complete report

  1. 收集上下文 - 确定Agent ID、日期范围和报告类型
  2. 查询数据 - 使用带
    --json
    参数的CLI命令
  3. 处理输出 - 使用
    jq
    提取相关指标
  4. 生成可视化 - 创建ASCII图表和Markdown表格
  5. 展示报告 - 格式化并显示完整报告

Available Data Sources

可用数据源

CommandData Retrieved
olakai activity list --json
Events with tokens, model, risk, status
olakai activity list --include-analytics --json
+ task, subtask, time saved, risk score
olakai activity kpis --json
Core KPIs (executions, compliance, ROI) + custom KPIs
olakai activity kpis --period daily --json
Time-series breakdown
olakai activity kpis --include-atoms --json
Per-event KPI values
olakai agents list --json
Agent metadata
olakai kpis list --json
KPI definitions

命令获取的数据
olakai activity list --json
包含Token、模型、风险、状态的事件
olakai activity list --include-analytics --json
+ 任务、子任务、节省时间、风险评分
olakai activity kpis --json
核心KPI(执行次数、合规性、ROI)+ 自定义KPI
olakai activity kpis --period daily --json
时间序列细分数据
olakai activity kpis --include-atoms --json
单事件KPI值
olakai agents list --json
Agent元数据
olakai kpis list --json
KPI定义

Report Type 1: Usage Summary Report

报告类型1:使用情况摘要报告

Shows total usage metrics across events, tokens, models, and agents.
展示跨事件、Token、模型和Agent的总使用指标。

Data Collection

数据收集

bash
undefined
bash
undefined

Get recent events with analytics

获取包含分析数据的近期事件

olakai activity list --limit 100 --include-analytics --json > /tmp/events.json
olakai activity list --limit 100 --include-analytics --json > /tmp/events.json

Extract summary metrics

提取摘要指标

cat /tmp/events.json | jq '{ total_events: (.prompts | length), total_tokens: ([.prompts[].tokens // 0] | add), avg_tokens: ([.prompts[].tokens // 0] | add / length | floor), unique_models: ([.prompts[].model] | unique | length), models: ([.prompts[].model] | group_by(.) | map({model: .[0], count: length})), unique_agents: ([.prompts[].app] | unique | length), agents: ([.prompts[].app] | group_by(.) | map({agent: .[0], count: length})), success_rate: (([.prompts[] | select(.status != "error")] | length) / (.prompts | length) * 100 | floor) }'
undefined
cat /tmp/events.json | jq '{ total_events: (.prompts | length), total_tokens: ([.prompts[].tokens // 0] | add), avg_tokens: ([.prompts[].tokens // 0] | add / length | floor), unique_models: ([.prompts[].model] | unique | length), models: ([.prompts[].model] | group_by(.) | map({model: .[0], count: length})), unique_agents: ([.prompts[].app] | unique | length), agents: ([.prompts[].app] | group_by(.) | map({agent: .[0], count: length})), success_rate: (([.prompts[] | select(.status != "error")] | length) / (.prompts | length) * 100 | floor) }'
undefined

Report Template

报告模板

markdown
undefined
markdown
undefined

Usage Summary Report

使用情况摘要报告

Generated: [DATE] Period: Last [N] events
生成时间: [日期] 统计范围: 最近[N]个事件

Overview

概览

MetricValue
Total Events[COUNT]
Total Tokens[TOKENS]
Avg Tokens/Event[AVG]
Success Rate[RATE]%
指标数值
总事件数[COUNT]
总Token数[TOKENS]
平均每个事件Token数[AVG]
成功率[RATE]%

Events by Model

按模型分类的事件数

[ASCII BAR CHART]
[ASCII条形图]

Events by Agent

按Agent分类的事件数

[ASCII BAR CHART]
undefined
[ASCII条形图]
undefined

Example Output

示例输出

undefined
undefined

Usage Summary Report

使用情况摘要报告

Generated: 2025-01-21 Period: Last 100 events
生成时间: 2025-01-21 统计范围: 最近100个事件

Overview

概览

MetricValue
Total Events100
Total Tokens45,230
Avg Tokens/Event452
Success Rate98%
指标数值
总事件数100
总Token数45,230
平均每个事件Token数452
成功率98%

Events by Model

按模型分类的事件数

gpt-4o ████████████████████████████████████ 45 gpt-4o-mini ██████████████████████ 28 claude-3-5 ████████████████ 20 gpt-3.5-turbo █████ 7
gpt-4o ████████████████████████████████████ 45 gpt-4o-mini ██████████████████████ 28 claude-3-5 ████████████████ 20 gpt-3.5-turbo █████ 7

Events by Agent

按Agent分类的事件数

code-assistant ████████████████████████████████ 40 data-analyzer ████████████████████████ 30 chat-support ████████████████████ 25 test-agent ████ 5

---
code-assistant ████████████████████████████████ 40 data-analyzer ████████████████████████ 30 chat-support ████████████████████ 25 test-agent ████ 5

---

Report Type 2: KPI Trends Report

报告类型2:KPI趋势报告

Shows KPI values over time with period-over-period comparisons.
展示KPI值随时间的变化以及同期对比情况。

Data Collection

数据收集

bash
undefined
bash
undefined

Get KPIs with daily breakdown

获取按日细分的KPI数据

olakai activity kpis --period daily --json > /tmp/kpis_daily.json
olakai activity kpis --period daily --json > /tmp/kpis_daily.json

Get KPIs with weekly breakdown

获取按周细分的KPI数据

olakai activity kpis --period weekly --json > /tmp/kpis_weekly.json
olakai activity kpis --period weekly --json > /tmp/kpis_weekly.json

Extract trend data

提取趋势数据

cat /tmp/kpis_daily.json | jq '{ period: "daily", kpis: [.kpis[] | { name: .name, current: .value, trend: .trend, breakdown: .breakdown }] }'
undefined
cat /tmp/kpis_daily.json | jq '{ period: "daily", kpis: [.kpis[] | { name: .name, current: .value, trend: .trend, breakdown: .breakdown }] }'
undefined

For Custom KPIs with Agent Filter

带Agent筛选的自定义KPI

bash
undefined
bash
undefined

Get custom KPIs for specific agent

获取特定Agent的自定义KPI

olakai activity kpis --agent-id AGENT_ID --period daily --json | jq '.kpis'
olakai activity kpis --agent-id AGENT_ID --period daily --json | jq '.kpis'

List KPI definitions

列出KPI定义

olakai kpis list --agent-id AGENT_ID --json | jq '.[] | {name, unit, aggregation}'
undefined
olakai kpis list --agent-id AGENT_ID --json | jq '.[] | {name, unit, aggregation}'
undefined

Report Template

报告模板

markdown
undefined
markdown
undefined

KPI Trends Report

KPI趋势报告

Generated: [DATE] Agent: [AGENT_NAME] (or "All Agents") Period: [PERIOD]
生成时间: [日期] Agent: [AGENT_NAME](或"所有Agent") 统计周期: [PERIOD]

Core KPIs

核心KPI

KPICurrentPreviousChange
Total Executions[VAL][PREV][+/-]%
Compliance Rate[VAL]%[PREV]%[+/-]%
Estimated ROI$[VAL]$[PREV][+/-]%
KPI当前值上期值变化率
总执行次数[VAL][PREV][+/-]%
合规率[VAL]%[PREV]%[+/-]%
预估ROI$[VAL]$[PREV][+/-]%

Custom KPIs

自定义KPI

KPIValueUnitAggregation
[NAME][VAL][UNIT][AGG]
KPI数值单位聚合方式
[NAME][VAL][UNIT][AGG]

Daily Trend (Last 7 Days)

每日趋势(最近7天)

[ASCII LINE CHART]
undefined
[ASCII折线图]
undefined

Example Output

示例输出

undefined
undefined

KPI Trends Report

KPI趋势报告

Generated: 2025-01-21 Agent: code-assistant Period: Last 7 days
生成时间: 2025-01-21 Agent: code-assistant 统计周期: 最近7天

Core KPIs

核心KPI

KPICurrentPreviousChange
Total Executions847792+7%
Compliance Rate99.2%98.5%+0.7%
Estimated ROI$4,235$3,960+7%
KPI当前值上期值变化率
总执行次数847792+7%
合规率99.2%98.5%+0.7%
预估ROI$4,235$3,960+7%

Custom KPIs

自定义KPI

KPIValueUnitAggregation
Code Reviews156countSUM
Bugs Found23countSUM
Avg Response Quality4.7scoreAVERAGE
KPI数值单位聚合方式
代码审核次数156SUM
发现Bug数23SUM
平均响应质量4.7AVERAGE

Daily Executions (Last 7 Days)

每日执行次数(最近7天)

150 ┤ ╭── 125 ┤ ╭────────────╯ 100 ┤ ╭─────────╯ 75 ┤────╯ 50 ┤ └────────────────────────────── Mon Tue Wed Thu Fri Sat Sun

---
150 ┤ ╭── 125 ┤ ╭────────────╯ 100 ┤ ╭─────────╯ 75 ┤────╯ 50 ┤ └────────────────────────────── Mon Tue Wed Thu Fri Sat Sun

---

Report Type 3: Risk Analysis Report

报告类型3:风险分析报告

Shows risk distribution, blocked events, and sensitivity patterns.
展示风险分布、被拦截事件和敏感度模式。

Data Collection

数据收集

bash
undefined
bash
undefined

Get events with risk data

获取包含风险数据的事件

olakai activity list --limit 200 --include-analytics --json > /tmp/events.json
olakai activity list --limit 200 --include-analytics --json > /tmp/events.json

Extract risk metrics

提取风险指标

cat /tmp/events.json | jq '{ total_events: (.prompts | length), high_risk: ([.prompts[] | select(.riskScore >= 7)] | length), medium_risk: ([.prompts[] | select(.riskScore >= 4 and .riskScore < 7)] | length), low_risk: ([.prompts[] | select(.riskScore < 4)] | length), blocked: ([.prompts[] | select(.status == "blocked")] | length), blocked_percentage: (([.prompts[] | select(.status == "blocked")] | length) / (.prompts | length) * 100), sensitivity_labels: ([.prompts[].sensitivityLabel] | group_by(.) | map({label: .[0], count: length})), avg_risk_score: ([.prompts[].riskScore // 0] | add / length) }'
undefined
cat /tmp/events.json | jq '{ total_events: (.prompts | length), high_risk: ([.prompts[] | select(.riskScore >= 7)] | length), medium_risk: ([.prompts[] | select(.riskScore >= 4 and .riskScore < 7)] | length), low_risk: ([.prompts[] | select(.riskScore < 4)] | length), blocked: ([.prompts[] | select(.status == "blocked")] | length), blocked_percentage: (([.prompts[] | select(.status == "blocked")] | length) / (.prompts | length) * 100), sensitivity_labels: ([.prompts[].sensitivityLabel] | group_by(.) | map({label: .[0], count: length})), avg_risk_score: ([.prompts[].riskScore // 0] | add / length) }'
undefined

Report Template

报告模板

markdown
undefined
markdown
undefined

Risk Analysis Report

风险分析报告

Generated: [DATE] Period: Last [N] events
生成时间: [日期] 统计范围: 最近[N]个事件

Risk Overview

风险概览

MetricValue
Total Events Analyzed[COUNT]
High Risk Events[COUNT] ([%]%)
Blocked Events[COUNT] ([%]%)
Average Risk Score[SCORE]/10
指标数值
分析的总事件数[COUNT]
高风险事件数[COUNT] ([%]%)
被拦截事件数[COUNT] ([%]%)
平均风险评分[SCORE]/10

Risk Distribution

风险分布

[ASCII BAR CHART]
[ASCII条形图]

Events by Sensitivity Label

按敏感度标签分类的事件数

[ASCII BAR CHART]
[ASCII条形图]

High-Risk Event Details (Recent)

近期高风险事件详情

TimeAgentRisk ScoreReason
[TIME][AGENT][SCORE][REASON]
undefined
时间Agent风险评分原因
[TIME][AGENT][SCORE][REASON]
undefined

Example Output

示例输出

undefined
undefined

Risk Analysis Report

风险分析报告

Generated: 2025-01-21 Period: Last 200 events
生成时间: 2025-01-21 统计范围: 最近200个事件

Risk Overview

风险概览

MetricValue
Total Events Analyzed200
High Risk Events8 (4%)
Blocked Events3 (1.5%)
Average Risk Score2.3/10
指标数值
分析的总事件数200
高风险事件数8 (4%)
被拦截事件数3 (1.5%)
平均风险评分2.3/10

Risk Distribution

风险分布

Low (0-3) ████████████████████████████████████████ 172 (86%) Medium (4-6) ████████ 20 (10%) High (7-10) ████ 8 (4%)
Low (0-3) ████████████████████████████████████████ 172 (86%) Medium (4-6) ████████ 20 (10%) High (7-10) ████ 8 (4%)

Events by Sensitivity Label

按敏感度标签分类的事件数

Public ████████████████████████████████████ 145 Internal ██████████████████ 42 Confidential ████ 10 Restricted █ 3
Public ████████████████████████████████████ 145 Internal ██████████████████ 42 Confidential ████ 10 Restricted █ 3

High-Risk Events (Recent 5)

近期高风险事件(最近5个)

TimeAgentScoreModel
10:23data-export8.5gpt-4o
09:15chat-support7.2gpt-4o
08:42code-assist7.0claude-3-5

---
时间Agent评分模型
10:23data-export8.5gpt-4o
09:15chat-support7.2gpt-4o
08:42code-assist7.0claude-3-5

---

Report Type 4: ROI/Efficiency Report

报告类型4:ROI/效率报告

Shows time saved, cost metrics, and productivity gains.
展示节省的时间、成本指标和生产力提升情况。

Data Collection

数据收集

bash
undefined
bash
undefined

Get KPIs (includes ROI data)

获取KPI数据(包含ROI信息)

olakai activity kpis --json > /tmp/kpis.json
olakai activity kpis --json > /tmp/kpis.json

Get events with time saved data

获取包含节省时间数据的事件

olakai activity list --limit 100 --include-analytics --json > /tmp/events.json
olakai activity list --limit 100 --include-analytics --json > /tmp/events.json

Extract efficiency metrics

提取效率指标

cat /tmp/events.json | jq '{ total_events: (.prompts | length), total_time_saved_minutes: ([.prompts[].timeSavedMinutes // 0] | add), avg_time_saved: ([.prompts[].timeSavedMinutes // 0] | add / length), total_tokens: ([.prompts[].tokens // 0] | add), by_task: ([.prompts[] | select(.task != null)] | group_by(.task) | map({ task: .[0].task, count: length, time_saved: ([.[].timeSavedMinutes // 0] | add) })) }'
cat /tmp/events.json | jq '{ total_events: (.prompts | length), total_time_saved_minutes: ([.prompts[].timeSavedMinutes // 0] | add), avg_time_saved: ([.prompts[].timeSavedMinutes // 0] | add / length), total_tokens: ([.prompts[].tokens // 0] | add), by_task: ([.prompts[] | select(.task != null)] | group_by(.task) | map({ task: .[0].task, count: length, time_saved: ([.[].timeSavedMinutes // 0] | add) })) }'

Get ROI from KPIs

从KPI中提取ROI数据

cat /tmp/kpis.json | jq '.kpis[] | select(.name | contains("ROI") or contains("Compliance"))'
undefined
cat /tmp/kpis.json | jq '.kpis[] | select(.name | contains("ROI") or contains("Compliance"))'
undefined

Report Template

报告模板

markdown
undefined
markdown
undefined

ROI/Efficiency Report

ROI/效率报告

Generated: [DATE] Period: Last [N] events
生成时间: [日期] 统计范围: 最近[N]个事件

Efficiency Summary

效率摘要

MetricValue
Total Events[COUNT]
Total Time Saved[HOURS] hours
Avg Time Saved/Event[MIN] minutes
Estimated Cost Savings$[AMOUNT]
指标数值
总事件数[COUNT]
总节省时间[HOURS] 小时
平均每个事件节省时间[MIN] 分钟
预估成本节省$[AMOUNT]

Governance Compliance

治理合规性

MetricValue
Compliance Rate[RATE]%
Policy Violations[COUNT]
Auto-Blocked[COUNT]
指标数值
合规率[RATE]%
政策违规次数[COUNT]
自动拦截次数[COUNT]

Time Saved by Task Type

按任务类型分类的节省时间

[ASCII BAR CHART]
[ASCII条形图]

ROI Breakdown

ROI细分

[ASCII PIE CHART or TABLE]
undefined
[ASCII饼图或表格]
undefined

Example Output

示例输出

undefined
undefined

ROI/Efficiency Report

ROI/效率报告

Generated: 2025-01-21 Period: Last 100 events
生成时间: 2025-01-21 统计范围: 最近100个事件

Efficiency Summary

效率摘要

MetricValue
Total Events100
Total Time Saved12.5 hours
Avg Time Saved/Event7.5 minutes
Estimated Cost Savings$1,875
指标数值
总事件数100
总节省时间12.5 小时
平均每个事件节省时间7.5 分钟
预估成本节省$1,875

Governance Compliance

治理合规性

MetricValue
Compliance Rate99.2%
Policy Violations2
Auto-Blocked1
指标数值
合规率99.2%
政策违规次数2
自动拦截次数1

Time Saved by Task Type

按任务类型分类的节省时间

Code Review ████████████████████████████████ 4.2 hrs Bug Analysis ██████████████████████████ 3.5 hrs Documentation ████████████████████ 2.7 hrs Refactoring ████████████████ 2.1 hrs
Code Review ████████████████████████████████ 4.2 hrs Bug Analysis ██████████████████████████ 3.5 hrs Documentation ████████████████████ 2.7 hrs Refactoring ████████████████ 2.1 hrs

Productivity Multiplier

生产力提升倍数

Based on avg 7.5 min saved per interaction:
  • Daily (50 events): 6.25 hours saved
  • Weekly (250 events): 31.25 hours saved
  • Monthly (1000 events): 125 hours saved

---
基于每次交互平均节省7.5分钟计算:
  • 每日(50个事件):节省6.25小时
  • 每周(250个事件):节省31.25小时
  • 每月(1000个事件):节省125小时

---

Report Type 5: Agent Comparison Report

报告类型5:Agent对比报告

Side-by-side comparison of metrics across multiple agents.
多Agent间指标的横向对比。

Data Collection

数据收集

bash
undefined
bash
undefined

Get all agents

获取所有Agent

olakai agents list --json > /tmp/agents.json
olakai agents list --json > /tmp/agents.json

Get events for comparison

获取用于对比的事件

olakai activity list --limit 500 --include-analytics --json > /tmp/events.json
olakai activity list --limit 500 --include-analytics --json > /tmp/events.json

Extract per-agent metrics

提取各Agent的指标

cat /tmp/events.json | jq '{ agents: ([.prompts[].app] | unique | map(. as $agent | { name: $agent, events: ([($parent.prompts // [])[] | select(.app == $agent)] | length), tokens: ([($parent.prompts // [])[] | select(.app == $agent) | .tokens // 0] | add), avg_risk: ([($parent.prompts // [])[] | select(.app == $agent) | .riskScore // 0] | add / length) })) }'
cat /tmp/events.json | jq '{ agents: ([.prompts[].app] | unique | map(. as $agent | { name: $agent, events: ([($parent.prompts // [])[] | select(.app == $agent)] | length), tokens: ([($parent.prompts // [])[] | select(.app == $agent) | .tokens // 0] | add), avg_risk: ([($parent.prompts // [])[] | select(.app == $agent) | .riskScore // 0] | add / length) })) }'

Alternative: Get KPIs per agent

另一种方式:获取每个Agent的KPI

for agent_id in $(olakai agents list --json | jq -r '.[].id'); do echo "Agent: $agent_id" olakai activity kpis --agent-id $agent_id --json | jq '.kpis[] | {name, value}' done
undefined
for agent_id in $(olakai agents list --json | jq -r '.[].id'); do echo "Agent: $agent_id" olakai activity kpis --agent-id $agent_id --json | jq '.kpis[] | {name, value}' done
undefined

Report Template

报告模板

markdown
undefined
markdown
undefined

Agent Comparison Report

Agent对比报告

Generated: [DATE] Agents Compared: [COUNT]
生成时间: [日期] 对比的Agent数量: [COUNT]

Activity Volume

活动量

AgentEventsTokensAvg Tokens
[NAME][COUNT][TOKENS][AVG]
Agent事件数Token数平均每个事件Token数
[NAME][COUNT][TOKENS][AVG]

KPI Comparison

KPI对比

KPI[AGENT1][AGENT2][AGENT3]
Executions[VAL][VAL][VAL]
Compliance[VAL]%[VAL]%[VAL]%
ROI$[VAL]$[VAL]$[VAL]
KPI[AGENT1][AGENT2][AGENT3]
执行次数[VAL][VAL][VAL]
合规率[VAL]%[VAL]%[VAL]%
ROI$[VAL]$[VAL]$[VAL]

Risk Profile

风险概况

[ASCII GROUPED BAR CHART]
[ASCII分组条形图]

Activity Trend by Agent

各Agent活动趋势

[ASCII MULTI-LINE CHART]
undefined
[ASCII多折线图]
undefined

Example Output

示例输出

undefined
undefined

Agent Comparison Report

Agent对比报告

Generated: 2025-01-21 Agents Compared: 4
生成时间: 2025-01-21 对比的Agent数量: 4

Activity Volume

活动量

AgentEventsTokensAvg Tokens
code-assistant24598,450402
data-analyzer189156,230827
chat-support31278,540252
test-agent5412,340229
Agent事件数Token数平均每个事件Token数
code-assistant24598,450402
data-analyzer189156,230827
chat-support31278,540252
test-agent5412,340229

KPI Comparison

KPI对比

KPIcode-assistdata-analyzechat-support
Compliance99.5%98.2%99.8%
Avg Risk1.83.21.2
Time Saved18.5 hrs12.3 hrs8.7 hrs
KPIcode-assistdata-analyzechat-support
合规率99.5%98.2%99.8%
平均风险评分1.83.21.2
节省总时间18.5 hrs12.3 hrs8.7 hrs

Risk Profile by Agent

各Agent风险概况

Low Medium High code-assist ████████████████████ █ │ 92% 6% 2% data-analyze ██████████████████ ████ ██ 85% 10% 5% chat-support █████████████████████ │ │ 97% 2% 1% test-agent ███████████████████ ██ │ 90% 8% 2%

---
Low Medium High code-assist ████████████████████ █ │ 92% 6% 2% data-analyze ██████████████████ ████ ██ 85% 10% 5% chat-support █████████████████████ │ │ 97% 2% 1% test-agent ███████████████████ ██ │ 90% 8% 2%

---

ASCII Visualization Functions

ASCII可视化函数

Bar Chart Generator

条形图生成器

To create horizontal bar charts, use this pattern:
bash
undefined
要创建水平条形图,请使用以下模式:
bash
undefined

Generate bar chart from jq output

从jq输出生成条形图

cat /tmp/events.json | jq -r ' [.prompts[].model] | group_by(.) | map({model: .[0], count: length}) | sort_by(-.count) | (max_by(.count).count) as $max | .[] | "(.model | .[0:15] | . + " " * (15 - length)) " + ("█" * ((.count / $max * 40) | floor)) + " (.count)" '

Example output:
gpt-4o ████████████████████████████████████████ 45 gpt-4o-mini █████████████████████████ 28 claude-3-5 ██████████████████ 20
undefined
cat /tmp/events.json | jq -r ' [.prompts[].model] | group_by(.) | map({model: .[0], count: length}) | sort_by(-.count) | (max_by(.count).count) as $max | .[] | "(.model | .[0:15] | . + " " * (15 - length)) " + ("█" * ((.count / $max * 40) | floor)) + " (.count)" '

示例输出:
gpt-4o ████████████████████████████████████████ 45 gpt-4o-mini █████████████████████████ 28 claude-3-5 ██████████████████ 20
undefined

Percentage Bar

百分比条形图

bash
undefined
bash
undefined

Show percentage with visual bar

用可视化条形图展示百分比

echo "Compliance: ████████████████████░░░░░ 85%"

Pattern:
[LABEL]: [FILLED █ * percentage/4][EMPTY ░ * (25-filled)] [VALUE]%
undefined
echo "合规率: ████████████████████░░░░░ 85%"

模式:
[标签]: [填充的 █ * 百分比/4][空的 ░ * (25-填充数)] [数值]%
undefined

Trend Indicators

趋势指示器

↑ +7%   (increase)
↓ -3%   (decrease)
→ 0%    (stable)

↑ +7%   (上升)
↓ -3%   (下降)
→ 0%    (稳定)

Quick Reference Commands

快速参考命令

bash
undefined
bash
undefined

Usage Summary

使用情况摘要

olakai activity list --limit 100 --json | jq '{ events: (.prompts | length), tokens: ([.prompts[].tokens // 0] | add), models: ([.prompts[].model] | unique) }'
olakai activity list --limit 100 --json | jq '{ events: (.prompts | length), tokens: ([.prompts[].tokens // 0] | add), models: ([.prompts[].model] | unique) }'

KPI Snapshot

KPI快照

olakai activity kpis --json | jq '.kpis[] | {name, value, unit}'
olakai activity kpis --json | jq '.kpis[] | {name, value, unit}'

Risk Summary

风险摘要

olakai activity list --limit 100 --json | jq '{ high_risk: ([.prompts[] | select(.riskScore >= 7)] | length), blocked: ([.prompts[] | select(.status == "blocked")] | length) }'
olakai activity list --limit 100 --json | jq '{ high_risk: ([.prompts[] | select(.riskScore >= 7)] | length), blocked: ([.prompts[] | select(.status == "blocked")] | length) }'

Agent List

Agent列表

olakai agents list --json | jq '.[] | {id, name}'
olakai agents list --json | jq '.[] | {id, name}'

Per-Agent KPIs

单Agent KPI

olakai activity kpis --agent-id AGENT_ID --json
olakai activity kpis --agent-id AGENT_ID --json

Time-Series Data

时间序列数据

olakai activity kpis --period daily --json olakai activity kpis --period weekly --json

---
olakai activity kpis --period daily --json olakai activity kpis --period weekly --json

---

Generating a Complete Report

生成完整报告

Follow this workflow for any report type:
bash
undefined
针对任何报告类型,请遵循以下流程:
bash
undefined

1. Determine scope

1. 确定范围

AGENT_ID="your-agent-id" # or leave empty for all LIMIT=100
AGENT_ID="your-agent-id" # 留空则针对所有Agent LIMIT=100

2. Collect data

2. 收集数据

olakai activity list --limit $LIMIT --include-analytics --json > /tmp/activity.json olakai activity kpis --agent-id $AGENT_ID --json > /tmp/kpis.json olakai agents list --json > /tmp/agents.json
olakai activity list --limit $LIMIT --include-analytics --json > /tmp/activity.json olakai activity kpis --agent-id $AGENT_ID --json > /tmp/kpis.json olakai agents list --json > /tmp/agents.json

3. Process and format (example for usage summary)

3. 处理并格式化(以使用情况摘要为例)

echo "# Usage Summary Report" echo "Generated: $(date +%Y-%m-%d)" echo "" echo "## Overview" cat /tmp/activity.json | jq -r '"| Metric | Value | |--------|-------| | Total Events | (.prompts | length) | | Total Tokens | ([.prompts[].tokens // 0] | add) | | Unique Models | ([.prompts[].model] | unique | length) |"'

---
echo "# 使用情况摘要报告" echo "生成时间: $(date +%Y-%m-%d)" echo "" echo "## 概览" cat /tmp/activity.json | jq -r '"| 指标 | 数值 | |--------|-------| | 总事件数 | (.prompts | length) | | 总Token数 | ([.prompts[].tokens // 0] | add) | | 唯一模型数 | ([.prompts[].model] | unique | length) |"'

---

Error Handling

错误处理

No Data Available

无可用数据

bash
undefined
bash
undefined

Check if events exist

检查是否存在事件

olakai activity list --limit 1 --json | jq '.prompts | length'
olakai activity list --limit 1 --json | jq '.prompts | length'

If 0, inform user:

如果结果为0,请告知用户:

"No events found. Ensure your agent is sending events to Olakai."

"未找到事件。请确保您的Agent正在向Olakai发送事件。"

undefined
undefined

Agent Not Found

Agent不存在

bash
undefined
bash
undefined

Verify agent exists

验证Agent是否存在

olakai agents list --json | jq '.[] | select(.id == "AGENT_ID")'
olakai agents list --json | jq '.[] | select(.id == "AGENT_ID")'

If empty, list available agents:

如果为空,列出可用Agent:

olakai agents list --json | jq '.[] | {id, name}'
undefined
olakai agents list --json | jq '.[] | {id, name}'
undefined

Missing Permissions

权限不足

bash
undefined
bash
undefined

Re-authenticate if needed

如有需要,重新认证

olakai logout && olakai login olakai whoami # Verify

---
olakai logout && olakai login olakai whoami # 验证

---

Best Practices

最佳实践

  1. Always use
    --json
    flag
    for programmatic processing
  2. Pipe through
    jq
    for clean data extraction
  3. Cache data locally when generating multi-section reports
  4. Include timestamps in all reports
  5. Show data freshness - how recent the events are
  6. Handle empty states gracefully with informative messages
  1. 始终使用
    --json
    参数
    以支持程序化处理
  2. 通过
    jq
    管道传输
    以清晰提取数据
  3. 本地缓存数据在生成多部分报告时
  4. 在所有报告中包含时间戳
  5. 展示数据新鲜度 - 事件的最新时间
  6. 优雅处理空状态并提供信息性提示