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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.13macOS 10.12+ x86-64

codegraff-0.1.4-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.4-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.4.tar.gz.

File metadata

  • Download URL: codegraff-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 0b9459f26f9e3276b5922d0549016a16f7967f8c0920acb646d749133b044903
MD5 81a70707be11e1326453c39988ef5001
BLAKE2b-256 0ff19385d9027cb4ff64b051be743a4ed7a003086728562f807796b8f0f7a034

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codegraff-0.1.4-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.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 429b28e5346ff66a8f11d0d4a4247c6978f8011e7b88050baef1e7630693971b
MD5 fe97c358bafd15c609ed8e20c8397de5
BLAKE2b-256 7924f91fd23bcb003a767d2de05586e534519ed8463cec478182b23ea710eeb9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codegraff-0.1.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5c985ec10dcafc2000e10f0116c1ff070b854f9791b1a2b2b2f41dda08fe92e1
MD5 0374e870c6345aa7f296fc688149b112
BLAKE2b-256 305bd40f9020ec72d5b1072964f16fbd0af08b68ea2680c6f88eccabf4a83998

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codegraff-0.1.4-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b2bb5b39b5fbdeddc8b732e713d7ff0a6648b85f4e6d9fa64dedb875e288e13f
MD5 a347fea5285348cc7de475f0e10bf2a6
BLAKE2b-256 e690c25665890a4448eb69d7cf51b5f87fbdbc77a09e2f2342953f36a5510e5b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codegraff-0.1.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d74d8963d0ba32b00d298073bf5fecd99686eead305707750e95f49cd346e410
MD5 244587e0bec5ccd4d77edd5fd6f6bc48
BLAKE2b-256 fcf1674905556edf474b26a37c4782a19883b871073273eb1dbaf6276dc91cb8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codegraff-0.1.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9a1db2ca5b726ca81407223e95c52e755ff26003545f906c658a8fc4d50c9b7a
MD5 4e6e546b19f9d3d34401ce7faa7e48de
BLAKE2b-256 a9fe46aee73fd500b764461c8f28108953e8542bcc54cd778b1f40a03f079041

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