HTTP agent principal grants
@lifecycle.http.agent_principal registers one sync or async function that receives a ConnectionContext and an AuthPrincipal. Return an AgentRuntimePrincipal to grant permissions or None to deny the invocation. See Grant permissions on built-in routes.
Hook control flow
Exports
CoverageLevel
Describe how completely Harnest governs one runtime boundary.Example
Example
DROP_EVENT
Example
Example
EvalCaptureOptions
Authored capture settings;None defers to the environment, then defaults.
— means no declared default):
Parameters and example
Parameters and example
Finish
Complete an intercepting lifecycle stage without calling later work.— means no declared default):
Parameters and example
Parameters and example
LifecycleContext
Portable invocation context shared by listeners for one execution.— means no declared default):
Parameters and example
Parameters and example
LifecycleContext.next
Parameters and example
Parameters and example
LifecycleContext.finish
Parameters and example
Parameters and example
LifecycleCoverage
Stable report of lifecycle boundaries Harnest can actually guarantee.— means no declared default):
Parameters and example
Parameters and example
LifecycleCoverage.stage
Parameters and example
Parameters and example
LifecycleCoverage.report
Example
Example
LifecycleCoverage.with_overrides
Parameters and example
Parameters and example
LifecycleListener
One discovered callback with a deterministic source identity.— means no declared default):
Parameters and example
Parameters and example
LifecycleListener.identity
Return the stable identity used to order and deduplicate listeners.Example
Example
LifecycleRegistration
Metadata attached by one lifecycle decorator.— means no declared default):
Parameters and example
Parameters and example
ModelCallRequest
Portable model input that a listener may replace or short-circuit.— means no declared default):
Parameters and example
Parameters and example
ModelCallResponse
Portable visible model output.— means no declared default):
Parameters and example
Parameters and example
ModelLifecycleContext
Stable provider-neutral facts associated with one model call.— means no declared default):
Parameters and example
Parameters and example
ModelLifecycleContext.next
Parameters and example
Parameters and example
ModelLifecycleContext.finish
Parameters and example
Parameters and example
ModelMessage
One provider-independent text message in a model call.— means no declared default):
Parameters and example
Parameters and example
Next
Continue a lifecycle chain, optionally with a replacement value.— means no declared default):
Parameters and example
Parameters and example
Next.replaces
Report whether the next stage should receive a replacement value.Example
Example
TransitionContext
Give typed lifecycle contexts one consistent control-flow vocabulary.Example
Example
TransitionContext.next
Parameters and example
Parameters and example
TransitionContext.finish
Parameters and example
Parameters and example
adk_plugin
Register a native ADK plugin factory at the lifecycle boundary.Parameters and example
Parameters and example
agent
Name invocation hooks by their agent lifecycle responsibility.Example
Example
agent.before
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
agent.after
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
agent.on_event
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
agent.on_error
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
authenticate
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
coverage
Build conservative defaults and apply adapter-observed coverage limits.Parameters and example
Parameters and example
credential_provider
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
eval_capture_options
Return capture options attached by@lifecycle.evals.capture.
Parameters and example
Parameters and example
evals
Production eval improvement hooks, valid only inlifecycle/evals_improvement.py.
Example
Example
evals.capture
store names a @lifecycle.storage.custom provider implementing
harnest.eval_capture.CaptureStore. sample_rate additionally
captures that fraction of invocations the rule rejects.
Content is omitted unless @lifecycle.evals.redact is registered.
That hook takes and returns one CaptureRecord; any other return
value drops the capture. Harnest does not detect personal data.
Parameters and example
Parameters and example
evals.redact
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
http
Group server middleware hooks under the HTTP lifecycle boundary.Example
Example
http.scope
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
http.before
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
http.after
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
http.on_error
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
http.agent_principal
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
http_routes
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
langgraph_middleware
Register a native LangGraph middleware factory at the lifecycle boundary.Parameters and example
Parameters and example
lifecycle_coverage
Build conservative defaults and apply adapter-observed coverage limits.Parameters and example
Parameters and example
mcp
Group managed remote-tool hooks separately from transport ownership.Example
Example
mcp.before
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
mcp.after
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
mcp.on_error
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
model
Group provider-neutral model hooks under one authoring namespace.Example
Example
model.before
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
model.after
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
model.on_error
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
output_policy
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
registrations_for
Return every role attached to a possibly shared storage factory.Parameters and example
Parameters and example
resource
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
session
Observe committed sessions without participating in persistence.Example
Example
session.created
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
skills
Register named runtime catalogs independently of filesystem skills.Example
Example
skills.source
Parameters and example
Parameters and example
storage
Namespace storage roles while retaining distributed file discovery.Example
Example
storage.sessions
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
storage.checkpoints
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
storage.tasks
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
storage.cron
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
storage.memory
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
storage.assets
Parameters and example
Parameters and example
storage.custom
Parameters and example
Parameters and example
telemetry_exporter
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
tool
Group portable tool interception under its first-class domain path.Example
Example
tool.before
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
tool.after
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example
tool.on_error
Preserve authored hook signatures while attaching lifecycle metadata.Parameters and example
Parameters and example