Interactive Preview

SHIP Playground

See how SHIP compiles intent into verifiable agent execution. Hit run, watch the simulated trace.

Execution on this page is simulated. The real runtime is available through preview access.

An agent receives a natural-language request, asks a model for structured market parameters, and calls the prediction-market contract.

market_creator.ship
Read only
#[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
  );
}
Execution trace
Press Run to compile, infer, and verify.