Skip to content

Commit 75ff330

Browse files
committed
Update base_acp_server.py
1 parent 461cfcc commit 75ff330

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/agentex/lib/sdk/fastacp/base/base_acp_server.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ def __init__(self):
7878
self.add_middleware(RequestIDMiddleware)
7979
self._handlers: dict[RPCMethod, Callable] = {}
8080

81+
# Agent info to return in healthz
82+
self.agent_id: str | None = None
83+
8184
@classmethod
8285
def create(cls):
8386
"""Create and initialize BaseACPServer instance"""
@@ -94,6 +97,7 @@ def get_lifespan_function(self):
9497
@asynccontextmanager
9598
async def lifespan_context(app: FastAPI): # noqa: ARG001
9699
env_vars = EnvironmentVariables.refresh()
100+
self.agent_id = env_vars.AGENT_ID
97101
if env_vars.AGENTEX_BASE_URL:
98102
await register_agent(env_vars)
99103
else:
@@ -105,7 +109,10 @@ async def lifespan_context(app: FastAPI): # noqa: ARG001
105109

106110
async def _healthz(self):
107111
"""Health check endpoint"""
108-
return {"status": "healthy"}
112+
result = {"status": "healthy"}
113+
if self.agent_id:
114+
result["agent_id"] = self.agent_id
115+
return result
109116

110117
def _wrap_handler(self, fn: Callable[..., Awaitable[Any]]):
111118
"""Wraps handler functions to provide JSON-RPC 2.0 response format"""

0 commit comments

Comments
 (0)