diff --git a/src/agentex/lib/sdk/fastacp/base/base_acp_server.py b/src/agentex/lib/sdk/fastacp/base/base_acp_server.py index eb945161..b625eaa1 100644 --- a/src/agentex/lib/sdk/fastacp/base/base_acp_server.py +++ b/src/agentex/lib/sdk/fastacp/base/base_acp_server.py @@ -78,6 +78,9 @@ def __init__(self): self.add_middleware(RequestIDMiddleware) self._handlers: dict[RPCMethod, Callable] = {} + # Agent info to return in healthz + self.agent_id: str | None = None + @classmethod def create(cls): """Create and initialize BaseACPServer instance""" @@ -96,6 +99,7 @@ async def lifespan_context(app: FastAPI): # noqa: ARG001 env_vars = EnvironmentVariables.refresh() if env_vars.AGENTEX_BASE_URL: await register_agent(env_vars) + self.agent_id = env_vars.AGENT_ID else: logger.warning("AGENTEX_BASE_URL not set, skipping agent registration") @@ -105,7 +109,10 @@ async def lifespan_context(app: FastAPI): # noqa: ARG001 async def _healthz(self): """Health check endpoint""" - return {"status": "healthy"} + result = {"status": "healthy"} + if self.agent_id: + result["agent_id"] = self.agent_id + return result def _wrap_handler(self, fn: Callable[..., Awaitable[Any]]): """Wraps handler functions to provide JSON-RPC 2.0 response format"""