Add an endpoint
Create a synchronous route factory in the root agent’sextensions/ directory. Harnest injects an AgentInvoker and mounts the returned FastAPI router.
extensions/http.py
Invoke the agent safely
AgentInvoker uses the same response coordinator as POST /responses. It does not call the raw ADK or LangGraph object.
Handle required actions
An invocation can pause instead of returning a final answer:POST /approvals/{approvalId}. Submit browser-hosted tool results through POST /client-tools/{requestId}. These endpoints share the same suspended execution created by the custom route.
Use response.as_dict() when your endpoint should return Harnest’s complete neutral response shape unchanged.
Route ownership
Compilation rejects duplicate routes and Harnest-owned namespaces. Reserved paths include/responses, /sessions, /live, /approvals, /client-tools, /agent, /healthz, playground assets, OpenAPI pages, and ADK-native run or application routes.
When you configure authentication, custom routes are protected by default. They also appear in /openapi.json. Harnest does not currently provide streaming through AgentInvoker; use the neutral SSE or WebSocket APIs when you need streaming.
See Neutral API, Approvals and client tools, and Authentication and credentials.