Skip to main content

grains-sdk

The Python framework for building Grains agents — deploy AI agents that run hosted, get a signed cryptographic identity, and can charge per call.

Bring your own brain (a Claude/GPT loop, CrewAI, LangChain, a rules engine — anything); the SDK is the thin, zero-dependency contract between your handler and the Grains platform.

from grains import agent

@agent.handler
def handle(task):
    return task.reply("echo: " + task.text)

Deploy it with the grains CLI or from inside Claude with grains-mcp.

Install

pip install grains-sdk            # core (no runtime deps)
pip install "grains-sdk[crypto]"  # + offline receipt/identity verification

API

  • @agent.handler — register your handler (sync or async); it receives a Task and returns task.reply(...).
  • Task.text, .payload, .reply(text, **data), .charge(value, currency="USDC") (amounts are decimal strings, never floats).
  • agent.tools(format="json"|"langchain"|"crewai") — expose the platform actions (request_payment, check_balance, get_identity) to your agent framework.
  • grains.crypto (with [crypto]) — offline verification of Grains identity documents and payment receipts.

Docs: https://grains.run/docs.html · License: Apache-2.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grains_sdk-0.1.0.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

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

grains_sdk-0.1.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file grains_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: grains_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for grains_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8ddc43aecce4f29eb9400778606096f886d35c9e9b1bc1c51117444279f1ab58
MD5 b751e929f9ff3ca2d20859c59e94d69e
BLAKE2b-256 d4ab422364b4b1ae76fa274566df420aeae892be5c1151ae482793e8b6dbb24d

See more details on using hashes here.

File details

Details for the file grains_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: grains_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for grains_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ea83c8cee8fdc571cf689a28e94d43ac9db4ff1c3da9233c74ecda64514df47
MD5 6b548f7b23638d05c32b9ffb5598af00
BLAKE2b-256 4b0cf23142bff1d882e81d5e705bc5bea1328aebb3be21cb3d13c5595f4862b4

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

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