Claude Code commited on
Commit
441f392
·
1 Parent(s): 7cab3bb

Claude Code: Fix A2A - add /health and /agents endpoints

Browse files
Files changed (1) hide show
  1. app.py +24 -1
app.py CHANGED
@@ -1,9 +1,32 @@
1
  from fastapi import FastAPI
 
 
 
2
  app = FastAPI()
3
 
4
  @app.get("/")
5
  def read_root():
6
- return {"status": "minimal_ok"}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  if __name__ == "__main__":
9
  import uvicorn
 
1
  from fastapi import FastAPI
2
+ from datetime import datetime
3
+ from fastapi.responses import JSONResponse
4
+
5
  app = FastAPI()
6
 
7
  @app.get("/")
8
  def read_root():
9
+ return {"status": "ok", "service": "Cain"}
10
+
11
+ @app.get("/health")
12
+ def health_check():
13
+ """Health check endpoint for a2a-proxy polling."""
14
+ return JSONResponse({
15
+ "status": "healthy",
16
+ "stage": "RUNNING",
17
+ "timestamp": datetime.utcnow().isoformat() + "+00:00",
18
+ }, status_code=200)
19
+
20
+ @app.get("/agents")
21
+ def get_agents():
22
+ """Agent list endpoint for a2a-proxy discovery."""
23
+ return [{
24
+ "agentId": "cain",
25
+ "name": "Cain",
26
+ "state": "idle",
27
+ "detail": "Cain is operational",
28
+ "authStatus": "approved",
29
+ }]
30
 
31
  if __name__ == "__main__":
32
  import uvicorn