Agent instrumentation SDK examples
Metadata-only registration and correlation. Service credentials stay server-side; instrumentation does not replace independent tool authorization or establish gateway coverage.
TypeScript
Download exampleconst endpoint = process.env.VISIONX_AGENT_ENDPOINT; // This app's /api/public/agents/discovery
const key = process.env.VISIONX_AGENT_KEY; // Server-side service credential only
const agent = { external_id: "claims-worker-v1", name: "Claims worker", type: "workflow", framework: "LangGraph" };
async function report(op, payload) {
const response = await fetch(endpoint, { method: "POST", headers: { "Authorization": "Bearer " + key, "Content-Type": "application/json" }, body: JSON.stringify({ op, payload }) });
if (!response.ok) throw new Error("Registration refused: " + response.status);
return response.json();
}
const registration = await report("register", agent);
const correlation_id = crypto.randomUUID();
await report("tool_start", { agent_id: registration.agents[0].id, correlation_id, tool_name: "documents.read" });
// Execute your own separately authorized tool. Never send arguments, prompts or results.
await report("tool_finish", { agent_id: registration.agents[0].id, correlation_id, tool_name: "documents.read", outcome: "success" });
await report("heartbeat", { agent_id: registration.agents[0].id });Python
Download exampleimport os, uuid, json, urllib.request
endpoint = os.environ["VISIONX_AGENT_ENDPOINT"]
key = os.environ["VISIONX_AGENT_KEY"] # Server-side only
def report(op, payload):
request = urllib.request.Request(endpoint, data=json.dumps({"op": op, "payload": payload}).encode(), headers={"Authorization": "Bearer " + key, "Content-Type": "application/json"}, method="POST")
with urllib.request.urlopen(request, timeout=20) as response:
return json.load(response)
registration = report("register", {"external_id": "claims-worker-v1", "name": "Claims worker", "type": "workflow", "framework": "LangGraph"})
agent_id = registration["agents"][0]["id"]
correlation_id = str(uuid.uuid4())
report("tool_start", {"agent_id": agent_id, "correlation_id": correlation_id, "tool_name": "documents.read"})
# Your tool authorization stays independent. Never report arguments or results.
report("tool_finish", {"agent_id": agent_id, "correlation_id": correlation_id, "tool_name": "documents.read", "outcome": "success"})
report("heartbeat", {"agent_id": agent_id})