Skip to main content

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 chatfor ev in graff.chat(prompt) yields AgentEvents (TaskMessage, ToolCallStart/End, TaskReasoning, TaskComplete, …).
  • Multi-turn — pass conversation_id, or use graff.session().
  • Conversation managementlist_conversations, get_conversation, last_conversation, compact_conversation, delete_conversation.
  • Agents & authget_agent_infos, upsert_credential, remove_credential.
  • Cloud sandboxesgraff.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

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

codegraff-0.1.2.tar.gz (1.1 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

codegraff-0.1.2-cp313-cp313-win_amd64.whl (16.1 MB view details)

Uploaded CPython 3.13Windows x86-64

codegraff-0.1.2-cp313-cp313-macosx_11_0_arm64.whl (14.2 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

codegraff-0.1.2-cp313-cp313-macosx_10_12_x86_64.whl (15.0 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

codegraff-0.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (15.5 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

codegraff-0.1.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (14.7 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

File details

Details for the file codegraff-0.1.2.tar.gz.

File metadata

  • Download URL: codegraff-0.1.2.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

Hashes for codegraff-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e463d21536ba07c06efbac998e3286dad53b9845a5f1ad8d0fde2a55235a810c
MD5 b3f793f2f17f965c8e35f6f5f3b17c36
BLAKE2b-256 ddd747033260d1120d55e809416a9798e224c51bd6d9c2f6433134cabedef768

See more details on using hashes here.

File details

Details for the file codegraff-0.1.2-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: codegraff-0.1.2-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

Hashes for codegraff-0.1.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f10ab2ccbe5fa6e744c3048b2c142c21fabe3c83f13bc42ae6f8eb47254ab621
MD5 2d167ac11d750413f4c984553fe24e04
BLAKE2b-256 427800c05ece90cbd182bfe05897f9ff51a60c4b565d6fc5031cbb49422d8e75

See more details on using hashes here.

File details

Details for the file codegraff-0.1.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for codegraff-0.1.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b53706c32fb364886ad3ba09a98611b0cfca0bd5861604b8176f7e8bae0b87b4
MD5 528c81fbb8d1e1a2a211975748e9fd54
BLAKE2b-256 bc5158742f935af99cf68654488c5bf8c054c7cb8c3cc46a664c61e6012ad7c1

See more details on using hashes here.

File details

Details for the file codegraff-0.1.2-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for codegraff-0.1.2-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b8db3238a0d22be75330683ff7ce3c4bb7b44e41bff082ecea7ea65c02e11b7e
MD5 c8335de06fc0ffe142cbbe76e8b38bcd
BLAKE2b-256 5a072a6edd68191ff3afae00a01b26aa6b05f23b05cb83a84fd6b53f95adbd60

See more details on using hashes here.

File details

Details for the file codegraff-0.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for codegraff-0.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 121ccf723731b2e1a62a2f37396ceadb3dfa5a10b37aae05ff4dbd7ee775dc86
MD5 2dca443d4a164629fc7f30be01aee7de
BLAKE2b-256 897c5d3714498b0b6a2ed4eb5bc0290ccd44775c813e64f1fe6046ccb05b5135

See more details on using hashes here.

File details

Details for the file codegraff-0.1.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for codegraff-0.1.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5d2821900f123ba0c440f82b73ad0464fc535c18f1d256d3c55d25df372b723c
MD5 1ff8cb2023267e95817d9a4a656ae4b1
BLAKE2b-256 b92e896149168763e147cf27cc8ab4b1512d24277905a2336bbf127163c03910

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page