Python SDK for the codegraff agent (PyO3 bindings).
Project description
codegraff
The Python SDK for the CodeGraff coding agent. Run the agent in-process (PyO3 native bindings) — streaming events, multi-turn sessions, BYOK auth, and cloud sandboxes — with synchronous generators that fit straight into any Python app or web framework.
pip install codegraff
from codegraff import Graff
graff = Graff() # reads ~/.forge/forge.toml, like the graff CLI
for ev in graff.chat("explain monads in 3 sentences"):
if ev.type == "TaskMessage" and ev.data.get("content", {}).get("kind") == "Markdown":
print(ev.data["content"]["text"], end="", flush=True)
BYOK
import os
from codegraff import Graff
graff = Graff(
provider="codegraff", # or "openai" / "anthropic" / "open_router" / "xai" / ...
api_key=os.environ["CODEGRAFF_API_KEY"],
model="deepseek-v4-pro",
)
Graff(...) is a synchronous constructor; chat() is a blocking generator that
releases the GIL while it waits on the agent, so it drives async servers without
starving the loop. Inputs are validated at the boundary with
dhi.
What you get
- Streaming chat —
for ev in graff.chat(prompt)yieldsAgentEvents (TaskMessage,ToolCallStart/End,TaskReasoning,TaskComplete, …). - Multi-turn — pass
conversation_id, or usegraff.session(). - Conversation management —
list_conversations,get_conversation,last_conversation,compact_conversation,delete_conversation. - Agents & auth —
get_agent_infos,upsert_credential,remove_credential. - Cloud sandboxes —
graff.create_sandbox()→exec/upload/download/stop/start/destroy(via the CodeGraff gateway).
Install notes
Platform support (0.1.0): prebuilt wheels are published only for macOS
arm64 on Python 3.12 / 3.13 / 3.14t, and there is no sdist — so
pip install codegraff fails on Linux, Windows, Intel macOS, or Python
3.9–3.11 until the CI wheel matrix lands. To run elsewhere today, build from the
full repo (not pip install — the crate has workspace path deps):
git clone https://github.com/justrach/codegraff
cd codegraff/sdk/python
pip install maturin && maturin develop --release
Docs & examples
- In-depth guide: docs/sdk/python.md
- turboAPI HTTP example:
example/ - TypeScript SDK:
@codegraff/sdk· guide
Requires Python >= 3.9. MIT licensed.
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 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 codegraff-0.1.1.tar.gz.
File metadata
- Download URL: codegraff-0.1.1.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2065ad1746991dc699fd8efd6a8588f60aed0d06d3fe6c9dcd9342a37b934ad9
|
|
| MD5 |
c2ff7646b148ebab07378f81b25c88b0
|
|
| BLAKE2b-256 |
4540672141880f0ad7524f8df7593fb99b97e2f1cc1c29afc3bbf341540729ea
|
File details
Details for the file codegraff-0.1.1-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: codegraff-0.1.1-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 16.1 MB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20dfecbec1f910b8047f398c2e07770bf90fe3a7a3edf1916f7354e0966b9a88
|
|
| MD5 |
a54a9c345dea9267283d80dab96b80f7
|
|
| BLAKE2b-256 |
25553a0000e599e31e39b62735b4d7674e67947e9a33f0bd7d53d7637bad08de
|
File details
Details for the file codegraff-0.1.1-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: codegraff-0.1.1-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 14.2 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e959cc4ee4ef427227149bd9dd77b3aec399b2c3ed6d502274e04a91b6b939b9
|
|
| MD5 |
37d6cac25cc7aa13ce80f1ceb878b302
|
|
| BLAKE2b-256 |
ed5c901a314d2ca2a615f5fadf54d4dcaf35d7facf54be31ebd11d12e7ec6584
|
File details
Details for the file codegraff-0.1.1-cp313-cp313-macosx_10_12_x86_64.whl.
File metadata
- Download URL: codegraff-0.1.1-cp313-cp313-macosx_10_12_x86_64.whl
- Upload date:
- Size: 15.0 MB
- Tags: CPython 3.13, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1ff79705b747a6f694142e18447c74d51263d50eb7a37c38251cc46a3458189
|
|
| MD5 |
3c7e07c8b94a3d531d744d2d8f708d24
|
|
| BLAKE2b-256 |
db86988984b4ac318e2e09725432fd0192069e4a372d2fe93be96411c4ed5916
|
File details
Details for the file codegraff-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: codegraff-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 15.5 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1e6fd82956654a6c4165548ffd7730fabe771043c176ae35f8b2583b3a28194
|
|
| MD5 |
3bd72e5cf9c9961d197011ac0b671013
|
|
| BLAKE2b-256 |
f389aca1caa4b94eef66341c640068f42c9d1c4c4e59c9ab7734fb57adea6d6a
|
File details
Details for the file codegraff-0.1.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: codegraff-0.1.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 14.7 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
065e1f0b3bcf56843458b5a069843f703888f8221bf4c021fcdce5d81b23c30d
|
|
| MD5 |
0830b74a7b4187fe2628f143b896c55d
|
|
| BLAKE2b-256 |
7ded6caf223c1fc4662b4940c7456b50c3e65eb7e820165e959ad2fe5fbcda95
|