DotCode SDK — Python
Embed the DotCode coding agent in your application and drive it with any LLM (Anthropic, OpenAI, Azure OpenAI, Gemini, DeepSeek, Ollama, OpenAI-compatible). The SDK talks JSON-RPC to a dotcode serve process.
Built by Gravicode Studios, led by Kang Fadhil. · 🇮🇩 Dokumentasi Bahasa Indonesia: docs/id/sdk.md
Install
pip install dotcode-sdk
The SDK needs the dotcode CLI: put it on PATH or set DOTCODE_CLI_PATH (a path to dotcode.dll is started with dotnet). Configure providers with environment variables (ANTHROPIC_API_KEY, OPENAI_API_KEY, DEEPSEEK_API_KEY, …), ~/.dotcode/settings.json, or per session with the settings option.
Usage
import asyncio
from dotcode_sdk import DotCodeClient, tool
@tool("now", "Current time")
def now(args):
import datetime
return datetime.datetime.now().isoformat()
async def main():
async with DotCodeClient() as client: # spawns `dotcode serve`
session = await client.create_session(model="deepseek:deepseek-v4-flash", tools=[now],
on_permission_request=lambda r: {"decision": "allow"})
async for e in session.stream("What time is it? Then list the files here."):
if e["type"] == "assistant.text.delta":
print(e["text"], end="")
asyncio.run(main())
Features
- Sessions with streaming events (text deltas, tool calls, diffs, todos, usage, cost)
- Custom tools implemented in your app
- Permission handler — sessions are deny-by-default without one; decisions:
allow,allow_always,allow_session,deny(with feedback) - Question (AskUserQuestion) and plan-review handlers
- MCP servers, allowed/disallowed tool rules, permission modes, system prompt overrides, model switching, compaction, transcripts, resume/fork
Full guide: docs/en/sdk.md · Protocol: schema/protocol.schema.json
License: MIT
Metadata
Release files for dotcode-sdk 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dotcode_sdk-0.1.0.tar.gz | 10.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dotcode_sdk-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.0 kB
Release files / dotcode_sdk-0.1.0.tar.gz
| Download URL | dotcode_sdk-0.1.0.tar.gz |
|---|---|
| Size | 10.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3f802a4c2bb7f3c564081e58c20d550e32d1de1cca9f1d1c0c34de2cad2c9996
|
|
BLAKE2b-256 checksum How to use checksums |
6cb346a78bc7c0d581d9328ca4dc72e55b9b25cdc669231369260e35f5bce0ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / dotcode_sdk-0.1.0-py3-none-any.whl
| Download URL | dotcode_sdk-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d2dfa8f5acb8c808997065c48751388d9d2f4b311dbd871fcd33e26637cc0d54
|
|
BLAKE2b-256 checksum How to use checksums |
8f4434ee0809b4b25fcb80e5c9342200b155172143ca95181f12c669cff26e75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|