Skip to main content

dna-client (Python)

The official Python client for the DNA REST API (dna api serve). Spec-parity twin of the TypeScript dna-client: both cover the same surface, derived from the same OpenAPI document (docs/openapi.json, dumped from the FastAPI app) — so consumers stop hand-rolling HTTP.

  • Typed inputs, httpx-based, sync, context-manageable.
  • Complete — a named method for EVERY operation in the spec, reads and writes alike. client.request(...) remains as a low-level escape hatch, but no route depends on it.
  • Guarded — a drift test re-dumps the live schema and fails CI if the committed spec is stale, and fails if any operation (of any HTTP method) has no named method. Adding a write route cannot pass silently.

Install

pip install dna-client        # or: uv add dna-client

Only runtime dep is httpx. Python >= 3.12.

Usage

from dna_client import DnaClient

with DnaClient(
    "http://127.0.0.1:8080",
    token="…",                 # optional — for --auth token/config
    scope="dna-development",    # optional default applied to every call
) as dna:
    agents = dna.list_agents()
    prompt = dna.agent_prompt("jarvis")
    hits = dna.search_memories("tenancy invariant", k=3)
    board = dna.get_board("dna-development", recent=6)

    # Writes are named methods too — no escape hatch needed.
    dna.remember_memory("a lesson worth keeping", area="ops")
    dna.delete_memory("s-foo")
    dna.set_insight_state("i-42", "actioned")

    # Workspace routes are identity-scoped: the boundary comes from the caller's
    # verified claims, so they never take the client's default scope/tenant.
    ws = dna.create_workspace("Acme")           # id is minted server-side
    dna.create_invite(ws["workspace_id"], "teammate@acme.com", role="member")

Routes with security semantics say so in their docstring — e.g. create_project() is 403 without an active workspace membership, and revoke_workspace_member() is 409 on the last remaining owner.

A non-2xx response raises DnaApiError (carrying .status and the API's {"detail": ...} payload).

Note on return types

Every DNA REST handler returns an untyped JSON object (dict[str, Any]), so the OpenAPI response schemas are opaque. Request inputs (query/path params) are typed; response bodies are dict[str, Any]. Tighten the API's response models to tighten these.

Parity

This client and the TypeScript twin are generated from the SAME docs/openapi.json — spec-parity, not byte-parity. See Using the DNA client.

Download files

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

Source Distribution

dna_client-0.49.0.tar.gz (39.7 kB view details)

Uploaded Source

Built Distribution

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

dna_client-0.49.0-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file dna_client-0.49.0.tar.gz.

File metadata

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

File hashes

Hashes for dna_client-0.49.0.tar.gz
Algorithm Hash digest
SHA256 411e72e6d6e8d81d8d39793c267444781235e7eb32fa04189f0cca78a2b21bc6
MD5 fb263b184bbaf443f217acd34b321099
BLAKE2b-256 ad669d547e436c54645c1903e8518394ee9b630c9675f488e8648024d469d04a

See more details on using hashes here.

Provenance

The following attestation bundles were made for dna_client-0.49.0.tar.gz:

Publisher: release-client.yml on ruinosus/dna

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

File details

Details for the file dna_client-0.49.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for dna_client-0.49.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e4897bcf6ba3c5a6925c6f39bf966fb970aef951f1de611c4803a7a8f6d95508
MD5 36bb46c4199522988a4bf34fe4889ddd
BLAKE2b-256 68b75c695c411223faaf22e934214c7eca8e9f2248c2e452fa4cca7c55c7f069

See more details on using hashes here.

Provenance

The following attestation bundles were made for dna_client-0.49.0-py3-none-any.whl:

Publisher: release-client.yml on ruinosus/dna

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.80.0

2 files

0.79.0

2 files

0.78.0

2 files

0.77.0

2 files

0.76.0

2 files

0.75.0

2 files

0.74.0

2 files

0.73.0

2 files

0.72.0

2 files

0.71.0

2 files

0.70.0

2 files

0.69.0

2 files

0.68.0

2 files

0.67.0

2 files

0.66.0

2 files

0.65.0

2 files

0.64.0

2 files

0.63.0

2 files

0.62.0

2 files

0.61.0

2 files

0.60.0

2 files

0.59.0

2 files

0.58.0

2 files

0.57.0

2 files

0.56.0

2 files

0.55.0

2 files

0.54.0

2 files

0.53.0

2 files

0.52.0

2 files

0.51.0

2 files

0.50.0

2 files

This release

0.49.0 This release

2 files

0.48.0

2 files

0.47.0

2 files

0.46.0

2 files

0.44.0

2 files

0.43.0

2 files

0.42.0

2 files

0.41.0

2 files

0.40.1

2 files

0.40.0

2 files

0.39.0

2 files

0.26.0

2 files

0.25.2

2 files

0.25.1

2 files

0.25.0

2 files

0.24.0

2 files

0.23.0

2 files

0.22.1

2 files

0.22.0

2 files

0.21.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page