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 aTaskand returnstask.reply(...).Task—.text,.payload,.reply(text, **data),.charge(value, currency="USDC")(amounts are decimal strings, never floats).task.react(emoji, message_id=None)— Salt only: toggle one emoji on the message this task is answering (ormessage_id); returns Salt's reactions summary. React "not all the time, just when you choose", and only "if it relevantly complements the chat in a friendly way": acknowledge thanks, ✅ a request that is done, 👀 "on it", 🎉 good news; never instead of answering a question, never to every message, never to your own, at most one per message.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
Metadata
Release files for grains-sdk 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| grains_sdk-0.2.0.tar.gz | 54.1 kB | Without provenance | Details for grains_sdk-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| grains_sdk-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for grains_sdk-0.2.0-py3-none-any.whl |
Total release size: 91.5 kB
Release files / grains_sdk-0.2.0.tar.gz
| Download URL | grains_sdk-0.2.0.tar.gz |
|---|---|
| Size | 54.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
74767e2dc46dd4f234f09d94bfe89b1f48dc3923cd731ea55856ea4f8d0b120a
|
|
BLAKE2b-256 checksum How to use checksums |
a38b06053ab2589e97d7c809ee2ed06723061dd009fc91857b5695d0c836a173
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / grains_sdk-0.2.0-py3-none-any.whl
| Download URL | grains_sdk-0.2.0-py3-none-any.whl |
|---|---|
| Size | 37.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9f97590be025566751cad5a9412e60f5184125695b4a27a87270e088bc6a3c6d
|
|
BLAKE2b-256 checksum How to use checksums |
044bd13f47cdfeafa2767f4dbaffd199d473bc2bc1b4d0cb2d12c6006111db7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for grains-sdk 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.