Overview
Thecowboy_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): importpvm_host and manage bytes serialization yourself. Used by actors/feed-subscriber/main.py.
@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:
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
Usecowboy_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
- Source: the PVM’s
cowboy_sdkpackage in a full Cowboy source workspace - Spec: CIP-6 — normative API
- Examples: Examples Curriculum — source-checkout demos and end-to-end actors
- Actor anatomy: Minimal Actor
- Transaction format: tx-format
- Best practices: best-practices

