from harnest import context for capabilities bound to the current managed invocation. Access to a capability does not extend its lifetime beyond that invocation.
Invocation capabilities
These attributes are resolved at runtime rather than stored as module globals. Use the linked types for their methods; accessing a managed property during import or outside its required runtime raises an availability error.context.user_id, context.session_id, and context.invocation_id read from the active AgentContext. See Agent runtime principals for authorization and Tasks for task-initiated agent calls.
Memory operations
Session operations
Exports
AgentContext
Stable invocation identity and its explicitly exported resources. Obtain this object from the owning Harnest API; its constructor includes runtime bindings. Fields (— means no declared default):
Example
Example
AgentContext.resource
Parameters and example
Parameters and example
AgentContext.is_root
Report whether this scope represents the compiled root agent.Example
Example
AgentContinuationUnsupportedError
A local invocation reached a continuation its caller cannot service.Example
Example
AgentInvocationTimeout
An in-process agent invocation exceeded its configured deadline.Example
Example
AgentInvocationUnavailableError
No compiled runtime is bound to the current authored task.Example
Example
AgentPendingResponse
A persisted external wait that can be resumed by the owning runtime.— means no declared default):
Parameters and example
Parameters and example
AgentPendingResponse.as_dict
Example
Example
AgentResponse
Framework-neutral result returned by an in-process invocation.— means no declared default):
Parameters and example
Parameters and example
AgentResponse.as_dict
Example
Example
AgentSession
One persisted session owned by a local in-process runtime identity. Obtain this object from the owning Harnest API; its constructor includes runtime bindings. Fields (— means no declared default):
Example
Example
AgentSession.invoke
Parameters and example
Parameters and example
AgentSession.stream
Parameters and example
Parameters and example
AgentSessionNotFoundError
An identity-scoped local session does not exist.Example
Example
AgentStreamItem
One portable runtime event or the validated terminal response.— means no declared default):
Parameters and example
Parameters and example
AgentStreamItem.as_dict
Example
Example
ContextRegistration
Metadata declaring the name and order of one context provider.— means no declared default):
Parameters and example
Parameters and example
ContextResourceError
Raised when an invocation does not contain a requested resource.Example
Example
ContextUnavailableError
Raised when agent context is accessed outside a Harnest invocation.Example
Example
LocalAgentRuntime
Invoke a final compiled runtime driver without an HTTP round trip.Parameters and example
Parameters and example
LocalAgentRuntime.user_id
Return the session owner selected by the local caller.Example
Example
LocalAgentRuntime.create_session
Parameters and example
Parameters and example
LocalAgentRuntime.open_session
Parameters and example
Parameters and example
MemoryContext
Access explicit memories across sessions within one application/user scope.Parameters and example
Parameters and example
MemoryContext.namespace
Parameters and example
Parameters and example
MemoryContext.put
Parameters and example
Parameters and example
MemoryContext.get
Parameters and example
Parameters and example
MemoryContext.list
Parameters and example
Parameters and example
MemoryContext.search
Parameters and example
Parameters and example
MemoryContext.delete
Parameters and example
Parameters and example
ScopedAssets
Named asset capabilities restricted to one authenticated invocation. Obtain this object from the owning Harnest API; its constructor includes runtime bindings.Example
Example
ScopedAssets.call
Parameters and example
Parameters and example
ScopedAssets.save
Parameters and example
Parameters and example
ScopedAssets.stat
Parameters and example
Parameters and example
ScopedAssets.open
Parameters and example
Parameters and example
ScopedAssets.get
Parameters and example
Parameters and example
ScopedAssets.delete
Parameters and example
Parameters and example
ScopedAssets.url
Parameters and example
Parameters and example
SessionContext
Provide JSON-safe access to the current session’s application-data lane. Obtain this object from the owning Harnest API; its constructor includes runtime bindings.Example
Example
SessionContext.get
Parameters and example
Parameters and example
SessionContext.set
Parameters and example
Parameters and example
SessionContext.update
Parameters and example
Parameters and example
SessionContext.delete
Parameters and example
Parameters and example
SessionContext.namespace
Parameters and example
Parameters and example
SessionDataError
Raised when application session data violates its scoped contract.Example
Example
StorageContext
Resolve custom storage without exposing sessions or checkpoints.Example
Example
StorageContext.call
Parameters and example
Parameters and example
StorageContext.resource
Parameters and example
Parameters and example
activate_agent_scope
Narrow managed identity to the framework component currently executing.Parameters and example
Parameters and example
current
Return the active managed invocation context.Example
Example
derive_agent_context
Create a child view that shares only its parent’s revocable capabilities.Parameters and example
Parameters and example
provider
Declare one invocation-scoped resource on the public context namespace.Parameters and example
Parameters and example
resource
Resolve one explicitly published invocation resource.Parameters and example
Parameters and example
SandboxHandle
Access this facade throughcontext.sandboxes["name"]; its implementation type is not a public import.
A revocable agent-and-invocation-bound execution capability.
SandboxHandle.execute
Parameters and example
Parameters and example
SandboxHandle.aexecute
Parameters and example
Parameters and example