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

Return context.next() to continue, optionally with a replacement value. Return context.finish(result) to end the chain with a final result. 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

Model hooks identify the calling agent in agent_name. User, session, and invocation IDs remain shared with the root request, including concurrent SubAgents. 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.