SPB Git forge

spb/doc-api

Public
2commits 1branches 0releases
15.7 MBsize
maindefault branch
13 days agolast push
Python 88.3% TypeScript 7.6% Shell 4.1%
1.4 KB · 22 lines python
Raw Blame History
1#!/usr/bin/env python32"""STATUS: LIVE_VERIFIED 2026-09-18 — create a reusable agent definition, retrieve it, delete it (no inference, free).3Run from repo root: python3 examples/openai/agents/create_agent.py   (uses scripts/live.py: .env auth + request log)"""4import json, os, sys5sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", ".."))6from scripts import live78H = {"OpenAI-Beta": "agents=v1"}  # mandatory; without it -> 400 invalid_beta9agent = {10    "name": "atlas-example", "model": os.environ.get("AGENTS_MODEL", "gpt-5.6-luna"),11    "instructions": "Reply with OK.",                 # appended to the harness base instructions12    "reasoning": {"effort": "low"}, "text": {"verbosity": "low"},13    "tools": [{"type": "web_search", "mode": "disabled"}],  # saved agents accept credential-free (Persisted) tool configs14    "multi_agent": {"enabled": False}, "metadata": {"source": "api-atlas"},15}16st, out, _ = live.openai_request("POST", "/v1/agents", agent, extra_headers=H, note="example create_agent")17print(st, json.dumps(out, indent=1)); assert st == 201, out18st, got, _ = live.openai_request("GET", f"/v1/agents/{out['id']}", extra_headers=H, note="example retrieve agent")19print(st, got["object"], got["model"], got["reasoning"])20st, deleted, _ = live.openai_request("DELETE", f"/v1/agents/{out['id']}", extra_headers=H, note="example delete agent")21print(st, deleted)  # {'id': ..., 'object': 'agent.deleted', 'deleted': True}22