Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

DigitalKin Python SDK

digitalkin is the Python SDK for writing modules (tools and archetypes) of the DigitalKin agentic mesh. You declare typed Pydantic contracts and trigger handlers; the SDK serves them over gRPC. Each module process embeds a gateway that persists outputs to Redis Streams and pushes them to the consumer.

What it is not

  • Not a standalone gateway process: the gateway runs inside each module server.
  • Not a registry server: modules register with an external registry in remote mode.
  • Not a client library: the consumer calls StartStream and hosts the dial-back Stream endpoint itself.
  • Not the wire contract: protos come from the agentic-mesh-protocol package.

Install

uv add digitalkin or pip install digitalkin (Python 3.10+); add [agno] for the Agno integration. Extras: agno (Agno integration), performance (uvloop), profiling.

Quick start

Files: echo_module.py, server.py, triggers/__init__.py, triggers/echo_trigger.py (discovery imports *_trigger.py).

# echo_module.py
from typing import Any, ClassVar, Literal
from pydantic import BaseModel
from digitalkin import ModuleContext, ToolModule
from digitalkin.models.module import DataModel, DataTrigger, SetupModel
from digitalkin.utils.package_discover import ModuleDiscoverer

class EchoIn(DataTrigger):
    protocol: Literal["message"] = "message"
    text: str

class EchoOut(DataTrigger):
    protocol: Literal["message"] = "message"
    reply: str

class EchoInput(DataModel[EchoIn]):
    root: EchoIn

class EchoOutput(DataModel[EchoOut]):
    root: EchoOut

class EchoSetup(SetupModel):
    prefix: str = "echo: "

class EchoModule(ToolModule[EchoInput, EchoOutput, EchoSetup, BaseModel]):
    name = "EchoModule"
    description = "Echoes the input text."
    input_format = EchoInput
    output_format = EchoOutput
    setup_format = EchoSetup
    secret_format = BaseModel  # no secrets
    metadata: ClassVar[dict[str, Any]] = {"module_id": "modules:echo", "version": "0.1.0"}
    services_config_params: ClassVar[dict[str, Any]] = {"storage": {"config": {}}, "cost": {"config": {}}}
    triggers_discoverer = ModuleDiscoverer(packages=["triggers"])

    async def initialize(self, context: ModuleContext, setup_data: EchoSetup) -> None:
        pass  # open clients, build agents

    async def cleanup(self) -> None:
        pass
# triggers/echo_trigger.py
from digitalkin import ModuleContext, TriggerHandler
from echo_module import EchoIn, EchoModule, EchoOut, EchoOutput, EchoSetup

@EchoModule.register
class EchoTrigger(TriggerHandler):
    protocol = "message"
    input_format = EchoIn
    output_format = EchoOut

    async def handle(self, input_data: EchoIn, setup_data: EchoSetup, context: ModuleContext) -> None:
        reply = EchoOut(reply=setup_data.prefix + input_data.text)
        await context.callbacks.send_message(EchoOutput(root=reply))
# server.py
import asyncio
from digitalkin.grpc_servers.module_server import ModuleServer
from echo_module import EchoModule

async def main() -> None:
    server = ModuleServer(EchoModule)
    await server.start_async()
    try:
        await server.await_termination()
    finally:
        await server.stop_async()

asyncio.run(main())
docker compose -f examples/redis_demo/docker-compose.yml up -d     # Redis on localhost:6379
SERVICE_MODE=local DIGITALKIN_REDIS_URL=redis://localhost:6379/0 python server.py

The server listens on SERVER_CHANNEL_HOST:SERVER_CHANNEL_PORT (default [::]:50055). SERVICE_MODE=local (or -d LOCAL) uses in-process services; remote mode (default) needs the variables in .env.minimum. Consumers drive the module with the gateway RPCs described in the gateway protocol page.

Documentation

Topic Page
Architecture, data and signal flow docs/architecture.md
Writing modules docs/module_authoring.md
Wire contracts docs/gateway_protocol.md, docs/agui_events.md (AG-UI)
Deploy and tune docs/operations.md
Environment variables docs/environment_variables.md
Testing docs/testing.md
Changelog docs/changelog/index.md
API reference docs/api/api.md

Development

task setup-dev     # venv, dev/docs/tests deps, pre-commit hooks
task check         # ruff format + lint, mypy, tests
task run-tests     # full suite in docker compose (needs Redis)
task docs-serve    # mkdocs serve

License: CC BY-NC-SA 4.0.

Metadata

Release files for digitalkin 1.0.6.dev4

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

Source distribution (sdist)

Source distribution for digitalkin 1.0.6.dev4
File Size Uploaded Provenance Actions
digitalkin-1.0.6.dev4.tar.gz 401.4 kB With provenance Details for digitalkin-1.0.6.dev4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for digitalkin 1.0.6.dev4
File Interpreter ABI Platform Actions
digitalkin-1.0.6.dev4-py3-none-any.whl Python 3 none any Details for digitalkin-1.0.6.dev4-py3-none-any.whl

Total release size: 922.9 kB

Release files / digitalkin-1.0.6.dev4.tar.gz

Download URL digitalkin-1.0.6.dev4.tar.gz
Size 401.4 kB
Tags Source
SHA-256 checksum
How to use checksums
519d6722d2fbb5bd365846dedae6c6f8c7de9fffd125ea601b12155270e186b0
BLAKE2b-256 checksum
How to use checksums
165027eee5dfc320851bd7266b7077fb06fe79f739843c4f218298a39985f06e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 4, 2026.

Transparency log

Release files / digitalkin-1.0.6.dev4-py3-none-any.whl

Download URL digitalkin-1.0.6.dev4-py3-none-any.whl
Size 521.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c08e42f6e37c5c430a3330d4171d845449cecf43f52ce55a648403d27ff840b3
BLAKE2b-256 checksum
How to use checksums
bb56bc887d7bec72bb832a0ea52237192f647b637073073c85f9c3f593ec9789
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 4, 2026.

Transparency log

Security for digitalkin 1.0.6.dev4

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for digitalkin-1.0.6.dev4.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 Nov 4, 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
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