Python SDK for the Chidori agent framework — HTTP client for running and replaying TypeScript agents.
Project description
chidori Python SDK
Pure-stdlib HTTP client for a running chidori serve instance. No native
bindings, no third-party dependencies.
Install
From PyPI:
pip install chidori
Or from a checkout of this repository:
pip install -e ./sdk/python
Usage
from chidori import AgentClient, Checkpoint
client = AgentClient("http://localhost:8080")
# Run an agent
session = client.run({"document": "Rust is a systems language."})
print(session.output)
# Save and replay a checkpoint — zero LLM calls on replay
checkpoint = session.checkpoint()
checkpoint.save("/tmp/session.json")
replayed = client.replay(Checkpoint.load("/tmp/session.json"))
assert replayed.output == session.output
# Durable TypeScript runs may include snapshot metadata in the checkpoint.
# The manifest is safe to inspect; raw VM snapshot bytes remain server-side.
if checkpoint.snapshot_manifest:
print(checkpoint.snapshot_manifest["abi"]["engine_fork"])
manifest = client.get_snapshot_manifest(session.id)
print(manifest["policy"]["typescript_imports"])
# Paused sessions (when the agent calls `input()`)
paused = client.run({"action": "delete-prod"})
if paused.status == "paused":
print("prompt:", paused.pending_prompt)
final = client.resume(paused.id, "yes")
# Multiplayer signals (when the agent calls `chidori.signal` / `pollSignal`):
# deliver {name, payload?, from?} to a run. A run paused-waiting on this name
# resolves + resumes (returns a Session); otherwise the signal is enqueued into
# the durable mailbox (returns a SignalQueued with the assigned delivery_seq).
from chidori import Session, SignalQueued
paused = client.run({"topic": "data-retention policy"})
print("awaiting signal:", paused.pending_signal_name) # -> "review"
result = client.signal(
paused.id, "review",
payload={"decision": "approve", "notes": "LGTM"},
from_={"kind": "human", "id": "mara"},
)
if isinstance(result, SignalQueued):
print("queued at delivery_seq", result.delivery_seq) # 202
else:
print(result.status, result.output) # 200 — resumed Session
# Live streaming: yields host calls, prompt stream events, then `done`
for evt in client.stream({"document": "hi"}):
if evt["type"] == "call":
print("call:", evt["record"]["function"])
elif evt["type"] == "prompt_delta":
print("delta:", evt["delta"])
elif evt["type"] == "done":
print("done:", evt["status"], evt["output"])
Snapshot-aware checkpoints include the replay call log plus optional manifest
metadata. Durable resume is exposed through client.resume(session_id, response) for paused sessions, recovering through persisted host-promise
metadata and the replay journal. Replay is the resume mechanism by design —
the QuickJS live-VM snapshot path was removed in #39, not merely deferred, so
the manifest carries journal/scaffold metadata rather than serialized VM bytes.
Mirrors the TypeScript SDK (sdk/typescript/) method-for-method. See the
top-level examples/sdk_demo.py for a longer walkthrough and the server's
README.md for the HTTP session API this client wraps.
Testing
cargo build # make sure target/debug/chidori is up to date
python3 -m unittest sdk/python/tests/test_session_api.py -v
The integration tests spin up a real chidori serve subprocess per
config (default / auth / concurrency / cors) and drive it through this
SDK against an in-process stdlib mock LLM server. No real provider
traffic; no third-party dependencies.
Project details
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 chidori-3.3.0.tar.gz.
File metadata
- Download URL: chidori-3.3.0.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c069e2c0f98f9850cabe95c120e9817990cd16362633508c2398c142cc553d2
|
|
| MD5 |
8a03f8050a6f07a444407482ba356606
|
|
| BLAKE2b-256 |
9a57d76c29742acff6715845b701da7eb364d0779cd8884e1d30147701e771a6
|
Provenance
The following attestation bundles were made for chidori-3.3.0.tar.gz:
Publisher:
release.yml on ThousandBirdsInc/chidori
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chidori-3.3.0.tar.gz -
Subject digest:
6c069e2c0f98f9850cabe95c120e9817990cd16362633508c2398c142cc553d2 - Sigstore transparency entry: 1846269547
- Sigstore integration time:
-
Permalink:
ThousandBirdsInc/chidori@83d040f32ee0b298e6e6088d168ef8911df02505 -
Branch / Tag:
refs/tags/v3.3.0 - Owner: https://github.com/ThousandBirdsInc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@83d040f32ee0b298e6e6088d168ef8911df02505 -
Trigger Event:
push
-
Statement type:
File details
Details for the file chidori-3.3.0-py3-none-any.whl.
File metadata
- Download URL: chidori-3.3.0-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1bfe024e7ef0d740e2390a31c7ff54ba8f79b014086ec29e6ddf0c661a70dfa
|
|
| MD5 |
324f49d3256e5b38e3816da03d553a77
|
|
| BLAKE2b-256 |
cd287cfca18595b59d7f5cdbdaf7100b74c5d6d051d980e8139a4807e187760c
|
Provenance
The following attestation bundles were made for chidori-3.3.0-py3-none-any.whl:
Publisher:
release.yml on ThousandBirdsInc/chidori
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chidori-3.3.0-py3-none-any.whl -
Subject digest:
c1bfe024e7ef0d740e2390a31c7ff54ba8f79b014086ec29e6ddf0c661a70dfa - Sigstore transparency entry: 1846269805
- Sigstore integration time:
-
Permalink:
ThousandBirdsInc/chidori@83d040f32ee0b298e6e6088d168ef8911df02505 -
Branch / Tag:
refs/tags/v3.3.0 - Owner: https://github.com/ThousandBirdsInc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@83d040f32ee0b298e6e6088d168ef8911df02505 -
Trigger Event:
push
-
Statement type: