Files
buryan-infra/ops/ai/gateway_agent.py
T
architect 87cc382376
lint / hygiene (push) Failing after 16s
lint / hygiene (pull_request) Failing after 21s
standard / check (pull_request) Successful in 8s
[STAGE5] Gateway-only smoke agent
2026-11-27 22:21:22 +03:00

23 lines
714 B
Python

#!/usr/bin/env python3
"""Smoke agent: only Tool Gateway, no direct production URLs."""
import json
import urllib.request
BASE = "http://127.0.0.1:9137"
def call(tool, method="GET", body=None, approval=None):
req = urllib.request.Request(BASE + "/v1/call?tool=" + tool, method=method)
if body is not None:
req.data = json.dumps(body).encode()
req.add_header("Content-Type", "application/json")
if approval:
req.add_header("X-Approval", approval)
with urllib.request.urlopen(req, timeout=10) as r:
return json.loads(r.read().decode())
if __name__ == "__main__":
d = call("catalog.read")
print("gateway_agent_ok", d.get("tool"), len(d.get("body") or ""))