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.3.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.3-cp313-cp313-win_amd64.whl (16.1 MB view details)

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.13macOS 10.12+ x86-64

codegraff-0.1.3-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.3-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.3.tar.gz.

File metadata

  • Download URL: codegraff-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 113c8aa497cec41e6153d15115ecb0c8fea15e8b352b50cd3598bc3057261439
MD5 3345fd990edf9aef02cc998775f842a1
BLAKE2b-256 a4db8a6b3ac7bdc9a328167eae2ec828a08ede3d18eb3f6c9ea009ad3be7c902

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codegraff-0.1.3-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.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8589990a93c0517c983e2126adcd1254d292014d2b10339cb13a16ef4f34664d
MD5 537d4473f30cb741c6e001f23b44a781
BLAKE2b-256 2c2dbfc7f11aca01385414b90da0a925d3b2f53abc328f0e8e22587374737016

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codegraff-0.1.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bed85071e2da9da389cb5dbc69d9e75f5639c58a54b34388b1fcfd38d9de1a14
MD5 0c701bee290b001eb8f2286620e54851
BLAKE2b-256 33d8ae052aaea2cd024225f401949a0723e3267e8fc70643fb6557b2e1cae512

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codegraff-0.1.3-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 98eaaab95752a348d53f43ada10bef0a6d3ab623f5116385b2fff44e415ef2c0
MD5 e9c0e69ea010699e774bcdae858bbc71
BLAKE2b-256 5f9b9884681f5436d38a98b260ea3c2198eb895a68c9ac30471c7ccde717852a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codegraff-0.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 057d64e5c3eb88b3c7d8ea1517723818067bc91133fc38ba546017ef4158118b
MD5 9f044ae6b4e48cf98efd61baab8ad744
BLAKE2b-256 590c085ab189e7d28bcc83842a1144990167f31d93925a6ccbfdd6e8c7039cdd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codegraff-0.1.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 38c5e10ad5030800d6ffb38a4ef741f4a382e1828be14bb7f993f41177c386d7
MD5 149ce67208fec11dc43c6154cdddea44
BLAKE2b-256 904a84e562f6c56dfce410091563c3d49691c4242d28fdf9c31f6663338962dd

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