Skip to main content

nvoken Python SDK

The Python SDK gives an application a local-feeling facade over nvoken's durable Agent runtime. Reusable behavior is an Agent; one execution is a Turn; continuity is an explicit Conversation; memory is selected independently.

pip install nvoken

Run a stored Agent

Looking up an Agent is awaited because it performs a remote read and fails immediately when the exact key does not exist. An omitted owned_by means the App-owned namespace.

import os
from nvoken import Client

async with Client(os.environ["NVOKEN_API_KEY"]) as client:
    analyst = await client.agent("real-estate-analyst")
    answer = await analyst.text(
        "Compare these two listings",
        tenant="acme",
        user="alice",
    )

Tenant- and user-owned Agent keys are explicit:

from nvoken import OwnedBy

custom = await client.agent("assistant", owned_by=OwnedBy("acme"))
personal = await client.agent("assistant", owned_by=OwnedBy("acme", "alice"))

The Agent's owner, the Turn actor, Conversation ownership, and memory scope are independent. Every execution states its tenant; user, memory, conversation, and narrowed limits are optional per-execution coordinates.

from nvoken import ConversationRef, Memory

turn = await analyst.start(
    "Analyze the offer",
    tenant="acme",
    user="alice",
    memory=Memory.tenant("deal-team"),
    conversation=ConversationRef.by_key("deal-42", owner="user"),
    limits={"max_iterations": 6},
)

snapshot = await turn.status()
result = await turn.result(timeout=60)

start() returns after durable admission. run() is start() followed by result(). text() additionally requires text output. Dropping a waiter or update iterator never cancels the Turn. A local timeout= covers admission and waiting; TurnTimeoutError retains the admitted Turn, or the idempotency key when admission itself timed out, so callers can recover without starting duplicate work.

Inline behavior

inline() is local and makes no request until execution:

from nvoken import Behavior, InlineMemory

classifier = client.inline(Behavior(
    instructions="Classify the request as sales, support, or billing.",
    model="anthropic/claude-sonnet-5",
    output_schema={
        "type": "object",
        "properties": {"queue": {"type": "string"}},
        "required": ["queue"],
        "additionalProperties": False,
    },
))

result = await classifier.run(
    "I need a copy of last month's invoice",
    tenant="acme",
    memory=InlineMemory.none(),
)

Inline tenant or user memory requires an explicit namespace. Anonymous Turns are memoryless.

Host tools

Tool contracts belong to behavior. bind_tools() attaches only process-local handlers by exact name and returns a new wrapper; it does not change durable behavior or the idempotency fingerprint.

async def lookup_property(arguments, context):
    return {"address": arguments["address"], "status": "active"}

ready = analyst.bind_tools({"lookup_property": lookup_property})
answer = await ready.text("Check 10 Main St", tenant="acme", user="alice")

The handler context carries the exact turn_id, tool_call_id, and local cancellation state. Replayed projections do not repeat a handled call; a failed submission clears the local guard so it can be retried. If a compatible handler is absent, the durable Turn remains waiting for another process.

Conversation binding and Turn recovery

conversation = analyst.conversation(
    ConversationRef.by_key("deal-42", owner="tenant"),
    tenant="acme",
    user="alice",
    memory=Memory.tenant("deal-team"),
)
answer = await conversation.text("What changed since yesterday?")

# Synchronous: no request until status/result/updates is used.
recovered = client.turn(saved_turn_id, tenant="acme", user="alice")
result = await recovered.bind_tools({"lookup_property": lookup_property}).result()

# Stop a running Turn and keep what it produced.
stopping = await recovered.interrupt()

interrupt() returns the Turn's state as of the request, which is often still running: mid-step the runtime records the request and stops at the next checkpoint. Follow updates() or result() for settlement rather than reading that status as final. Interrupting a Turn that already ended returns it unchanged and does not raise.

Read a Conversation back with transcript(). It returns the Conversation resource, its messages, its compactions, and the cursor a stream resumes from, so one read restores a page:

window = await conversation.transcript(limit=50)
while window.has_more:
    window = await conversation.transcript(limit=50, page_token=window.next_page_token)

Every page of one walk carries the cursor of the cut the walk started from, so paging back through older history never moves the stream's resume position. The handle must name a Conversation by id; a key-bound handle learns its id from the admission of its first Turn.

Agent lifecycle and exact HTTP access

from nvoken import Behavior

agent = await client.agents.create(
    "real-estate-analyst",
    name="Real Estate Analyst",
    behavior=Behavior(
        instructions="Analyze properties and local market conditions.",
        model="anthropic/claude-sonnet-5",
    ),
)

revision = await agent.publish(
    Behavior(
        instructions="Analyze properties, market conditions, and financing.",
        model="anthropic/claude-sonnet-5",
    ),
)

Create and publish generate idempotency keys when omitted. Pass an explicit key when the host needs to coordinate retries itself.

client.raw exposes the exact generated OpenAPI APIs, including agents, conversations, memory_spaces, and turns, for management or wire-level operations the facade does not simplify.

Metadata

Release files for nvoken 0.35.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nvoken 0.35.0
File Size Uploaded Provenance
nvoken-0.35.0.tar.gz 271.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for nvoken 0.35.0
File Interpreter ABI Platform
nvoken-0.35.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.2 MB

Release files / nvoken-0.35.0.tar.gz

Download URL nvoken-0.35.0.tar.gz
Size 271.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e0f4bcc6b606601849ddc22664c2ca620f4a559f1eaa3211e47c4be55c57ab6a
BLAKE2b-256 checksum
How to use checksums
a9883b3498bb6402249237e21338e773b3aa7b5509a042a0bcab2c375dbb3209
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.

Transparency log

Release files / nvoken-0.35.0-py3-none-any.whl

Download URL nvoken-0.35.0-py3-none-any.whl
Size 939.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
72c6aa16bc94ccd166d9a544a0b345808aa92cea71c1e39c0e3a9c3626a7e22b
BLAKE2b-256 checksum
How to use checksums
6ac49f5423c1f94f9f07d789163d83d4a94bc4696123c87aea9c126863b2538b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.

Transparency log

Security for nvoken 0.35.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for nvoken-0.35.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page