Skip to main content
Portable hooks apply the same policy around Harnest-owned ADK and LangGraph boundaries. From the agent root, create an observational agent hook starter:
Use --project <agent-root> when running the command from elsewhere, then choose the boundary and phase that owns the policy.

Control flow

Tool, MCP, and HTTP before and after interceptors require explicit control flow. Agent and model hooks accept legacy return values, but explicit transitions keep policy readable and portable. Error hooks normally return context.next(). An MCP error hook can use finish(...) only for a recoverable provider failure; it cannot bypass approval or cancellation.

Ordering

The agent_name on a model lifecycle context is call-specific. When a managed SubAgent calls a model, it contains that SubAgent’s name rather than the root agent’s name. The authenticated user, session, and invocation IDs remain those of the root request, including when sibling SubAgents run concurrently. Keep business operations in Agent Tools. Hooks should apply policy, observation, or transformation around those operations.

Portable or native?

Native integrations

Isolate behavior that must use the selected framework directly.