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
StartStreamand hosts the dial-backStreamendpoint itself. - Not the wire contract: protos come from the
agentic-mesh-protocolpackage.
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
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| digitalkin-1.0.6.tar.gz | 403.6 kB | With provenance | Details for digitalkin-1.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| digitalkin-1.0.6-py3-none-any.whl | Python 3 | none | any | Details for digitalkin-1.0.6-py3-none-any.whl |
Total release size: 927.0 kB
Release files / digitalkin-1.0.6.tar.gz
| Download URL | digitalkin-1.0.6.tar.gz |
|---|---|
| Size | 403.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
97d9a86ee63bfae4846c43ff1e8bec292c8e538b655d077e8a778632e230bf05
|
|
BLAKE2b-256 checksum How to use checksums |
005a07f3197aa842193c02515a7e735b4e47cf150d862b96ff31f8f8af07b229
|
| 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 18, 2026.
Transparency logRelease files / digitalkin-1.0.6-py3-none-any.whl
| Download URL | digitalkin-1.0.6-py3-none-any.whl |
|---|---|
| Size | 523.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
46811634dc39e1f4b6fc9029b0081a5ae11e276e3c9aa46dfc5d5ccc61aa3148
|
|
BLAKE2b-256 checksum How to use checksums |
0858134c0ba8d2376c1a7800ba203939346ea1ee54d07e2c8aa296d192dedd22
|
| 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 18, 2026.
Transparency logSecurity for digitalkin 1.0.6
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.
Attestation for digitalkin-1.0.6.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 18, 2026.
Transparency logA 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.