@mind2flow/agents-sdk
v0.5.0
Published
Official TypeScript SDK for the Mind2Flow AI agents platform
Maintainers
Readme
@mind2flow/agents-sdk
Typed, zero-dependency TypeScript client for the Mind2Flow AI agents platform.
npm install @mind2flow/agents-sdkimport { M2FClient } from '@mind2flow/agents-sdk';
const m2f = new M2FClient({ apiKey: process.env.M2F_API_KEY! });
const agent = await m2f.agents.create({ name: 'Bot', systemPrompt: '…' });
const { result } = await m2f.agents.execute(agent.id, { input: 'Hello!' });Resources: agents, crews, devices, tools, scheduledTasks, knowledge (GraphOS temporal knowledge graph), account, organization (TENANT/ADMIN reporting), artifacts (reports, test runs, prompt changes).
Analyse your agents (new in 0.3.0)
// Exact figures, from the database. Read `notes` alongside them.
const s = await m2f.agents.summary(agentId, { from: '2026-08-01', bucket: 'week' });
// Which conversations mention these terms? Customers' messages by default.
const hits = await m2f.agents.searchConversations(agentId, { terms: ['drill', 'paint'] });
// Whole threads, never cut mid-conversation.
const threads = await m2f.agents.conversations(agentId, { sessionIds: hits.terms[0].sessionIds });
// Ask anything; you define the fields. Runs an LLM on YOUR key — it costs tokens.
const a = await m2f.agents.analyzeConversations(agentId, {
question: 'What did the customer want, and did it end in a sale?',
fields: [{ name: 'products', description: 'each product asked for by name' }],
});
// Why did it stop working? Live checks, with `issues` and `notes`.
await m2f.agents.integrations(agentId);
await m2f.agents.channels(agentId);summary is exact; analyzeConversations reads text with a model and can be
wrong — keep the two apart when you report them.
Actions, test runs and artifacts (new in 0.4.0)
// What its apps actually answered: calls, errors, ids created.
await m2f.agents.actions(agentId);
// Test conversations, played for real (its connected apps DO run).
const run = await m2f.agents.runTests(agentId, { cases: [{ name: 'Price', turns: ['How much is the drill?'], expected: 'Quotes 1,890' }] });
// Reports as versioned, shareable documents.
const report = await m2f.artifacts.create({ template: 'operation_report', agentId });
const { token } = await m2f.artifacts.share(report.id);Phone calls (new in 0.5.0)
// Twilio and the number are set up once in the console (AI Agents → agent → Voice).
const { callSid } = await m2f.voice.call({ agentId, to: '+525512345678', variables: { nombre: 'Ana' } });
const call = await m2f.voice.waitForCall(callSid); // outcome, summary, credits, transcript
await m2f.voice.updateLine(agentId, { voice: 'Cristina', greeting: 'Hola, gracias por llamar.' });
await m2f.voice.pause(agentId);Requires Node 18+ (uses built-in fetch).
Prerequisites (one-time, in the dashboard): create a REST API key (Developers → API) and add your LLM provider key (Profile → API & Model Configuration — the knowledge graph needs an OpenAI key). API usage deducts platform credits per request; LLM usage bills to your own key (BYOK).
Full docs: https://github.com/pablocruzpineda/m2f-agents-sdk
