0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Agent-lightning、AgentOpsでトレース可視化:uv実行クイックスタート

Posted at

agent-lightning-agentops-trace-20251030

本記事は Agent-lightning の APO サンプルを uv で実行し、AgentOpsでトレース可視化 するための最短手順です。クローン → 依存同期 → .env 設定 → 実行 → ダッシュボード確認の流れだけに絞っています。


前提

examples/apo/room_selector_apo.py同階層の .env を自動読み込み、AgentOps にトレースを送信します。


クローン

git clone https://github.com/Sunwood-ai-labs/agent-lightning.git
cd agent-lightning
# 既存クローンは最新化
# git pull --rebase

uv で依存関係を同期

uv sync はルートの pyproject.toml を自動検出します。

uv sync --extra apo

uv 未導入なら pip install uv


.env を用意(API キー設定)

cp examples/apo/.env.example examples/apo/.env

examples/apo/.env を編集:

OPENAI_API_KEY=sk-...      # 必須
AGENTOPS_API_KEY=ao-...    # 推奨(可視化)

重要.envexamples/apo/room_selector_apo.py と同階層)に置くこと。


実行(uv 経由)

examples/apo/ へ移動して実行します。

cd examples/apo
uv run python room_selector_apo.py

実行時の挙動(抜粋):

  • スクリプトの絶対パスを表示
  • 10 秒待機(ログ/環境確認のため)
  • room_tasks.jsonl を訓練/検証に分割して APO を実行
  • .envAGENTOPS_API_KEY があれば、セッションURL を出力

AgentOpsでトレース可視化

  1. AgentOps にサインインし API キー を取得
  2. .envAGENTOPS_API_KEY に設定済みで再実行
  3. 出力された Session Replay(セッションURL)を開き、メッセージ/コスト/ステップ を確認

参考コマンド(まとめ)

# クローン
git clone https://github.com/Sunwood-ai-labs/agent-lightning.git
cd agent-lightning

# 依存同期
uv sync --extra apo

# .env 作成と編集
cp examples/apo/.env.example examples/apo/.env

# 実行
cd examples/apo
uv run python room_selector_apo.py
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?