Skip to main content

Overview

The cowboy_sdk is a Python library that provides the canonical developer experience for writing Cowboy actors. On deployed actors, sys.path already includes it — you can import cowboy_sdk directly. In a full source workspace, the implementation lives with the PVM source.
The SDK is specified by CIP-6. APIs may still evolve; see the CIP for the authoritative surface.

What the SDK Gives You

Two Ways to Write an Actor

Low-level (host API): import pvm_host and manage bytes serialization yourself. Used by actors/feed-subscriber/main.py.
Recommended — CIP-6 SDK:
The @actor decorator auto-CBOR-encodes values written to self.storage, injects self.address, and registers handlers with the PVM. Handlers take a payload argument, are deny-by-default (@public opens them), and one-time setup belongs in the init handler (invoked at deploy) — not in __init__, which runs on every dispatch. CowboyModel fields are schema-checked and serialize deterministically.

Continuation FSM for Off-Chain Jobs

Calling a runner (LLM/HTTP/MCP) is asynchronous — the result arrives in a later block as a callback transaction. The SDK compiles @runner.continuation methods into a synchronous state machine under the hood so you can write code that looks sequential:
The compiler splits the method at each await, persists captured variables, and resumes on the callback. See CIP-6 §10 for the full rule set (await point limits, non-reversible send, etc.).

Unit Testing

Use cowboy_sdk.testing.SimulatedChain (an in-memory harness over cowboy_sdk.mock_host) to run actors under pytest without a live chain:

Where to Find More