No project description provided
Project description
DeepStrike Python SDK
Agent framework built on a Rust kernel. The kernel handles loop control, context compression, skill routing, governance, signal prioritization — the SDK handles all I/O.
Install
pip install deepstrike
Requires Python 3.10+. The Rust kernel is distributed as a pre-built wheel (deepstrike._kernel).
Quick start
import asyncio
from deepstrike import Agent, OpenAIProvider, tool
@tool(name="add", description="Add two numbers.", parameters={
"type": "object",
"properties": {"x": {"type": "integer"}, "y": {"type": "integer"}},
"required": ["x", "y"],
})
async def add(args):
return str(args["x"] + args["y"])
agent = Agent(OpenAIProvider(api_key="sk-...", model="gpt-5-mini"), max_tokens=4096, max_turns=25)
agent.register(add)
asyncio.run(agent.run("What is 17 + 28?"))
# => "done in 2 turns (completed)"
Streaming:
async for event in agent.run_streaming("Summarize README.md"):
if isinstance(event, TextDelta):
print(event.delta, end="", flush=True)
elif isinstance(event, ToolCallEvent):
print(f"\n[→ {event.name}]")
elif isinstance(event, DoneEvent):
print(f"\ndone in {event.iterations} turns ({event.status})")
Providers
| Class | Backend | Notes |
|---|---|---|
OpenAIProvider |
OpenAI API | SSE tool-call accumulation |
AnthropicProvider |
Anthropic API | Native SSE, ThinkingDelta support |
QwenProvider |
DashScope | enable_thinking via extensions |
DeepSeekProvider |
DeepSeek API | Reasoner models strip tools automatically |
MiniMaxProvider |
MiniMax API | M1 reasoning via expose_reasoning |
OllamaProvider |
Local Ollama | http://localhost:11434 default |
KimiProvider |
Moonshot API |
All providers accept RetryConfig for exponential backoff and share a CircuitBreaker.
Agent options
agent = Agent(
provider,
max_tokens=4096, # context window size
max_turns=25, # max turns (default 25)
timeout_ms=60_000, # timeout in ms (None = no limit)
extensions={"temperature": 0.1},
skill_dir="./skills", # skill .md files directory
knowledge_source=my_ks, # KnowledgeSource implementation
governance=gov, # kernel Governance instance
signal_router=router, # SignalRouter for external signals
dream_store=my_store, # DreamStore for long-term memory
agent_id="my-agent", # required with dream_store for memory meta-tool
)
Tools
from deepstrike import tool, read_file
agent.register(tool(name="search", description="Search.", parameters=schema)(my_fn))
agent.register(read_file())
agent.unregister("search")
agent.block_tool("bash")
Skills
Set skill_dir — the kernel auto-injects a skill meta-tool, and the LLM loads skills by name on demand.
agent = Agent(provider, max_tokens=4096, max_turns=25, skill_dir="./skills")
---
name: summarize
description: Summarize text into 2-3 concise bullet points
when_to_use: When you need to condense long text
effort: 1
---
1. Identify the 2-3 most important points
2. Express each as a concise bullet
Knowledge
Implement KnowledgeSource — the kernel injects a knowledge meta-tool.
from deepstrike import KnowledgeSource
class VectorSearch(KnowledgeSource):
async def retrieve(self, query: str, top_k: int = 5) -> list[str]:
return await vector_db.search(query, top_k)
agent = Agent(provider, max_tokens=4096, max_turns=25, knowledge_source=VectorSearch())
Memory
WorkingMemory (in-session scratch pad)
from deepstrike import WorkingMemory
mem = WorkingMemory()
mem.set("step", 1)
mem.get("step") # 1
mem.clear()
DreamStore (long-term memory + dreaming pipeline)
from deepstrike import DreamStore
class MyStore(DreamStore):
async def load_sessions(self, agent_id): ...
async def load_memories(self, agent_id): ...
async def commit(self, agent_id, result, existing): ...
async def search(self, agent_id, query, top_k): ...
agent = Agent(provider, max_tokens=4096, max_turns=25,
dream_store=MyStore(), agent_id="my-agent")
# In-session: LLM calls memory(query) → DreamStore.search()
# Post-session: trigger memory consolidation
result = await agent.dream("my-agent", now_ms=int(time.time() * 1000))
Governance
SDK PermissionManager
from deepstrike import PermissionManager, PermissionMode
pm = PermissionManager(PermissionMode.DEFAULT)
pm.grant("fs", "read")
pm.revoke("db", "drop")
pm.evaluate("fs", "read") # PermissionDecision(allowed=True, ...)
Kernel Governance (full pipeline)
from deepstrike import Governance
gov = Governance("allow")
gov.add_permission_rule("danger.*", "deny")
gov.block_tool("rm_rf")
gov.set_rate_limit("api_call", max_calls=10, window_ms=60_000)
agent = Agent(provider, max_tokens=4096, max_turns=25, governance=gov)
# Every tool call: Permission → Veto → RateLimit → Constraint → Audit
Signals
from deepstrike import SignalGateway, ScheduledPrompt, RuntimeSignal
gw = SignalGateway()
rx = gw.subscribe()
gw.schedule(ScheduledPrompt(goal="standup", run_at_ms=target_time))
gw.ingest(RuntimeSignal(kind="interrupt", payload={}, priority=10))
agent.interrupt() # direct interrupt
gw.destroy()
Harness (evaluation framework)
from deepstrike import SinglePassHarness, EvalLoopHarness, HarnessLoop, HarnessRequest
# 1. SinglePass — run once, always passes
outcome = await SinglePassHarness(agent).run(HarnessRequest(goal="Say hello"))
# 2. EvalLoop — retry until QualityGate passes
class ContainsHello(QualityGate):
async def evaluate(self, request, outcome) -> bool:
return "hello" in outcome.result.lower()
outcome = await EvalLoopHarness(agent, gate=ContainsHello(), max_attempts=3).run(req)
# 3. HarnessLoop — LLM-as-judge with feedback injection + skill extraction
loop = HarnessLoop(agent, eval_provider=eval_provider, max_attempts=3, skill_dir="./skills")
outcome = await loop.run(HarnessRequest(goal="Write a haiku", criteria=["Must be 3 lines"]))
print(outcome.passed, outcome.feedback)
Stream events
| Class | Key fields |
|---|---|
TextDelta |
delta |
ThinkingDelta |
delta |
ToolCallEvent |
id, name, arguments |
ToolResultEvent |
call_id, content, is_error |
DoneEvent |
iterations, total_tokens, status |
ErrorEvent |
message |
status: completed · max_turns · token_budget · timeout · user_abort · error
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 Distributions
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 deepstrike-0.1.4.tar.gz.
File metadata
- Download URL: deepstrike-0.1.4.tar.gz
- Upload date:
- Size: 90.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
defe3100ecfb71d1a32f46d212ef2756a82c8e5d71b230d99b528cf9170f034f
|
|
| MD5 |
fb7f1ffd3be01ad2e9c9072d703661be
|
|
| BLAKE2b-256 |
b98dd9f618d85ad57a491bae5e1ca390b746bc6d1865be72872e653777db42f0
|
Provenance
The following attestation bundles were made for deepstrike-0.1.4.tar.gz:
Publisher:
release-python.yml on kongusen/deepstrike
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deepstrike-0.1.4.tar.gz -
Subject digest:
defe3100ecfb71d1a32f46d212ef2756a82c8e5d71b230d99b528cf9170f034f - Sigstore transparency entry: 1524444819
- Sigstore integration time:
-
Permalink:
kongusen/deepstrike@262a036ab53571de839b03e56e40438c97d49723 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/kongusen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@262a036ab53571de839b03e56e40438c97d49723 -
Trigger Event:
push
-
Statement type:
File details
Details for the file deepstrike-0.1.4-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: deepstrike-0.1.4-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 433.0 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2c9afcc82d54d6e6c7d82ba4a7726a3ef9f0026f18195622aa44c81e62efa1d
|
|
| MD5 |
2ad26fa1d566460ca56c5063c8a406bf
|
|
| BLAKE2b-256 |
e5f282a593e4437f15e3502356a67f59819da31102452244d498f02766d65a96
|
Provenance
The following attestation bundles were made for deepstrike-0.1.4-cp312-cp312-win_amd64.whl:
Publisher:
release-python.yml on kongusen/deepstrike
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deepstrike-0.1.4-cp312-cp312-win_amd64.whl -
Subject digest:
e2c9afcc82d54d6e6c7d82ba4a7726a3ef9f0026f18195622aa44c81e62efa1d - Sigstore transparency entry: 1524444922
- Sigstore integration time:
-
Permalink:
kongusen/deepstrike@262a036ab53571de839b03e56e40438c97d49723 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/kongusen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@262a036ab53571de839b03e56e40438c97d49723 -
Trigger Event:
push
-
Statement type:
File details
Details for the file deepstrike-0.1.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: deepstrike-0.1.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 497.5 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9df43ff7f0779513800672d3756ba8516a00eeee330a2deb18ee797d686758cb
|
|
| MD5 |
ee39115c9fe915973d4dec4b6c4f981e
|
|
| BLAKE2b-256 |
3063af8b74baa7f78be0a7a0b464a768a475827f39f328adc9564d0ddb97ab1b
|
Provenance
The following attestation bundles were made for deepstrike-0.1.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release-python.yml on kongusen/deepstrike
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deepstrike-0.1.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
9df43ff7f0779513800672d3756ba8516a00eeee330a2deb18ee797d686758cb - Sigstore transparency entry: 1524444858
- Sigstore integration time:
-
Permalink:
kongusen/deepstrike@262a036ab53571de839b03e56e40438c97d49723 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/kongusen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@262a036ab53571de839b03e56e40438c97d49723 -
Trigger Event:
push
-
Statement type:
File details
Details for the file deepstrike-0.1.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: deepstrike-0.1.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 473.5 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
351ef343c25fcc70143eb3452f978f3caf70769586983057b098a8f5e897ecd2
|
|
| MD5 |
2f416945f9b5752462cdf9e011f684ad
|
|
| BLAKE2b-256 |
842ec28e684694dddb80e3416bb90c49f580c3469c316480fddadf1dd48cec03
|
Provenance
The following attestation bundles were made for deepstrike-0.1.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
release-python.yml on kongusen/deepstrike
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deepstrike-0.1.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
351ef343c25fcc70143eb3452f978f3caf70769586983057b098a8f5e897ecd2 - Sigstore transparency entry: 1524444887
- Sigstore integration time:
-
Permalink:
kongusen/deepstrike@262a036ab53571de839b03e56e40438c97d49723 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/kongusen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@262a036ab53571de839b03e56e40438c97d49723 -
Trigger Event:
push
-
Statement type:
File details
Details for the file deepstrike-0.1.4-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: deepstrike-0.1.4-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 461.4 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c69fb85cac26457b272f5cecc38dab2f5381f99533de6a6cb341727a96c8713
|
|
| MD5 |
1e30a28626417665d5f78dc11a61354d
|
|
| BLAKE2b-256 |
0f0bd6e87aebf3b1d0a9fb7042b210739b100620c675c61d2cedfb1b74e9beb4
|
Provenance
The following attestation bundles were made for deepstrike-0.1.4-cp312-cp312-macosx_11_0_arm64.whl:
Publisher:
release-python.yml on kongusen/deepstrike
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deepstrike-0.1.4-cp312-cp312-macosx_11_0_arm64.whl -
Subject digest:
9c69fb85cac26457b272f5cecc38dab2f5381f99533de6a6cb341727a96c8713 - Sigstore transparency entry: 1524444840
- Sigstore integration time:
-
Permalink:
kongusen/deepstrike@262a036ab53571de839b03e56e40438c97d49723 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/kongusen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@262a036ab53571de839b03e56e40438c97d49723 -
Trigger Event:
push
-
Statement type:
File details
Details for the file deepstrike-0.1.4-cp312-cp312-macosx_10_12_x86_64.whl.
File metadata
- Download URL: deepstrike-0.1.4-cp312-cp312-macosx_10_12_x86_64.whl
- Upload date:
- Size: 486.9 kB
- Tags: CPython 3.12, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de159e98a1dad7ed8a299a60ecc80d70cc32c7be3cb45cb3a7125d0a6171473b
|
|
| MD5 |
0b368c603684af82956e7fa51fa76d50
|
|
| BLAKE2b-256 |
a60380b3dec914f7c53edbfc9de4742ac57063e94983975ea526587094dec06f
|
Provenance
The following attestation bundles were made for deepstrike-0.1.4-cp312-cp312-macosx_10_12_x86_64.whl:
Publisher:
release-python.yml on kongusen/deepstrike
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deepstrike-0.1.4-cp312-cp312-macosx_10_12_x86_64.whl -
Subject digest:
de159e98a1dad7ed8a299a60ecc80d70cc32c7be3cb45cb3a7125d0a6171473b - Sigstore transparency entry: 1524444954
- Sigstore integration time:
-
Permalink:
kongusen/deepstrike@262a036ab53571de839b03e56e40438c97d49723 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/kongusen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@262a036ab53571de839b03e56e40438c97d49723 -
Trigger Event:
push
-
Statement type: