DEVELOPERS / WORKED EXAMPLE
An AI task harness.
A check you can run.
Follow one complete OY1 MCP task: predict a total, discover an error, save the evidence, revise the next step and finish with two recorded checks.
01 / THE TASK
Three items. One budget.
Calculate three items at 17 plus 9 delivery. Check the total and whether it fits a budget of 65.
The arithmetic is 3 × 17 + 9 = 60, leaving 5. To make the correction visible, this example deliberately proposes 50 first. JavaScript performs the calculation in the client; OY1 receives the prediction and the reported result.
- Begin with two criteria.
oy1_beginsaves the goal: calculate the total and check the budget. The returned task ID and version are used for subsequent writes. - Compare prediction with observation.
oy1_proposerecords the provisional total of 50. The client calculates 60 and submits it withoy1_observe. The mismatch puts the task intoreview_required. - Remember the evidence.
oy1_rememberstores the corrected total as supported knowledge, referencing observation 0.oy1_recallretrieves the saved state without repeating the calculation. - Revise and finish.
The next proposal explains the correction and predicts that 60 fits the budget. A second observation records that check.
oy1_finishsucceeds after both criteria pass.
02 / RECORDED RESULT
The state changes are visible.
The reference script is checked against the real MCP service in an isolated local integration test. The output below is the expected result verified by that test on 9 September 2026. It contains no account IDs, credentials or customer data.
{
"trace": [
{
"tool": "oy1_begin",
"phase": "ready",
"version": 1
},
{
"tool": "oy1_propose",
"phase": "awaiting_outcome",
"version": 2
},
{
"tool": "oy1_observe",
"phase": "review_required",
"version": 3
},
{
"tool": "oy1_remember",
"phase": "review_required",
"version": 4
},
{
"tool": "oy1_recall",
"phase": "review_required",
"version": 4
},
{
"tool": "oy1_propose",
"phase": "awaiting_outcome",
"version": 5
},
{
"tool": "oy1_observe",
"phase": "ready",
"version": 6
},
{
"tool": "oy1_finish",
"phase": "completed",
"version": 7
}
],
"answer": "The total is 60, leaving 5 within the 65 budget.",
"assessment": "client_reported_checks",
"modelCalls": 0
}The task advances from version 1 to 7. Recall leaves the version unchanged because it is a read. The final assessment is client_reported_checks: an explicit record of the client’s evidence and verdicts.
03 / RUN THE EXAMPLE
Use your own connection.
Use the setup prompt to let ChatGPT connect OY1 on your computer, then try the same task in a conversation.
- Enable OY1.
Start a new conversation in your connected AI app and select OY1 from its tools.
- Send the task.
Use OY1 to calculate three items at 17 plus 9 delivery. Check the total and whether it fits a budget of 65.
- Check the tool activity.
Confirm the app used OY1. The expected total is 60, with 5 remaining. A model may use a different sequence of steps from the recorded script above.
The recorded trace above comes from a scripted integration test with eight tool calls and no model calls. Your conversation uses your AI app’s model and may take a different number of tool calls.
Developer reference: source of the recorded trace
This reference script produced the fixed trace above and remains covered by the integration test. Its original authentication setup is retained for existing developer integrations; use the OAuth guide to connect a new app.
Download the reference source →
// OY1 worked example. Node.js 24+; no dependencies or model calls.
// Uses your OY_API_KEY and creates one saved task in your OY Labs account.
import { randomUUID } from 'node:crypto';
import { pathToFileURL } from 'node:url';
export async function runCheckedTask(call) {
const trace = [];
const step = async (name, args) => {
const task = await call(name, args);
trace.push({ tool: name, phase: task.phase, version: task.version });
return task;
};
const write = task => ({
taskId: task.taskId, expectedVersion: task.version, operationId: randomUUID(),
});
let task = await step('oy1_begin', {
goal: 'Calculate three items at 17 plus 9 delivery; check a budget of 65.',
successCriteria: ['Calculate the total.', 'Check the budget.'],
operationId: randomUUID(),
});
task = await step('oy1_propose', {
...write(task), hypothesis: 'A provisional total of 50 needs checking.',
action: { tool: 'client_calculation', inputSummary: 'Calculate 3 * 17 + 9' },
predictions: [{ key: 'total', expected: 50 }],
});
const total = 3 * 17 + 9;
task = await step('oy1_observe', {
...write(task), actionId: task.pending.id, outcome: 'observed',
summary: 'The calculation returns 60, contradicting the prediction of 50.',
values: { total },
source: { kind: 'calculation', reference: 'JavaScript in checked-task.mjs' },
criterionResults: [{ criterionId: 'c1', verdict: 'pass', observationKeys: ['total'] }],
});
task = await step('oy1_remember', {
...write(task), key: 'total', knowledge: 'The calculated total is 60.',
confidence: 'supported', evidence: [0],
});
await step('oy1_recall', { taskId: task.taskId, query: 'total' });
task = await step('oy1_propose', {
...write(task), hypothesis: 'The observed total of 60 fits the 65 budget.',
revisionReason: 'The calculation contradicted the provisional total; use 60.',
action: { tool: 'client_calculation', inputSummary: 'Compare total <= 65' },
predictions: [{ key: 'withinBudget', expected: true }],
});
task = await step('oy1_observe', {
...write(task), actionId: task.pending.id, outcome: 'observed',
summary: 'The total is within budget.', values: { withinBudget: total <= 65 },
source: { kind: 'calculation', reference: 'JavaScript in checked-task.mjs' },
criterionResults: [{ criterionId: 'c2', verdict: 'pass', observationKeys: ['withinBudget'] }],
});
task = await step('oy1_finish', {
...write(task), answer: `The total is ${total}, leaving ${65 - total} within the 65 budget.`,
});
return { trace, answer: task.answer, assessment: task.assessment, modelCalls: 0 };
}
export async function connectOY1({ endpoint = 'https://oylabs.ai/mcp', apiKey }) {
if (!apiKey) throw new Error('Set OY_API_KEY to a personal key with harness:run permission.');
let id = 0, protocolVersion;
const rpc = async (method, params, notification = false) => {
const response = await fetch(endpoint, {
method: 'POST',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
Accept: 'application/json, text/event-stream',
...(protocolVersion ? { 'MCP-Protocol-Version': protocolVersion } : {}),
},
body: JSON.stringify({ jsonrpc: '2.0', ...(notification ? {} : { id: ++id }), method, params }),
signal: AbortSignal.timeout(30000),
});
if (!response.ok) throw new Error(`MCP HTTP ${response.status}. Check your connection and key permissions.`);
if (notification) return;
const message = await response.json();
if (message.error) throw new Error(`MCP error ${message.error.code}: ${message.error.message}`);
return message.result;
};
const initialized = await rpc('initialize', {
protocolVersion: '2025-11-25', capabilities: {},
clientInfo: { name: 'oy1-worked-example', version: '1.0.0' },
});
protocolVersion = initialized.protocolVersion;
await rpc('notifications/initialized', {}, true);
return async (name, args) => {
const result = await rpc('tools/call', { name, arguments: args });
if (result.isError) throw new Error(`${name} failed. Stop and recall the task before retrying.`);
return result.structuredContent.result;
};
}
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
const call = await connectOY1({ apiKey: process.env.OY_API_KEY });
console.log(JSON.stringify(await runCheckedTask(call), null, 2));
}
04 / INTERPRETATION
What the example establishes.
It exercises authenticated MCP initialization, versioned task writes, prediction comparison, supported memory, recall, revision and completion. The checks use the same controller and original memory implementation as the hosted OY1 service.
The observations are scripted. This is a reproducible workflow demonstration, not a customer case study, model comparison or intelligence benchmark. OY1 does not independently verify that an external tool ran or that a client’s account of the world is true.
For evaluation scope and the separate ARC-AGI-3 result, read the evaluation methodology. For the available tools and error handling, see the MCP reference.