Skip to main content

Cowboy SDK

The official Python SDK for developing autonomous actors on the Cowboy PVM (Python Virtual Machine).

With this SDK, you can write fully deterministic on-chain Python code that interacts natively with LLMs, APIs, and the broader Cowboy ecosystem.

Features

  • Decentralized AI Agents: Write prompt chains, FSM-based LLM logic, and MCP integrations directly in Python.
  • @runner.continuation: Turn Python async functions into verified Finite State Machines (FSMs) capable of pausing execution, offloading heavy compute (LLM inference, HTTP requests) to Runners, and seamlessly resuming on the next block.
  • Robust Determinism: The SDK strips away standard Python non-determinism (time, random, set) and replaces it with consensus-safe primitives.
  • CBOR-backed State: The CowboyModel and self.storage dict provide automatic schema validation and canonical CBOR serialization for zero-boilerplate state management.
  • Built-in Async Primitives: Leverage TaskGroup for concurrent Runner tasks, Retry for robust backoff logic, and bounded_loop to ensure safety limits.

Quick Start

pip install cowboy-actor-sdk
from cowboy_sdk import actor, runner, capture

@actor
class MyAgent:
    def init(self, payload):
        self.storage["calls"] = 0
        return b"ok"

    @runner.continuation
    async def chat(self, msg):
        ctx = capture()
        ctx.prompt = msg.get("message", "Hello")
        
        # Off-chain heavy compute (LLM) securely verified via consensus
        result = await runner.llm(ctx.prompt, system_prompt="You are a helpful assistant")
        
        # Execution resumes here on the next block
        chat_id = self.storage.get("calls", 0)
        self.storage[f"reply:{chat_id}"] = result
        self.storage["calls"] = chat_id + 1
        
        return b"ok"

def _a(): return MyAgent()
def init(p): return _a().init(p)
def chat(p): return _a().chat(p)
def chat__resume(p): return _a().chat__resume(p)
def on_runner_result(p): return _a().on_runner_result(p)

Documentation & Tools

  • Developer Manual: View on GitHub
  • Vibe Coding Blueprint (Claude Code): Learn how to set up autonomous development without local chain dependencies. View Guide.
  • Cowboy CLI: Pre-compiled binary required to deploy and send transactions. Download from the GitHub Releases.

License

MIT License. See the repository for details.

Metadata

Release files for cowboy-actor-sdk 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cowboy-actor-sdk 0.1.2
File Size Uploaded
cowboy_actor_sdk-0.1.2.tar.gz 163.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cowboy-actor-sdk 0.1.2
File Interpreter ABI Platform
cowboy_actor_sdk-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 348.1 kB

Release files / cowboy_actor_sdk-0.1.2.tar.gz

Download URL cowboy_actor_sdk-0.1.2.tar.gz
Size 163.2 kB
Tags Source
SHA-256 checksum
How to use checksums
63c5997ac3ec7cea775598a70d9e556c917642d580db96c360603075832958c2
BLAKE2b-256 checksum
How to use checksums
7c68935f31b218ceee2718b5c662896fb2e317c92b8285bd828d3362e8a19904
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / cowboy_actor_sdk-0.1.2-py3-none-any.whl

Download URL cowboy_actor_sdk-0.1.2-py3-none-any.whl
Size 184.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc5d3e3b19df1d8f5379609ee80ffdc95cca28fb2639f625fca5a56a95094cee
BLAKE2b-256 checksum
How to use checksums
dfb414d0b26256f1696caa72bad5209973c38e4ddf9002826ad305c6d33072de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

0.1.4

2 release files

0.1.3

2 release files

This release

0.1.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page