MemoryClient from nined-agents is the low-level client underneath the Agent class. Use it directly when you’re building multi-actor systems where different agents need separate identities, when you want full control over locking and handoff sequences, or when you need to manage worker configurations and policy bundles programmatically.
Installation
Constructor
| Parameter | Description |
|---|---|
world_id | Top-level namespace shared across workspaces. |
workspace_id | Workspace scope. All operations are isolated to this workspace. |
actor_id | Identity of this agent. Used for ownership, locking, and audit trails. |
api_key | Your API key. |
base_url | Server URL. Defaults to the hosted API. |
Bind to a different actor
Memory
ContextPack.snippets — list of Snippet (content, score, artifact_id, span_id, artifact_type)
ContextPack.pack_hash — determinism fingerprint
ContextPack.token_accounting — budget, used, snippet count
Tasks
TaskState fields: task_status, allowed_actions, protocol_hint, lock_state, is_terminal, can(action)
Locks and handoffs
Use explicit lock management when you need to guarantee atomicity across multiple actions before releasing.Multi-agent handoff pattern
client.get_timeline("deploy-v2").
Worker runtime
Run a continuous worker loop that claims and processes tasks.Custom worker loop
WorkerStats: claims, completed, released, idle
Policy
Define what each role can do across the workspace.PolicyDeniedError with a reason_code and recommended_action.
Observability
DashboardStats fields: workers (active/total), tasks (completed/active/…), connections (connected/total)
Determinism check
Error types
| Exception | When raised |
|---|---|
MemoryAPIError | Base — unexpected API errors |
PolicyDeniedError | Action blocked by workspace policy. Has reason_code + recommended_action. |
ConflictError | Lock contention or stale handoff |
AuthorizationError | Missing or invalid credentials |
RateLimitError | 429. Has retry_after (seconds). |