エージェントの実行
Squadbase API 経由でエージェントの実行をオンデマンドで開始します。
POST
https://api.squadbase.dev/v0/agent/{agentId}/triggerエージェントの新しい実行を開始します。実行レコードを作成しサンドボックスを起動した時点で 201 Created を返し、実処理は裏でエージェント基盤が進めて、完了後に設定済みの通知先へ結果を配信します。
リクエストヘッダー
Prop
Type
Required
x-api-key ヘッダーはすべてのリクエストで必須です。詳細は 認証 を参照してください。なお、このエンドポイントはJSONボディを受け取るため、Content-Type: application/json も指定してください。
Idempotency-Key を指定すると、ネットワークエラー後にトリガーを安全に再送しても実行が重複する心配がありません。同一の論理リクエストの再送には同じキーを、まったく新しい実行には新しいキーを使用してください。キーはAPIキーごとにスコープされます。
パスパラメータ
Prop
Type
Required
リクエストボディ
application/json。いずれのフィールドも任意です。
Prop
Type
Required
{
"message": "今週のサインアップ動向を分析して",
"title": "週次サインアップ分析"
}レスポンス — 201 Created
実行オブジェクトを返します。executionId を保存して、実行状態の取得や実行結果の取得に使用します。
{
"executionId": "uuid", // 状態 / 結果取得に使うハンドル
"agentId": "uuid",
"status": "RUNNING",
"title": "週次サインアップ分析",
"message": "今週のサインアップ動向を分析して",
"startedAt": "ISO8601",
"completedAt": null,
"createdAt": "ISO8601"
}呼び出し例
curl -X POST 'https://api.squadbase.dev/v0/agent/<AGENT_ID>/trigger' \
-H 'x-api-key: <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: <UNIQUE_KEY>' \
-d '{"message":"今週のサインアップ動向を分析して","title":"週次分析"}'import requests
response = requests.post(
"https://api.squadbase.dev/v0/agent/<AGENT_ID>/trigger",
headers={
"x-api-key": "<YOUR_API_KEY>",
"Content-Type": "application/json",
"Idempotency-Key": "<UNIQUE_KEY>",
},
json={
"message": "今週のサインアップ動向を分析して",
"title": "週次分析",
},
)
execution = response.json()
print(execution["executionId"], execution["status"])const response = await fetch(
"https://api.squadbase.dev/v0/agent/<AGENT_ID>/trigger",
{
method: "POST",
headers: {
"x-api-key": "<YOUR_API_KEY>",
"Content-Type": "application/json",
"Idempotency-Key": "<UNIQUE_KEY>",
},
body: JSON.stringify({
message: "今週のサインアップ動向を分析して",
title: "週次分析",
}),
},
);
const execution = await response.json();
console.log(execution.executionId, execution.status);エラーレスポンスは エラー を参照してください。