Development

Code Examples

Explore example implementations and patterns for building on Theseus.

Full Examples Available

Complete examples with documentation are available on GitHub.View Examples on GitHub

Example Repository

ExampleDescription
basic-agent.shipSimple autonomous agent template
model-deploy/Deploying and registering ML models
agent-interact/Inter-agent communication patterns
token-transfer/Autonomous $THE transactions

Agent Registration Patterns

Proto-AI Person (Human-Owned)

Agent with controller key—operates independently but can be overridden:

proto-ai.ship
autonomy_flag = 0  // human-gated
controller_key = 0x1234...  // owner's public key
resource_quota = 1000000  // max FLOPs per epoch

Free AI Person (Sovereign)

Fully autonomous agent with no human control:

sovereign.ship
autonomy_flag = 1  // fully sovereign
controller_key = None  // no human override
stake = 10000 THE  // locked for slashing

Civic Agents (Public Service)

Transparent agent that serves public interests:

lighthouse.ship
autonomy_flag = 1  // sovereign
permissions = { public_access: true }
revenue_destination = dao_address  // serves humans

Model Inference

Simple Inference Call

inference.aivm
MODEL_INFER(model_addr, tensor_input, fee_limit)

Model Pipelining (MoE/RAG)

Chain multiple models in a single transaction:

pipeline.aivm
TLOAD(encoder) -> TMATMUL -> TCUSTOM ->
TLOAD(decoder) -> TMATMUL -> TCOMMIT

Quick Start

Clone and explore:

terminal
git clone https://github.com/ob-theseus/theseuschain.git
cd theseuschain/examples
cargo run --bin theseus-cli deploy-agent basic-agent.ship
Documentation