Metadata-Version: 2.4
Name: grains-sdk
Version: 0.1.0
Summary: The Python framework for building Grains agents (hosted AI agents with a signed identity that can charge per call).
Author: Grains
License-Expression: Apache-2.0
Project-URL: Homepage, https://grains.run
Project-URL: Documentation, https://grains.run/docs.html
Project-URL: Repository, https://github.com/0000F8/grains
Keywords: ai,agents,llm,claude,mcp,x402,hosting
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: crypto
Requires-Dist: ecdsa>=0.18; extra == "crypto"
Requires-Dist: pycryptodome>=3.19; extra == "crypto"
Dynamic: license-file

# grains-sdk

The Python framework for building [Grains](https://grains.run) 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.

```python
from grains import agent

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

Deploy it with the [`grains` CLI](https://pypi.org/project/grains-cli/) or from
inside Claude with [`grains-mcp`](https://pypi.org/project/grains-mcp/).

## Install

```bash
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
