OAuth で AI Agent を接続します。無人運用にはマシンクライアントまたはサービスアカウントを使い、資格情報を保護された環境変数またはシークレットストアに保管してください。

Argus 自身は投資判断や注文を生成しませんが、クライアント Agent が合法的に取得したデータで独立して推論・出力することを制限しません。

REST と API

  1. 現行 REST スキーマには権威ある OpenAPI 文書を使います。
  2. OAuth Bearer token を送信します。machine client と service account は X-Argus-API-Key も利用できます。
  3. 構造化された HTTP レスポンスとステータスコードを OpenAPI 契約に照らして検証します。
  4. 400/422 は要求、401 は認証、403 はガバナンス拒否、500/503 はサービス障害として扱います。
  5. audit_id を保持し、再試行可能な障害だけを制限付きで再試行します。
# First run: argus auth login
import json
from urllib.request import Request, HTTPRedirectHandler, build_opener
from argus.cli.oauth import CliOAuthProfile

profile = CliOAuthProfile()
token = profile.client().access_token()
if token is None:
    raise RuntimeError("Run argus auth login first")

class NoRedirect(HTTPRedirectHandler):
    def redirect_request(self, *args, **kwargs):
        return None

request = Request(
    profile.api_base_url + "/v1/entity-resolve",
    data=json.dumps(json.loads(r'''{"identifier_type":"lei","identifier_value":"HWUPKR0MPOU8FGXBT394","purpose":"factual_lookup","requires_redistribution":false}''')).encode(),
    headers={"Authorization": f"Bearer {token}",
             "Content-Type": "application/json", "User-Agent": "Argus REST client"},
    method="POST",
)
with build_opener(NoRedirect()).open(request, timeout=30) as response:
    envelope = json.load(response)
    print(json.dumps(envelope, indent=2))

REST 一覧とエラー契約を読む。