Dymium SDK for secure data and AI interactions
Project description
Python SDK (Reference)
This is the reference implementation. All other language SDKs must conform to the behavior defined here and in sdk/spec.
Package layout:
dymium/core/Contracts and shared utilitiesdymium/runtime/SecureRuntime orchestration loopdymium/adapters/Provider adapters (LLM, PII, MCP)dymium/tools/Tool registry and execution boundariesdymium/types/Generated types fromsdk/spec
Hugging Face local PII detector (optional deps):
dymium/adapters/pii/huggingface.py(HuggingFacePIIDetector)- install extras:
pip install "dymium[hf]"
Quick start (factory-based)
from dymium import SecureRuntime, RuntimeConfig
config = RuntimeConfig(
model="openai:gpt-5",
pii="dymium_hf",
model_config={"api_key": "..."},
pii_config={"model_id": "dymium/Dymium-NER-v1"},
mcp={"base_url": "http://localhost:7000"},
)
runtime = SecureRuntime.from_config(config)
# Optional: stateful multi-turn session
session = runtime.session()
result = session.run("Hello! My SSN is 123-45-6789.")
Multiple MCP servers
from dymium import SecureRuntime, RuntimeConfig
config = RuntimeConfig(
model="openai:gpt-5",
pii="dymium_hf",
model_config={"api_key": "..."},
pii_config={"model_id": "dymium/Dymium-NER-v1"},
mcp={
"servers": [
{"name": "ghost", "adapter": "mcp", "base_url": "http://ghostmcp.local", "api_key": "..."},
{"name": "ext", "adapter": "mcp", "base_url": "http://localhost:7001"},
],
"prefix_tools": True,
"separator": "::",
},
)
runtime = SecureRuntime.from_config(config)
Multi-turn (session)
from dymium import SecureRuntime, RuntimeConfig
runtime = SecureRuntime.from_config(RuntimeConfig(
model="openai:gpt-5",
pii="dymium_hf",
model_config={"api_key": "..."},
pii_config={"model_id": "dymium/Dymium-NER-v1"},
mcp={"base_url": "http://localhost:7000"},
))
session = runtime.session()
session.run("My email is me@example.com.")
session.run("Can you summarize what I told you?")
Tool types (direct vs delegated)
Every tool must declare tool_type.
direct tools are non-agentic boundaries (local functions, DB/API calls, deterministic services).
direct tools must also declare input_mode:
resolve: materialize originals only at execution time. Commonresolvecases: identity/account lookups, order/ticket retrieval APIs, and parameterized DB queries keyed by sensitive identifiers.protect: keep placeholders in direct tool args.
delegated tools are agentic handoffs to another runtime (sub-agent or remote agent).
Unlike direct, delegated handoffs cross into another LLM/tool loop outside the parent loop.
Dymium keeps inputs protected and forwards runtime context instead of resolving originals at the parent boundary.
Policy location:
SecureRuntime: settool_type(andinput_modefor direct tools) on each tool definition.- Framework integrations: set
tool.metadata["dymium"]["tool_type"]andtool.metadata["dymium"]["input_mode"](required for direct tools).
Delegated handoffs use transport-managed delegation (delegated_transport / DelegatedTransport).
Delegated context is runtime-managed by Dymium.
For SecureRuntime, delegated cross-instance calls can be automatic with delegated_transport
on a local delegated tool (no custom handler needed). The runtime forwards
dymium_context, including placeholderMap.
Remote delegated targets must also run Dymium security (another SecureRuntime instance or
an integration path using Dymium sanitizer/middleware) to stay in the same security plane.
For integration-managed tools (LangChain/LangGraph/LlamaIndex), use DelegatedTransport.
Keep tool signatures business-only; Dymium owns delegated context propagation internally.
DelegatedTransport.as_tool_handler() is the simplest path for remote delegated calls without manual context plumbing.
Install (local dev)
From SDK/python:
pip install -e .
Examples
The examples/ directory includes four runnable demos:
examples/secure_runtime_demo.pyexamples/langchain_demo.pyexamples/langgraph_demo.pyexamples/llamaindex_demo.py
All four examples use Dymium's Hugging Face detector with model id default:
dymium/Dymium-NER-v1(override withDYMIUM_PII_MODEL)
Example focus:
secure_runtime_demo.py: runtime-config path with directprotect/resolvetools and a local delegated specialist tool.langchain_demo.py: middleware integration with directprotect/resolvetools and a local delegated specialist tool.langgraph_demo.py: graph integration with directprotect/resolvetools and a local delegated specialist tool.llamaindex_demo.py: workflow integration with directprotect/resolvetools and a local delegated specialist tool.
Run from SDK/python:
python examples/secure_runtime_demo.py
python examples/langchain_demo.py
python examples/langgraph_demo.py
python examples/llamaindex_demo.py
Publish (PyPI)
python -m build
twine upload dist/*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dymium-0.1.3.tar.gz.
File metadata
- Download URL: dymium-0.1.3.tar.gz
- Upload date:
- Size: 62.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1bd4a37d59ab467e3a3aff2064d0c974442dee72141a6edf2bda3610bb60bee1
|
|
| MD5 |
8bb42086c020e8fc5c8707747c4e1965
|
|
| BLAKE2b-256 |
3adea3777e15ac7e2432e6845649fe3d6f4e41cebd0439eed56947f94924c16f
|
Provenance
The following attestation bundles were made for dymium-0.1.3.tar.gz:
Publisher:
release-python.yml on dymium-io/Dymium-SDK
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dymium-0.1.3.tar.gz -
Subject digest:
1bd4a37d59ab467e3a3aff2064d0c974442dee72141a6edf2bda3610bb60bee1 - Sigstore transparency entry: 1086614044
- Sigstore integration time:
-
Permalink:
dymium-io/Dymium-SDK@616a9d7dd1c66ff91f7b9f69d4c6fcf5c924bc07 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/dymium-io
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@616a9d7dd1c66ff91f7b9f69d4c6fcf5c924bc07 -
Trigger Event:
pull_request
-
Statement type:
File details
Details for the file dymium-0.1.3-py3-none-any.whl.
File metadata
- Download URL: dymium-0.1.3-py3-none-any.whl
- Upload date:
- Size: 93.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d0853ccd641ef26707e32e69e4ee8a5f6dcfea8bb5dd297721c77af60255dd9
|
|
| MD5 |
0781dc1624ab46512e04d9582534df73
|
|
| BLAKE2b-256 |
a4a2010124d698e785583431e27cd05bca3ddd78085f4ae4c0bda80faebb8f8b
|
Provenance
The following attestation bundles were made for dymium-0.1.3-py3-none-any.whl:
Publisher:
release-python.yml on dymium-io/Dymium-SDK
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dymium-0.1.3-py3-none-any.whl -
Subject digest:
9d0853ccd641ef26707e32e69e4ee8a5f6dcfea8bb5dd297721c77af60255dd9 - Sigstore transparency entry: 1086614086
- Sigstore integration time:
-
Permalink:
dymium-io/Dymium-SDK@616a9d7dd1c66ff91f7b9f69d4c6fcf5c924bc07 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/dymium-io
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@616a9d7dd1c66ff91f7b9f69d4c6fcf5c924bc07 -
Trigger Event:
pull_request
-
Statement type: