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.80.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.80.0-py3-none-any.whl (1.8 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dna_sdk-0.80.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.80.0.tar.gz
Algorithm Hash digest
SHA256 30a95dd945f1942670a58c03bf2f07c766aa99d54912d230e3323933370c2d27
MD5 b54aae040cf6bdd65489648382b75020
BLAKE2b-256 d2feb73e283e095bc20633f19cfb8eb9254c2ff46dd91d85944844299f6bc385

See more details on using hashes here.

Provenance

The following attestation bundles were made for dna_sdk-0.80.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.80.0-py3-none-any.whl.

File metadata

  • Download URL: dna_sdk-0.80.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.80.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f16687067bbeff487afc18ccc1d25ef9f7014938ffadf7a670400f2dccfc853
MD5 43555844c024df1713e139f56d49f610
BLAKE2b-256 71f0b8f96b3d8f95265e33b2aa068821963ad5d507199264845bcf32356ae5cd

See more details on using hashes here.

Provenance

The following attestation bundles were made for dna_sdk-0.80.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

This release

0.80.0 This release

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

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