{"_id":"@alldaytech/multiverse-sdk","_rev":"2-690bcb5129c7ad71f97d7fb73f2c2143","name":"@alldaytech/multiverse-sdk","dist-tags":{"latest":"0.0.29"},"versions":{"0.0.28":{"name":"@alldaytech/multiverse-sdk","version":"0.0.28","keywords":["ai","agents","testing","simulation","llm"],"license":"MIT","_id":"@alldaytech/multiverse-sdk@0.0.28","maintainers":[{"name":"jvgaeta93","email":"jordan@alldaykitchens.com"}],"homepage":"https://github.com/virtualkitchenco/multiverse#readme","bugs":{"url":"https://github.com/virtualkitchenco/multiverse/issues"},"dist":{"shasum":"bff9638461e7ececf0ae0226c88ccd2ff629b381","tarball":"https://registry.npmjs.org/@alldaytech/multiverse-sdk/-/multiverse-sdk-0.0.28.tgz","fileCount":54,"integrity":"sha512-nEdOPpOQVvdwrKPxzrzI7fUbhEXhPHYQ6ksqPXqeT76f/suktB6QyHG6wwNiDmSkWDPo2OlkKVfwwgQyaUBhCg==","signatures":[{"sig":"MEUCIDYU5FHlDGd+MgP27OlRwOWDxDuCrVVH1XR4Z9EUzLv4AiEA5enm/KqTSWpYeAS46DlvwiNxXbRC12GjMI7PhKzz7XY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":171189},"main":"./dist/index.js","type":"module","_from":"file:alldaytech-multiverse-sdk-0.0.28.tgz","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./langchain":{"types":"./dist/adapters/langchain.d.ts","import":"./dist/adapters/langchain.js"}},"scripts":{"dev":"tsc --watch","test":"vitest --passWithNoTests","build":"tsc","typecheck":"tsc --noEmit"},"_npmUser":{"name":"jvgaeta93","email":"jordan@alldaykitchens.com"},"_resolved":"/private/var/folders/t6/zv3wp7hs2jn1r2vkgnp_6tpw0000gn/T/c4a9d4a91f14036088ae4ace1d19f09c/alldaytech-multiverse-sdk-0.0.28.tgz","_integrity":"sha512-nEdOPpOQVvdwrKPxzrzI7fUbhEXhPHYQ6ksqPXqeT76f/suktB6QyHG6wwNiDmSkWDPo2OlkKVfwwgQyaUBhCg==","repository":{"url":"git+https://github.com/virtualkitchenco/multiverse.git","type":"git","directory":"packages/sdk"},"_npmVersion":"10.8.2","description":"Simulation testing SDK for AI agents","directories":{},"_nodeVersion":"20.20.0","dependencies":{"nanoid":"^5.0.4","zod-to-json-schema":"^3.25.1","@alldaytech/multiverse-types":"0.0.28"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^1.2.0","typescript":"^5.3.3","@types/node":"^20.11.0"},"peerDependencies":{"zod":"^3.25 || ^4"},"peerDependenciesMeta":{"zod":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/multiverse-sdk_0.0.28_1773167495749_0.10128979059501986","host":"s3://npm-registry-packages-npm-production"}},"0.0.29":{"name":"@alldaytech/multiverse-sdk","version":"0.0.29","description":"Simulation testing SDK for AI agents","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","repository":{"type":"git","url":"git+https://github.com/virtualkitchenco/multiverse.git","directory":"packages/sdk"},"publishConfig":{"access":"public"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./langchain":{"types":"./dist/adapters/langchain.d.ts","import":"./dist/adapters/langchain.js"}},"dependencies":{"nanoid":"^5.0.4","zod-to-json-schema":"^3.25.1","@alldaytech/multiverse-types":"0.0.29"},"devDependencies":{"@types/node":"^20.11.0","typescript":"^5.3.3","vitest":"^1.2.0"},"peerDependencies":{"zod":"^3.25 || ^4"},"peerDependenciesMeta":{"zod":{"optional":true}},"license":"MIT","keywords":["ai","agents","testing","simulation","llm"],"engines":{"node":">=20"},"scripts":{"build":"tsc","dev":"tsc --watch","typecheck":"tsc --noEmit","test":"vitest --passWithNoTests"},"_id":"@alldaytech/multiverse-sdk@0.0.29","bugs":{"url":"https://github.com/virtualkitchenco/multiverse/issues"},"homepage":"https://github.com/virtualkitchenco/multiverse#readme","_integrity":"sha512-AVayHscaptj+k1MKh8P27aQl55or7Vwuw2QtELN2szY23+GYkQDNiEUcveByv53AhG/pc+ShuwMXLlQttpEWGw==","_resolved":"/tmp/267f8e9a5fec505fc7aaf1942d4e3224/alldaytech-multiverse-sdk-0.0.29.tgz","_from":"file:alldaytech-multiverse-sdk-0.0.29.tgz","_nodeVersion":"20.20.0","_npmVersion":"11.11.0","dist":{"integrity":"sha512-AVayHscaptj+k1MKh8P27aQl55or7Vwuw2QtELN2szY23+GYkQDNiEUcveByv53AhG/pc+ShuwMXLlQttpEWGw==","shasum":"fd3f8b82b78f681f8a2bba678e7955be40a0c228","tarball":"https://registry.npmjs.org/@alldaytech/multiverse-sdk/-/multiverse-sdk-0.0.29.tgz","fileCount":26,"unpackedSize":99782,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCICWx/bBg4P5HdFn9HZFJNnziQiWlEUTS2qMlNMLxVZ+5AiAXJOufszrzKjl2dUM3boUXiSv5FaFDxDCSbqUvU7WzmA=="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:c0a69ad4-fb66-4787-8ae4-90871ec3d919"}},"directories":{},"maintainers":[{"name":"jvgaeta93","email":"jordan@alldaykitchens.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/multiverse-sdk_0.0.29_1773168075494_0.5396047531554953"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-10T18:31:35.616Z","modified":"2026-03-10T18:41:15.786Z","0.0.28":"2026-03-10T18:31:35.913Z","0.0.29":"2026-03-10T18:41:15.636Z"},"bugs":{"url":"https://github.com/virtualkitchenco/multiverse/issues"},"license":"MIT","homepage":"https://github.com/virtualkitchenco/multiverse#readme","keywords":["ai","agents","testing","simulation","llm"],"repository":{"type":"git","url":"git+https://github.com/virtualkitchenco/multiverse.git","directory":"packages/sdk"},"description":"Simulation testing SDK for AI agents","maintainers":[{"name":"jvgaeta93","email":"jordan@alldaykitchens.com"}],"readme":"# @alldaytech/multiverse-sdk\n\nSimulation testing for AI agents. Test your agent against realistic scenarios with simulated users and automated quality evaluation — no real APIs needed.\n\n## Install\n\n```bash\nnpm install @alldaytech/multiverse-sdk zod\n```\n\nFor LangChain agents:\n\n```bash\nnpm install @alldaytech/multiverse-sdk zod @langchain/core @langchain/anthropic\n```\n\n## Quick Start\n\n**Autonomous agent** (default — pipelines, document processing, background jobs):\n\n```typescript\nimport { multiverse } from '@alldaytech/multiverse-sdk';\nimport { z } from 'zod';\n\nmultiverse.configure({\n  baseUrl: process.env.MULTIVERSE_URL,\n  apiKey: process.env.MULTIVERSE_API_KEY,\n});\n\nconst test = multiverse.describe({\n  name: 'submission-intake-agent',\n  task: 'Process insurance submission: extract documents, validate coverage, produce summary',\n  agent: runAgent,\n  // Mirror the real-world event your agent receives (optional but recommended)\n  triggerSchema: z.object({\n    submissionId: z.string(),\n    priority: z.enum(['standard', 'urgent']),\n  }),\n});\n\nconst scenarios = await test.generateScenarios({ count: 5 });\nconst results = await test.run({\n  scenarios,\n  success: (world) => world.getCollection('intake_summaries').size > 0,\n});\n\nconsole.log(`${results.passRate}% pass`);\n```\n\n**Conversational agent** (opt in when there's a human user):\n\n```typescript\nconst test = multiverse.describe({\n  name: 'flight-booking-agent',\n  task: 'Help the user book a flight',\n  agent: runAgent,\n  conversational: true,  // Enables simulated user — mutually exclusive with triggerSchema\n  variables: z.object({\n    expectedBookings: z.number().describe('Total bookings to create'),\n  }),\n});\n\nconst scenarios = await test.generateScenarios({ count: 5 });\n\nconst results = await test.run({\n  scenarios,\n  success: (world, trace, scenario) =>\n    world.getCollection('bookings').size === scenario.variables.expectedBookings,\n});\n\nconsole.log(`${results.passRate}% pass`);\n```\n\n## API\n\n### `multiverse.configure(config)`\n\nInitialize the SDK. Call once at startup.\n\n```typescript\nmultiverse.configure({\n  baseUrl: process.env.MULTIVERSE_URL,\n  apiKey: process.env.MULTIVERSE_API_KEY,\n});\n```\n\n### `multiverse.tool(def)`\n\nRegister a tool for simulation. Works with any plain function — no framework required.\n\n```typescript\nconst searchFlights = multiverse.tool({\n  name: 'searchFlights',\n  description: 'Search for available flights',\n  input: z.object({\n    from: z.string().describe('Departure airport code'),\n    to: z.string().describe('Arrival airport code'),\n    date: z.string().describe('Departure date (YYYY-MM-DD)'),\n  }),\n  output: SearchResultSchema,\n  execute: async (input) => realSearchFlights(input),\n  effects: (output, world) =>\n    output.flights.map((f) => ({\n      operation: 'create' as const,\n      collection: 'flights',\n      id: f.id,\n      data: f,\n    })),\n});\n```\n\nReturns a callable function `(input) => Promise<output>`. During tests, calls are intercepted and simulated. Outside tests, `execute` is called directly.\n\n| Option | Type | Description |\n|--------|------|-------------|\n| `name` | `string` | Tool name |\n| `description` | `string` | Tool description |\n| `input` | `ZodSchema` | Input schema |\n| `output` | `ZodSchema` | Output schema |\n| `execute` | `(input) => Promise<output>` | Real implementation |\n| `effects` | `(output, world) => Effect[]` | Declare state changes from output |\n\n### `wrap(tool, config)`\n\nWrap a LangChain tool for simulation. Extracts `name`, `description`, and `schema` automatically.\n\n```typescript\nimport { wrap } from '@alldaytech/multiverse-sdk';\n\nconst myTool = wrap(langchainTool, {\n  output: OutputSchema,\n  effects: (output, world) => [\n    { operation: 'create', collection: 'orders', id: output.id, data: output },\n  ],\n});\n```\n\n| Option | Type | Description |\n|--------|------|-------------|\n| `output` | `ZodSchema` | Output schema for responses |\n| `effects` | `(output, world) => Effect[]` | Declare state changes from output |\n| `input` | `ZodSchema` | Input schema (auto-extracted from LangChain tools) |\n| `name` | `string` | Tool name (auto-extracted from LangChain tools) |\n| `description` | `string` | Tool description (auto-extracted from LangChain tools) |\n\n### `multiverse.describe(options)`\n\nDefine a test. Returns an object with `generateScenarios()` and `run()` methods.\n\n```typescript\n// Autonomous agent (default)\nconst test = multiverse.describe({\n  name: 'my-agent',\n  task: 'Process the task',\n  agent: runAgent,\n  // triggerSchema mirrors the real-world event schema that triggers your agent (optional)\n  triggerSchema: z.object({\n    jobId: z.string(),\n    type: z.enum(['ingest', 'process', 'export']),\n  }),\n});\n\n// Conversational agent (opt in)\nconst test = multiverse.describe({\n  name: 'my-chatbot',\n  task: 'Help users complete the task',\n  agent: runAgent,\n  conversational: true,   // Enables simulated user — mutually exclusive with triggerSchema\n  variables: z.object({   // Optional: typed variables for assertions in success()\n    expectedBookings: z.number(),\n  }),\n});\n```\n\n| Option | Type | Description |\n|--------|------|-------------|\n| `name` | `string` | Agent name for grouping in the dashboard |\n| `task` | `string` | What the agent is being tested on |\n| `agent` | `AgentFn` | Agent function to test |\n| `conversational` | `boolean` | Enable simulated user (chatbots, assistants). Mutually exclusive with `triggerSchema` |\n| `triggerSchema` | `ZodSchema` | Constrains the generated event payload (autonomous agents only) |\n| `variables` | `ZodSchema` | Typed scenario variables accessible in `success()` via `scenario.variables` |\n\n`conversational` and `triggerSchema` are mutually exclusive at the TypeScript level.\n\n**Agent function signature:**\n\n```typescript\nasync function runAgent(ctx: {\n  userMessage: string;  // Generated event payload (autonomous) or latest user message (conversational)\n  runId: string;        // Stable across turns, use for memory/thread scoping\n}): Promise<unknown>\n```\n\n### `test.generateScenarios(options)`\n\nGenerate test scenarios upfront for inspection or reuse.\n\n```typescript\nconst scenarios = await test.generateScenarios({ count: 10 });\n```\n\nVariables are typed on `multiverse.describe()` via the `variables` option, not here.\n\n### `test.saveScenarios(scenarios)`\n\nSave generated scenarios for reuse across runs.\n\n```typescript\nawait test.saveScenarios(scenarios);\n```\n\nAppends to any previously saved scenarios. Each scenario has a stable `id` (nanoid).\n\n### `test.getScenarios()`\n\nLoad previously saved scenarios.\n\n```typescript\nconst { scenarios, scenarioCount } = await test.getScenarios();\n```\n\n### `test.clearScenarios()`\n\nRemove all saved scenarios.\n\n```typescript\nawait test.clearScenarios();\n```\n\n### `test.run(options)`\n\nRun tests against the agent.\n\n```typescript\nconst results = await test.run({\n  scenarios,              // From generateScenarios()\n  success: (world, trace, scenario) => {\n    return world.getCollection('bookings').size === scenario.variables.expectedBookings;\n  },\n  trialsPerScenario: 4,\n  maxTurns: 20,           // Max turns per run (conversational agents)\n  qualityThreshold: 70,   // Default: 70\n  criteria: [             // Custom quality criteria (default: communication, error_handling, efficiency, accuracy)\n    { name: 'politeness', description: 'Responds politely at all times' },\n  ],\n  skipReport: true,       // Skip LLM report generation\n  concurrency: 8,\n  onProgress: (p) => console.log(`${p.completed}/${p.total}`),\n  ci: {\n    postToPR: true,       // Install the Multiverse GitHub App to enable\n    printReport: true,\n  },\n});\n```\n\n**Results:**\n\n```typescript\ninterface TestResults {\n  passRate: number;\n  runs: RunResult[];\n  duration: number;\n  url?: string;\n  markdown?: string;\n}\n```\n\n## LangChain Integration\n\n`wrap()` works with any LangChain tool. It extracts `name`, `description`, and `schema` automatically:\n\n```typescript\nimport { ChatAnthropic } from '@langchain/anthropic';\nimport { tool } from '@langchain/core/tools';\nimport { createReactAgent } from '@langchain/langgraph/prebuilt';\nimport { multiverse, wrap } from '@alldaytech/multiverse-sdk';\n\n// Your LangChain tools\nconst searchFlightsTool = tool(\n  async ({ from, to, date }) => { /* real implementation */ },\n  {\n    name: 'searchFlights',\n    description: 'Search for available flights',\n    schema: z.object({\n      from: z.string().describe('Departure airport code'),\n      to: z.string().describe('Arrival airport code'),\n      date: z.string().describe('Departure date (YYYY-MM-DD)'),\n    }),\n  }\n);\n\n// Wrap for simulation\nconst searchFlights = wrap(searchFlightsTool, {\n  output: SearchResultSchema,\n  effects: (output, world) =>\n    output.flights.map((f) => ({\n      operation: 'create' as const,\n      collection: 'flights',\n      id: f.id,\n      data: f,\n    })),\n});\n\n// Use wrapped tools directly in your agent\nconst agent = createReactAgent({\n  llm: new ChatAnthropic({ model: 'claude-sonnet-4-20250514' }),\n  tools: [searchFlights, bookFlight],\n});\n```\n\nWrapped tools are drop-in replacements — they preserve the original tool's type, name, and schema.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}