INTENT RUNTIME · V2
Turn requests into
structured intent.
Extract goals, preserve constraints, and track changes—with your model, in Node.js or MCP.
npm install @devcodex/intent-runtimeNode.js ≥20 · JavaScript / TypeScript · MCP
01 / THE REQUEST
Look up order 000123. Do not cancel the order.
Preserve what the user wants, including what must not happen.
This example configures an order Schema and selects orderId through fields.
Inspect input and configuration
The caller supplies this material. This fixed demo makes no model calls in the browser.
02 / STRUCTURED UNDERSTANDING · SUMMARY
Complete understanding- Look up order 000123
intent-2- ProhibitionDo not cancel the order
- orderId
- "000123"
orderIdPresentThe full goal tree lives in effective. This summary does not replace the complete response.
Inspect complete JSON
START WITH ONE CALL
Your model. One call.
Connect your model, call parse, and read goals and constraints. Add a Schema when you need business parameters.
import { Intent, IntentError } from '@devcodex/intent-runtime';
import { createApiExecutor } from '@devcodex/intent-runtime/adapters/api';
const apiKey = process.env.INTENT_API_KEY;
const model = process.env.INTENT_MODEL;
if (!apiKey || !model)
throw new Error('Set INTENT_API_KEY and INTENT_MODEL.');
const intent = new Intent({
language: 'en',
executor: createApiExecutor({ provider: 'openai', apiKey, model }),
});
const request = { input: 'Look up order 000123. Do not cancel the order.' };
try {
const result = await intent.parse(request);
console.log(JSON.stringify(result, null, 2));
console.log('Goals:', result.effective.intents.map(node => node.goal));
console.log('Issues:', result.issues.map(issue => issue.message));
}
catch (error) {
if (!(error instanceof IntentError))
throw error;
console.error(JSON.stringify(error.toJSON()));
process.exitCode = 1;
}
finally {
await intent.dispose();
}import {Intent, IntentError, type IntentParseRequest} from '@devcodex/intent-runtime';
import {createApiExecutor} from '@devcodex/intent-runtime/adapters/api';
const apiKey = process.env.INTENT_API_KEY;
const model = process.env.INTENT_MODEL;
if (!apiKey || !model) throw new Error('Set INTENT_API_KEY and INTENT_MODEL.');
const intent = new Intent({
language: 'en',
executor: createApiExecutor({provider: 'openai', apiKey, model}),
});
const request: IntentParseRequest = {input: 'Look up order 000123. Do not cancel the order.'};
try {
const result = await intent.parse(request);
console.log(JSON.stringify(result, null, 2));
console.log('Goals:', result.effective.intents.map(node => node.goal));
console.log('Issues:', result.issues.map(issue => issue.message));
} catch (error) {
if (!(error instanceof IntentError)) throw error;
console.error(JSON.stringify(error.toJSON()));
process.exitCode = 1;
} finally {
await intent.dispose();
}Set your model name and API key. Use type: module for JavaScript and compile TypeScript as ESM. Your own model or gateway works too.
FIT YOUR EXISTING WORKFLOW
Connect it to what you already use.
An application call, your current client model, a standalone service, or an existing MCP server: choose the path that fits your project.
Intent Runtime understands the material you supply. You provide messages and history; your application manages tools, authorization and business execution.