Skip to main content

SDK for developing Cowboy Actors

Project description

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-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.

Project details


Download files

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

Source Distribution

cowboy_sdk-0.1.1.tar.gz (51.8 kB view details)

Uploaded Source

Built Distribution

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

cowboy_sdk-0.1.1-py3-none-any.whl (61.6 kB view details)

Uploaded Python 3

File details

Details for the file cowboy_sdk-0.1.1.tar.gz.

File metadata

  • Download URL: cowboy_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 51.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for cowboy_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c7184d7e6074b1409430509b494558c33b6bbc8a4925ea818751359a2906284e
MD5 8f6847c8599b73d03f05da70ebdc3e4e
BLAKE2b-256 94032254799b436f8ace75844b399497c972c0e61d1729ebc867ad0910367ebc

See more details on using hashes here.

File details

Details for the file cowboy_sdk-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: cowboy_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 61.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for cowboy_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4cf8045d39bc26f9a78c7db57a46a7d399fcaf8c5f54adac1095abfc2bf9258e
MD5 1bd025413af0dcc8b9a364d405816935
BLAKE2b-256 e04b8b09e9cb3143cbe304add126ddb31d3aa18c90c3897ec4096816f8798f05

See more details on using hashes here.

Supported by

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