import { createRuntime, defineTool, scriptedModel, sqlite } from "@larkxai/react-native";
const runtime = await createRuntime({
storage: sqlite(),
ownerId: "notes",
});
const agent = runtime.createAgent({
name: "notes",
version: 1,
instructions: "Read the note and answer in one line.",
model: scriptedModel([
{
message: null,
finish: "tool_calls",
calls: [{ id: "call-1", name: "read_notes", arguments: {} }],
},
{ message: "Seal needs service.", finish: "stop", calls: [] },
]),
tools: [
defineTool({
name: "read_notes",
description: "Read the local inspection notes.",
effects: "pure",
schema: { type: "object", properties: {} },
handler: () => ({ notes: ["Seal weeps above 80 psi."] }),
}),
],
});
const run = await agent.start({ message: "Inspect pump 12", runId: "notes-1" });
const result = await run.result();
console.log(result.message);
await runtime.close();