Skip to main content

dna-sdk (Python)

Python SDK for DNA — Domain Notation of Anything: a microkernel + extensions runtime for declarative agent notation. See the repository README for the thesis, the architecture and the full Kind catalog.

Install

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

Pre-release / exact-pin alternative — from the repo:

cd packages/sdk-py
uv sync            # or: pip install -e .

Optional extras: postgres, sqlite, sql (SqlAlchemySource — one adapter for both SQL dialects, same tables; see docs/PORT-CONTRACT.md § "Using the SQLAlchemy adapter") safety-ml (PII/toxicity models), github-copilot (pure GitHub Copilot SDK binding), all, dev.

Minimal example

from dna import Kernel

# Scan a scope (directory of YAML/Markdown manifests under .dna/)
mi = Kernel.quick("hello-genome", base_dir="examples/hello-genome/.dna")

# Every instance is identified by (apiVersion, kind, name)
for d in mi.instances:
    print(d.api_version, d.kind, d.name)

# Compose agent + soul + skills + guardrails into one system prompt
print(mi.build_prompt(agent="greeter"))

Runnable version: examples/hello-genome/run.py.

Runtime-neutral definitions

Use DnaClient when an application owns the runtime but wants DNA to own its declarative definitions. The client boots the configured source, resolves KindDefinitions through the Kernel, applies scope/tenant composition, and returns data-only contracts.

from dna import DnaClient

client = await DnaClient.from_env(scope="development", tenant="acme")
async with client:
    # Uses Genome.spec.default_agent; pass a name only as an explicit override.
    definition = await client.resolve_agent()
    kinds = await client.kinds.list()
    tool_kind = await client.kinds.describe("Tool")
    tools = await client.instances.list("Tool")

Source selection is DNA_SOURCE_URL then base_dir / DNA_BASE_DIR, then ./.dna. ResolvedAgent, ResolvedTool, ResolvedMcpServer, and KindDescriptor do not start a model, server, session, or event loop.

The optional GitHub Copilot binding converts one resolved definition while the consumer retains lifecycle ownership:

from dna.integrations.github_copilot import build_github_copilot_agent

agent = build_github_copilot_agent(
    definition,
    tools=[write_review_report],
    on_permission_request=permission_handler,
)

async with agent:
    session = agent.create_session()
    async for chunk in agent.run(prompt, session=session, stream=True):
        print(chunk.text or "", end="")

Install this binding with pip install "dna-sdk[github-copilot]". It maps the composed prompt, model, MCP federations and confirmation policy but does not own the Copilot CLI or execute declared tools.

Layout

dna/
├── kernel/       # Kernel (mediator over 5 ports), Instance, ManifestInstance
├── application/  # transport-neutral use cases and live source handle
├── adapters/     # filesystem (core); sqlite/postgres/sqlalchemy_ via extras
├── integrations/ # optional pure bindings to consumer-owned runtimes
├── extensions/   # helix (core Kinds) + market formats + governance
├── sync/         # lockfile + instance hashing
└── safety/       # safety pipeline (optional ML extras)

Tests

uv run pytest tests/ -v

The suite includes the market-fidelity conformance tests (tests/test_market_conformance.py) and the golden fixtures that freeze behavior crossing a boundary (tests/goldens/, tests/golden-fixtures/).

Download files

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

Source Distribution

dna_sdk-0.77.0.tar.gz (3.0 MB view details)

Uploaded Source

Built Distribution

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

dna_sdk-0.77.0-py3-none-any.whl (1.8 MB view details)

Uploaded Python 3

File details

Details for the file dna_sdk-0.77.0.tar.gz.

File metadata

  • Download URL: dna_sdk-0.77.0.tar.gz
  • Upload date:
  • Size: 3.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for dna_sdk-0.77.0.tar.gz
Algorithm Hash digest
SHA256 33c0edc683d2e50137d870f3b4066aa1fb4327b9dec3de81c6733ac5465c67a7
MD5 f76f3487ed8ea4f8e28c3a561480e7fa
BLAKE2b-256 d8eea029c2490fdb2e71c1e3fc0f24fcafe1675ef2ed9a4d32b32efe2a4a0ebe

See more details on using hashes here.

Provenance

The following attestation bundles were made for dna_sdk-0.77.0.tar.gz:

Publisher: release.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_sdk-0.77.0-py3-none-any.whl.

File metadata

  • Download URL: dna_sdk-0.77.0-py3-none-any.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for dna_sdk-0.77.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bed928ac54dc064cb93d0d42de3d459b1afc9ebaf207404074876ef8b49d06a2
MD5 9512ff029a7eb2070000738381bcf134
BLAKE2b-256 8a15aa0dc80d6fb82234491ee0f5d38aaac817437255e0df71f0c7cbb1301803

See more details on using hashes here.

Provenance

The following attestation bundles were made for dna_sdk-0.77.0-py3-none-any.whl:

Publisher: release.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

This release

0.77.0 This release

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

0.49.0

2 files

0.48.0

2 files

0.47.0

2 files

0.46.0

2 files

0.45.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.2

2 files

0.40.1

2 files

0.40.0

2 files

0.39.0

2 files

0.38.0

2 files

0.37.1

2 files

0.37.0

2 files

0.36.0

2 files

0.35.3

2 files

0.35.2

2 files

0.35.1

2 files

0.35.0

2 files

0.34.1

2 files

0.34.0

2 files

0.33.0

2 files

0.32.0

2 files

0.31.1

2 files

0.31.0

2 files

0.30.1

2 files

0.30.0

2 files

0.29.9

2 files

0.29.8

2 files

0.29.7

2 files

0.29.6

2 files

0.29.5

2 files

0.29.4

2 files

0.29.3

2 files

0.29.2

2 files

0.29.1

2 files

0.29.0

2 files

0.28.1

2 files

0.28.0

2 files

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

0.21.0

2 files

0.20.0

2 files

0.19.2

2 files

0.19.1

2 files

0.19.0

2 files

0.18.1

2 files

0.18.0

2 files

0.17.0

2 files

0.16.0

2 files

0.15.1

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

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

0.3.1

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

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