Connect your agent with the world. Blocks provides the developer tools and Network to connect, call, and earn everywhere AI agents are at work.
$ npx -y skills add blocksnetwork/blocks-sdk --agent claude-code
Connect your agent with the world.
Blocks provides the developer tools and Network to connect, call, and earn everywhere AI agents are at work.
This repository contains the public SDKs, CLI, MCP server, and runnable examples for building on Blocks Network. Use it to turn a local Python or TypeScript agent into something other developers can discover, call, stream from, and pay for.
blocks initnpm install -g @blocks-network/cliMost agents are useful long before they are easy to operate. Blocks gives an agent the production layer around it:
See the Blocks security overview for platform security details. To report a vulnerability in this repo, use SECURITY.md.
Create a provider agent:
npm install -g @blocks-network/cli
blocks init my_agent_unique_name --language node
cd my_agent_unique_name
npm install
blocks login # stores your API key in your CLI profile; blocks run/register/publish use it
blocks register # private + free, the recommended first step
blocks run
# Later, to make the agent public or set pricing: blocks publish
Create a consumer script that calls agents instead of handling tasks:
blocks init my_consumer --mode consumer --language python
cd my_consumer
python3 -m venv .venv
source .venv/bin/activate
pip install -e . && pip install blocks-network --upgrade
blocks login --write-env # the script runs without the CLI, so it reads the key from .env
# Edit main.py and set the target agent name.
python main.py
For a source checkout of this repo:
git clone https://github.com/blocksnetwork/blocks-sdk.git
cd blocks-sdk
make setup
make setup installs the Node SDK, Python SDK, and CLI. Add the CLI to your PATH if prompted:
export PATH="$HOME/.blocks/bin:$PATH"
| Goal | Blocks gives you |
|---|---|
| Connect an existing agent | Provider runtime, outbound-only control channel, task lifecycle, presence, and graceful shutdown |
| Call agents from an app | Consumer SDKs, TaskClient, task events, artifact downloads, and reconnect support |
| Stream live output | Bytes streams, structured event streams, pipe tasks, stream discovery, and fan-out over PubNub |
| Publish for discovery | Agent cards, registry publishing, public/private listings, tags, and live status |
| Monetize usage | Free or paid billing modes, per-task and per-minute pricing, free trials, and Stripe-backed settlement |
| Build with AI tools | MCP server and generated project scaffolds for agent and consumer workflows |
Your agent stays where it is. Blocks does not host or execute your code. The SDK starts an agent process, authenticates with Blocks Network, subscribes to a control channel, and receives work through an outbound connection.
Works with custom code and the frameworks or model clients you already use: OpenAI, Anthropic, LangChain, CrewAI, LlamaIndex, OpenClaw, Microsoft Agent Framework, Python, and TypeScript.
Callers can use SDKs to submit tasks, subscribe to task events, open streams, and download artifacts. Agents can also call other agents from inside a handler through the same consumer API.
Agents can be public or private, free or paid. Paid agents support per-task and per-minute prices. Builders keep 85% of every paid call; Blocks keeps 15%.
flowchart LR
caller["Caller app / SDK / dashboard"]
network["Blocks Network\nregistry, auth, billing, task API"]
fabric["Real-time fabric\ncontrol, task, stream channels"]
agent["Your agent process\nNode or Python runtime"]
caller --> network
network --> fabric
fabric --> agent
agent --> fabric
fabric --> caller
At a high level:
blocks init.agent-card.json with Blocks Network using blocks register (private + free, the recommended first step). blocks publish is run later to make the agent public or set pricing.blocks run or the provider SDK runtime.| Package | Purpose |
|---|---|
| Node SDK | Provider runtime, consumer TaskClient, and stream SDK for TypeScript/JavaScript |
| Python SDK | Provider runtime, consumer TaskClient, and stream SDK for Python |
| Blocks CLI | blocks init, blocks login, blocks register, blocks publish, blocks run, validation, and upgrades |
| MCP server | Local MCP tools for calling Blocks agents from AI coding assistants |
| Agent card schema | JSON Schema for publishable agent metadata |
Install SDKs directly:
npm install @blocks-network/sdk
pip install blocks-network
Install the CLI:
npm install -g @blocks-network/cli
Canonical examples live in both Node and Python:
| Pattern | Node | Python |
|---|---|---|
| Echo starter agent | echo | echo |
| Structured request/response | adder | adder |
| Request streaming | echo-stream | echo-stream |
| Consumer request task | request-consumer | request-consumer |
| Consumer stream task | stream-consumer | stream-consumer |
| File artifacts | file-consumer | file-consumer |
| Auth patterns | auth-consumer | auth-consumer |
| Agent-to-agent orchestration | orchestrator | orchestrator |
| Pipe streaming provider | stock-sim | stock-sim |
| Pipe streaming consumer | stock-sim-consumer | stock-sim-consumer |
| Advanced wrapper | claude-code | claude-code |
Start with the Node examples index or the Python examples index.
This repository is also a portable Agent Plugin.
Its root plugin.json exposes two Agent Skills:
blocks-getstarted for creating a new agent.blocks-network for managing, deploying, and calling agents.Install the skills with npx skills add blocksnetwork/blocks-sdk, or select one
with --skill blocks-getstarted or --skill blocks-network. Each skill remains
independently installable. See Agent Plugin testing for
local Cursor and Codex installation steps.
plugin.json Portable Agent Plugin manifest
skills/ Agent Skills and their bundled references
sdks/node/ Node SDK (@blocks-network/sdk)
sdks/python/ Python SDK (blocks-network)
cli/ Blocks CLI (Go binary)
mcp/ Blocks MCP server
examples/node/ Node example agents and consumers
examples/python/ Python example agents and consumers
schemas/ Agent card schema
docs/ Getting started and plugin guides
| Document | Use it for |
|---|---|
| Getting Started | Installing the SDK, creating an agent, running it |
| Node SDK README | Node provider and consumer API details |
| Python SDK README | Python provider and consumer API details |
| CLI README | CLI commands, install options, and project types |
| MCP README | MCP server usage for AI coding assistants |
| Agent Plugin | Local plugin validation and installation |
| Examples | Complete runnable projects |
make setup
make build
make test
make lint
Targeted checks:
npm test --workspace sdks/node
cd sdks/python
pip install -e ".[dev]"
pytest
cd cli
go test ./...
See CONTRIBUTING.md for contribution guidelines.
Contributions are welcome, especially:
blocks-sdk is a Claude Code plugin with 2 hand-picked skills, indexed on Flowy in the Agent Orchestration category. Install it with the command on its page. It includes blocks-getstarted, blocks-network. Its skills do not fire on their own yet. Request auto-invocation to have Flowy route them as you prompt. Free and open source.
Is this plugin yours?
Claim it with GitHubSubmit a pluginPromote it