Skip to main content
All Python modules · Import and compatibility guidance

Tool declaration

Private client input contract

Exports

Agent

Managed agent definition lowered by the selected Harnest backend.
Fields (— means no declared default):

Agent.advanced

Wrap a framework-native root, subagent, or graph node. Export the wrapper as the root in advanced mode, or embed it in a managed agent/graph when only one component needs native behavior.

Agent.build

Build the underlying ADK agent. ADK is imported lazily so config generation and validation do not need model/runtime dependencies loaded. Sandbox agents retain native flows with a scoped consumed-code continuation compatibility adapter.

AgentDefinition

Managed agent definition lowered by the selected Harnest backend.
Fields (— means no declared default):

AgentDefinition.advanced

Wrap a framework-native root, subagent, or graph node. Export the wrapper as the root in advanced mode, or embed it in a managed agent/graph when only one component needs native behavior.

AgentDefinition.build

Build the underlying ADK agent. ADK is imported lazily so config generation and validation do not need model/runtime dependencies loaded. Sandbox agents retain native flows with a scoped consumed-code continuation compatibility adapter.

AgentRuntimePermissionError

A capability is unavailable to the active Agent Runtime Principal.

AgentRuntimePrincipal

Identify one default-deny invocation and its permission grants.
Fields (— means no declared default):

AgentRuntimePrincipal.create

Create an opaque runtime identity from application-authorized grants.

AgentRuntimePrincipal.restrict

Create a fresh principal without permitting authority amplification.

ClientToolError

A client tool request could not be completed safely.

ClientToolExecution

Runtime capability visible only while Harnest owns an invocation.
Fields (— means no declared default):

ClientToolExecution.execute

Request one client-hosted tool call and await its validated result.

ClientToolExecution.transient_media

Return private media access already scoped to this invocation.

InMemoryClientToolStore

Development store for one-time client tool result delivery.

InMemoryClientToolStore.transient_media

Expose the lease boundary to framework adapters, never to clients.

InMemoryClientToolStore.suspend

Suspend for one result, transferring private values without retention.

InMemoryClientToolStore.submit

Validate and sanitize a client result before its framework resumes.

InMemoryClientToolStore.run_for

Return the live invocation waiting for a client tool result.

InMemoryClientToolStore.pending_for

Resolve live client calls without revealing another session’s work.

InMemoryClientToolStore.cancel

Deliver a caller cancellation through the same one-time authority gate.

PendingClientTool

One principal-scoped client tool call awaiting its result.
Fields (— means no declared default):

PendingClientTool.public

Return the client-safe fields required to execute this tool call.

ToolCallRequest

Provider-neutral arguments for one managed tool call.
Fields (— means no declared default):

ToolLifecycleContext

Stable invocation identity associated with one managed tool call.
Fields (— means no declared default):

ToolLifecycleContext.next

Continue normally or pass a replacement to the next interceptor.

ToolLifecycleContext.finish

Return a final value without advancing to later execution.

ToolLifecycleError

A tool interceptor returned invalid or ambiguous control flow.

approval

See harnest.agent.approval for its exports.

client_input

Collect private input for an async handler and return only authored JSON. The handler’s first positional parameter receives the validated private input and is excluded from the model tool signature. Remaining parameters are public request arguments. The handler must return None. response is frozen at declaration time and is the only successful model result.

client_tool

Declare a client tool with an optional runtime-principal permission tag.

client_tool_execution

Activate client-tool execution authority for the current context.

current_transient_media

Expose scoped staged bytes only during a managed invocation.

instruction_file

Read an instruction file relative to a Python module. Pass __file__ as anchor so the path remains correct in a deployed bundle and does not depend on the process working directory.

tool

Mark a typed Python function as a managed Harnest agent tool. Both managed backends wrap callables natively. This decorator preserves the function’s typed signature, checks that the model receives a description, validates an optional Pydantic result, and installs declared execution policy before backend lowering. Durable tools cross a framework-native suspension boundary and therefore must be asynchronous.