v2.0: Multi-user platform with agent catalog, admin panel, LLM providers
This commit is contained in:
+10
-12
@@ -33,19 +33,17 @@ def api_request(url, data=None, headers=None, method="GET"):
|
||||
return json.loads(resp.read().decode())
|
||||
|
||||
|
||||
def log_run(agent_id, status, output="", err="", metadata=None):
|
||||
"""Log a run to the dashboard API."""
|
||||
def log_run(agent_id, status, output="", err="", metadata=None, instance_id=None):
|
||||
"""Log a run to the dashboard API. Uses instance_id if available (v2), falls back to agent_id."""
|
||||
try:
|
||||
api_request(
|
||||
f"{DASHBOARD_API}/api/agents/{agent_id}/runs",
|
||||
data={
|
||||
"status": status,
|
||||
"output": output,
|
||||
"error": err,
|
||||
"metadata": metadata or {},
|
||||
},
|
||||
method="POST",
|
||||
)
|
||||
if instance_id:
|
||||
api_request(
|
||||
f"{DASHBOARD_API}/api/instances/{instance_id}/runs",
|
||||
data={"status": status, "output": output, "error": err, "metadata": metadata or {}},
|
||||
method="POST",
|
||||
)
|
||||
else:
|
||||
print(f"Warning: no instance_id, run not logged for {agent_id}", file=sys.stderr)
|
||||
except Exception as e:
|
||||
print(f"Warning: failed to log run to dashboard: {e}", file=sys.stderr)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user