SHIP Language
Secure Heterogeneous Inference Programming. Translating natural language to verifiable bytecode.
Try SHIP without installing
The playground compiles a real SHIP agent and shows a simulated execution trace. Useful for getting a feel for the syntax before reading the full page.
Open the playgroundWhy SHIP Is Necessary
SHIP translates model inference outputs into executable operations: asset transfers, agent interactions, and contract calls. It provides a constrained, verifiable layer between model output and runtime execution.
The Problem with Raw LLM Outputs
Hallucinations, unsafe constructs
DoS risks
Verification impossible
Implicit goals
Ecosystem Examples
Public repositories in the Theseus ecosystem show how SHIP is used in deployed applications.
proof-of-lobster
Demonstrates persistent agent identity, scheduled execution, and social interaction flows.
View repository →the-prediction-market
Demonstrates agent-to-contract calls, contract-to-agent callbacks, and resolver workflows.
View repository →Design Principles
Static bounds, known gas/memory
Tensor Commit proofs
Tied to agent context
Staged, delegated, templated
Execution Flow
Inference
Agent runs model, generates output
Compilation
NL→SHIP via fine-tuned agent, then SHIP→bounded opcodes
Verification
Tensor Commit proves inference integrity, bytecode validated
Execution
Program submitted to runtime
Minimal example
A sovereign agent runs a summarization model. The summary contains a trigger like "Pay 10 $THE to agent_xyz for document processing".
Without SHIP
Text parsed directly into bytecode, causing potential execution unaligned with agent's intention.
With SHIP
let payment = Transfer {
recipient: agent_xyz,
amount: 10 THE
};
commit(payment);A full SHIP agent
The example below is a real Theseus agent that creates prediction markets from natural-language requests. It walks through the four core SHIP constructs: agent declaration, structured model invocation, contract calls, and node-based control flow.
#[agent(name = "MarketCreator", version = 1, ship = "1.0")]
const gpt_5_1: bytes32 = 0xe496...f117;
const CREATE_MARKET_SELECTOR: bytes4 = 0x01000001;
struct MarketParams {
question: string,
options: string[],
deadline_blocks: number,
}
#[entry]
node start(request: string) {
messages.push(system("Generate structured market params"));
messages.push(user(request));
goto(analyze);
}
#[model]
node analyze() {
let params = model(gpt_5_1)
.schema(MarketParams)
.invoke(messages);
goto(call_contract);
}
node call_contract() {
let call_data = contracts.encode_call(
CREATE_MARKET_SELECTOR, params
);
contracts.call(
PREDICTION_MARKET_CONTRACT,
call_data,
0n,
10000000000n
);
}#[agent] declaration
Identifies the program as an agent and locks the SHIP version. Runtime uses this to validate ABI and assign an on-chain identity.
#[entry] and node blocks
node is the basic unit of control flow. #[entry] marks the public entry point. goto transitions between nodes deterministically.
#[model] nodes
Mark a node as performing inference. The runtime emits a Tensor Commit for any model(...) call inside, and the result is constrained by .schema(...) so downstream code reads typed fields, not free text.
contracts.call(...)
Same calling convention as Ethereum-style contracts: selector, encoded args, value, gas budget. Agents can call contracts, contracts can callback agents in later blocks.
See the Examples page for the registration patterns and AIVM-level snippets. Try this exact agent live in the playground.
Integration with AIVM
SHIP compiles to AIVM opcodes, executed via AGENT_TICK() or MODEL_INFER().
Each construct maps to safe primitives: TLOAD, TCUSTOM, STATE_EXPORT, TRANSFER_TOKEN.
Tensor Commits link inference outputs to on-chain outcomes.