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()

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nvoken-0.31.0.tar.gz (260.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nvoken-0.31.0-py3-none-any.whl (890.6 kB view details)

Uploaded Python 3

File details

Details for the file nvoken-0.31.0.tar.gz.

File metadata

  • Download URL: nvoken-0.31.0.tar.gz
  • Upload date:
  • Size: 260.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for nvoken-0.31.0.tar.gz
Algorithm Hash digest
SHA256 1f81a267874afa41adedc63583c28ce805becc1186b1e5887370072deaffc276
MD5 d5cb3af4fc3702457a729da16fe46ae8
BLAKE2b-256 7915c648644d3bca00e9a57812c37eecba3dc62b46a8ba32a4038e2c9db7cd7e

See more details on using hashes here.

Provenance

The following attestation bundles were made for nvoken-0.31.0.tar.gz:

Publisher: release-pypi.yml on deepnoodle-ai/nvoken

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nvoken-0.31.0-py3-none-any.whl.

File metadata

  • Download URL: nvoken-0.31.0-py3-none-any.whl
  • Upload date:
  • Size: 890.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for nvoken-0.31.0-py3-none-any.whl
Algorithm Hash digest
SHA256 73b6ad5623f0fee6bb1a267efa82956660e7b576b0ccce801c9391cdcdf3fd5e
MD5 4ef207c19883b241207c80ee6ab101af
BLAKE2b-256 9513a50f7a414c399da9a93806da218aa53058e4b6ddc41788736330805f7167

See more details on using hashes here.

Provenance

The following attestation bundles were made for nvoken-0.31.0-py3-none-any.whl:

Publisher: release-pypi.yml on deepnoodle-ai/nvoken

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.35.0

2 files

0.34.0

2 files

0.33.0

2 files

0.32.0

2 files

This release

0.31.0 This release

2 files

0.30.0

2 files

0.29.0

2 files

0.28.0

2 files

0.27.0

2 files

0.26.0

2 files

0.25.0

2 files

0.24.0

2 files

0.23.0

2 files

0.22.0

2 files

0.21.0

2 files

0.20.0

2 files

0.19.0

2 files

0.18.0

2 files

0.17.0

2 files

0.16.0

2 files

0.15.0

2 files

0.14.0

2 files

0.13.0

2 files

0.12.0

2 files

0.11.0

2 files

0.10.0

2 files

0.9.1

2 files

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