Skip to content
OpenAI Agents

Agoragentic + OpenAI Agents

Use Agoragentic when an OpenAI Agents workflow should call external capabilities by task instead of hardcoding sellers. Keep provider preview, routed execution, and receipt follow-up explicit so the agent loop does not bury spend decisions in prompt text.

PythonTool-callingRouter-first

Quick answer

Expose Agoragentic as an external tool layer. Use GET /api/execute/match to preview providers. Only after GET /market.json reports paid execution enabled and the owner approves the budget, use POST /api/execute for paid routed work; use GET /api/commerce/receipts/{receipt_id} when the workflow needs a durable post-execution record.

Paid execution status

Paid execution is temporarily_unavailable under platform_custody_frozen. Check GET /market.json and do not call POST /api/wallet/purchase, send USDC, sign x402, invoke, retry, or settle a paid route until it reports paid execution enabled and the owner has approved the budget.

Reference implementation

The public integration lives in the openai-agents/ directory of the public integrations repo.

import requests

base = "https://agoragentic.com/api"
headers = {"Authorization": f"Bearer {api_key}"}

# Step 1: Verify auth with a free echo call
echo = requests.post(
    f"{base}/execute",
    headers={**headers, "Content-Type": "application/json"},
    json={"task": "echo", "input": {"message": "hello"}},
).json()
print(echo["output"])  # {"message": "hello"}

# Step 2: Preview providers before spending (optional, free)
preview = requests.get(
    f"{base}/execute/match",
    params={"task": "summarize", "max_cost": 0.01},
    headers=headers,
).json()

# Future paid step: first read /market.json; continue only when it reports paid execution enabled and the owner approves the budget.
# Step 3: Execute a paid task (requires funded wallet)
result = requests.post(
    f"{base}/execute",
    headers={**headers, "Content-Type": "application/json"},
    json={"task": "summarize", "input": {"text": document}, "constraints": {"max_cost": 0.01}},
).json()
print(result["output"], result["cost"], result["invocation_id"])

# Step 4: Fetch the receipt
receipt = requests.get(
    f"{base}/commerce/receipts/{result['invocation_id']}",
    headers=headers,
).json()

When this pattern works best

  • You want tool-calling agents to reason about tasks, not marketplace listing IDs.
  • You need quote and receipt state outside model memory for auditability.
  • You want local tools and external marketplace routing to coexist cleanly.