Skip to content
MANTYX.IO

Quickstart

The same example, in all three SDKs. It defines an ephemeral agent that has access to one local tool (read_file) and asks the agent to read a file from your filesystem.

Terminal window
npm install @mantyx/sdk
Terminal window
export MANTYX_API_KEY=mtx_live_...
export MANTYX_WORKSPACE_SLUG=acme-corp
oneshot.ts
import { MantyxClient, defineLocalTool } from "@mantyx/sdk";
import { z } from "zod";
import { readFile } from "node:fs/promises";
const client = new MantyxClient({
apiKey: process.env.MANTYX_API_KEY!,
workspaceSlug: process.env.MANTYX_WORKSPACE_SLUG!,
});
const result = await client.runAgent({
systemPrompt: "You are a helpful filesystem assistant.",
prompt: "Read /etc/hostname and tell me what it says.",
tools: [
defineLocalTool({
name: "read_file",
description: "Read a UTF-8 file from the local filesystem.",
parameters: z.object({ path: z.string() }),
execute: ({ path }) => readFile(path, "utf8"),
}),
],
});
console.log(result.text);
  • Streaming — get tokens as they arrive instead of one final string.
  • Sessions — multi-turn conversations with persisted history.
  • Persisted agents — point at an existing workspace agent by id.