{"_id":"agnostai","_rev":"6-54262419786d21133cb7a2a02d8bcdec","name":"agnostai","dist-tags":{"latest":"0.2.3"},"versions":{"0.1.0":{"name":"agnostai","version":"0.1.0","keywords":["agnost","ai","agent","conversation","tracking","analytics","llm","observability"],"author":{"name":"Agnost AI","email":"founders@agnost.ai"},"license":"MIT","_id":"agnostai@0.1.0","maintainers":[{"name":"prrthh132","email":"ajmeraparth132@gmail.com"}],"homepage":"https://agnost.ai","bugs":{"url":"https://github.com/agnost-ai/agnost-ai/issues"},"dist":{"shasum":"f8ddcaa42e7fbf61629bbd00c46dddf72d4d2020","tarball":"https://registry.npmjs.org/agnostai/-/agnostai-0.1.0.tgz","fileCount":8,"integrity":"sha512-43eN4kyL3GuPjRFkLDBB2HduG2C8o4xsyEaae4zZFv5E33KSXd4Kfx6a6Cv46Im9fHGav7f9TBV7JBsDQ1w5FQ==","signatures":[{"sig":"MEUCIE7XkFWHRNismTgjHBrTSU9hzPKj1t5PiO0nj3QnMbtQAiEAzwaO59VUuR2gqWqgfZEEP0k+hRzlDK/Mgr1I3/IkrBU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":165875},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"2d606cd6822981364af9bfb11c9e903f2dd71407","scripts":{"dev":"tsup --watch","lint":"eslint src --ext .ts","test":"vitest","build":"tsup","clean":"rm -rf dist","test:run":"vitest run","typecheck":"tsc --noEmit","prepublishOnly":"npm run build"},"_npmUser":{"name":"prrthh132","email":"ajmeraparth132@gmail.com"},"repository":{"url":"git+https://github.com/agnost-ai/agnost-ai.git","type":"git"},"_npmVersion":"10.9.2","description":"Agnost Conversation SDK for TypeScript - Track AI agent conversations with automatic latency measurement","directories":{},"_nodeVersion":"23.11.0","dependencies":{"uuid":"^9.0.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","vitest":"^1.0.0","typescript":"^5.0.0","@types/node":"^20.0.0","@types/uuid":"^9.0.0"},"_npmOperationalInternal":{"tmp":"tmp/agnostai_0.1.0_1772654088016_0.006829382238425108","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"agnostai","version":"0.1.1","keywords":["agnost","ai","agent","conversation","tracking","analytics","llm","observability"],"author":{"name":"Agnost AI","email":"founders@agnost.ai"},"license":"MIT","_id":"agnostai@0.1.1","maintainers":[{"name":"prrthh132","email":"ajmeraparth132@gmail.com"}],"homepage":"https://agnost.ai","bugs":{"url":"https://github.com/agnost-ai/agnost-ai/issues"},"dist":{"shasum":"5f34eaaed0b637e73e78afef7a5d28497faded82","tarball":"https://registry.npmjs.org/agnostai/-/agnostai-0.1.1.tgz","fileCount":8,"integrity":"sha512-nAbehh1pM8MEzn3Ym+hJoDjWIinLhhfVL5zfiXv3iteYozqpt1A3/axklbvZA1AGkaEY5JWgc3gAO938kXTg3w==","signatures":[{"sig":"MEUCIHShg7hM0HUSDiW4fuBOmJP+1pPlviZ6Js4t8jHtonIDAiEAjnM66CLfxoI3sm4UXTKnUwpuFa41ZnSehzignL/9zRc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":165763},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"2fa51077c14fea94146047d9ec3bf9b662a46441","scripts":{"dev":"tsup --watch","lint":"eslint src --ext .ts","test":"vitest","build":"tsup","clean":"rm -rf dist","test:run":"vitest run","typecheck":"tsc --noEmit","prepublishOnly":"npm run build"},"_npmUser":{"name":"prrthh132","email":"ajmeraparth132@gmail.com"},"repository":{"url":"git+https://github.com/agnost-ai/agnost-ai.git","type":"git"},"_npmVersion":"10.9.2","description":"Agnost Conversation SDK for TypeScript - Track AI agent conversations with automatic latency measurement","directories":{},"_nodeVersion":"23.11.0","dependencies":{"uuid":"^9.0.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","vitest":"^1.0.0","typescript":"^5.0.0","@types/node":"^20.0.0","@types/uuid":"^9.0.0"},"_npmOperationalInternal":{"tmp":"tmp/agnostai_0.1.1_1772654249059_0.6564179834341479","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"agnostai","version":"0.1.2","keywords":["agnost","ai","agent","conversation","tracking","analytics","llm","observability"],"author":{"name":"Agnost AI","email":"founders@agnost.ai"},"license":"MIT","_id":"agnostai@0.1.2","maintainers":[{"name":"prrthh132","email":"ajmeraparth132@gmail.com"}],"homepage":"https://agnost.ai","bugs":{"url":"https://github.com/agnost-ai/agnost-ai/issues"},"dist":{"shasum":"24a19db193a62c05392031e3c084cf4a521c2e29","tarball":"https://registry.npmjs.org/agnostai/-/agnostai-0.1.2.tgz","fileCount":8,"integrity":"sha512-BpXHRNpNQSXF2WUXeTX1HirSg055BHBo9Kg7/ffkQxbUeMF/DXRzkVoCeUVsYY9EkYBa5H/21QxvQ9YEgtEGJg==","signatures":[{"sig":"MEUCICpJjy07XbXvH+oXfw3GfXj93vNJWfC8UTlcbD8a/53DAiEAqR6RkDpi+uXsY9F6Ddl8gGo9+U18TdJ9h/2UnPGzDDQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":172170},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"2fa51077c14fea94146047d9ec3bf9b662a46441","scripts":{"dev":"tsup --watch","lint":"eslint src --ext .ts","test":"vitest","build":"tsup","clean":"rm -rf dist","test:run":"vitest run","typecheck":"tsc --noEmit","prepublishOnly":"npm run build"},"_npmUser":{"name":"prrthh132","email":"ajmeraparth132@gmail.com"},"repository":{"url":"git+https://github.com/agnost-ai/agnost-ai.git","type":"git"},"_npmVersion":"10.9.2","description":"Agnost Conversation SDK for TypeScript - Track AI agent conversations with automatic latency measurement","directories":{},"_nodeVersion":"23.11.0","dependencies":{"uuid":"^9.0.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","vitest":"^1.0.0","typescript":"^5.0.0","@types/node":"^20.0.0","@types/uuid":"^9.0.0"},"_npmOperationalInternal":{"tmp":"tmp/agnostai_0.1.2_1772657469905_0.750278186118162","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"agnostai","version":"0.2.0","keywords":["agnost","ai","agent","conversation","tracking","analytics","llm","observability"],"author":{"name":"Agnost AI","email":"founders@agnost.ai"},"license":"MIT","_id":"agnostai@0.2.0","maintainers":[{"name":"prrthh132","email":"ajmeraparth132@gmail.com"}],"homepage":"https://agnost.ai","bugs":{"url":"https://github.com/agnost-ai/agnost-ai/issues"},"dist":{"shasum":"d858f6d096ebfb362f30250b6e7e26674f00ea45","tarball":"https://registry.npmjs.org/agnostai/-/agnostai-0.2.0.tgz","fileCount":6,"integrity":"sha512-8ir37phVHrvAG2utbW0BY3/NHflWnhobxsoYUInAay/h8RfA/4hDSnRr8UrhCERGdiwNvVOVEdrthWx5NOvyRQ==","signatures":[{"sig":"MEUCIQCNDcDJ9XHFXYE8WC+a6O9JhFPgLtzM+p2p9d0DqxGFrQIgGJjhSmGA+MRIbatCtKmYlcD7SeBh3wnQEmCTUz+haJ8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":50924},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"cab26d29876d709e00ecdaecd747c43188e346fb","scripts":{"dev":"tsup --watch","test":"vitest","build":"tsup","clean":"rm -rf dist","test:run":"vitest run","typecheck":"tsc --noEmit","prepublishOnly":"npm run build"},"_npmUser":{"name":"prrthh132","email":"ajmeraparth132@gmail.com"},"repository":{"url":"git+https://github.com/agnost-ai/agnost-ai.git","type":"git"},"_npmVersion":"10.9.2","description":"Agnost Conversation SDK for TypeScript - Track AI agent conversations with automatic latency measurement","directories":{},"_nodeVersion":"23.11.0","dependencies":{"uuid":"^14.0.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","vitest":"^4.0.18","typescript":"^5.0.0","@types/node":"^20.0.0","@types/uuid":"^9.0.0"},"_npmOperationalInternal":{"tmp":"tmp/agnostai_0.2.0_1783796563696_0.9391728570123925","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"name":"agnostai","version":"0.2.2","keywords":["agnost","ai-agents","agent-monitoring","llm-observability","observability","opentelemetry","llm-evaluation","voice-agents","chatbots","vercel-ai-sdk","mastra"],"author":{"name":"Agnost AI","email":"founders@agnost.ai"},"license":"MIT","_id":"agnostai@0.2.2","maintainers":[{"name":"prrthh132","email":"ajmeraparth132@gmail.com"}],"homepage":"https://docs.agnost.ai/typescript-conversation","bugs":{"url":"https://docs.agnost.ai"},"dist":{"shasum":"94a512c831232ce96d9eb745c440f24dbad321f5","tarball":"https://registry.npmjs.org/agnostai/-/agnostai-0.2.2.tgz","fileCount":6,"integrity":"sha512-F06zerV1FMyfYqhtJOOjsUJnnaLi1ov2Bxo2EPoyKE50oaEc3scVyw6ZFpox4sjE1czi9Lt7hNQ5Q0H3SfVEfA==","signatures":[{"sig":"MEQCIGOSA/j7mFEwSCV5MeIogbhs7+FqTcOySRmDXtNhRKxMAiBplhPmiO2x6n5bKbzyMlg1XOqtSiR5nrAVV3lGtevprg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEQCIA4zBsVj+tbx7mluo8CK4UBwmwgDVFTLT89W4OHtFZbzAiAN7BAk+LWdKly9aQ5WxVIl/Aat4vWmWLY8aWsBK3ZqUQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":53678},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","engines":{"node":">=20.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"85b3f8db708e8143ba06ed4be28440351b6c42fb","scripts":{"dev":"tsup --watch","test":"vitest","build":"tsup","clean":"rm -rf dist","test:run":"vitest run","typecheck":"tsc --noEmit","prepublishOnly":"npm run build"},"_npmUser":{"name":"prrthh132","email":"ajmeraparth132@gmail.com"},"overrides":{"esbuild":"^0.28.1"},"_npmVersion":"11.19.1","description":"TypeScript SDK for Agnost AI, which monitors AI agents in production: chat agents, voice agents, copilots and MCP servers.","directories":{},"_nodeVersion":"24.22.3","dependencies":{"uuid":"^14.0.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","vitest":"^4.1.11","typescript":"^5.0.0","@types/node":"^20.0.0","@types/uuid":"^9.0.0"},"_npmOperationalInternal":{"tmp":"tmp/agnostai_0.2.2_1795425293511_0.5085722221714657","host":"s3://npm-registry-packages-npm-production"}},"0.2.3":{"_id":"agnostai@0.2.3","bugs":{"url":"https://docs.agnost.ai"},"dist":{"shasum":"9b4d153391def4ff487ec0b74bd1a1a668f2cca2","tarball":"https://registry.npmjs.org/agnostai/-/agnostai-0.2.3.tgz","fileCount":6,"integrity":"sha512-1qlInIZ1XwAeFN9lVLMwpzI8BWyV+mHaO2Y/jYeu7AvK9w/DFS2dPb/MkNjI5bPpNYLn8x1HsbvMJerPxYMlCA==","signatures":[{"sig":"MEUCIH3rqA+SQdpLfLAndSZ3efoXn+tce0+laBsoxyVxnyQdAiEAi2vcFCaVUd59sos8MwWHJ7upuLw5nIRCYzjQ8Q0404g=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD6o0mtbmvqY57cBoxUcYgA2/zq3Cn2WaZhQXRIJTd+SAIhAPY3B/arOukS7uGIYHHlTgZBuNALzgKn35RFdyW6/wBL"}],"unpackedSize":53792},"main":"dist/index.js","name":"agnostai","types":"dist/index.d.ts","author":{"name":"Agnost AI","email":"founders@agnost.ai"},"module":"dist/index.mjs","engines":{"node":">=20.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"6016df51c8ac220b48efbd9f6d4fa4597b75e9cf","license":"MIT","scripts":{"dev":"tsup --watch","test":"vitest","build":"tsup","clean":"rm -rf dist","test:run":"vitest run","typecheck":"tsc --noEmit","prepublishOnly":"npm run build"},"version":"0.2.3","_npmUser":{"name":"prrthh132","email":"ajmeraparth132@gmail.com"},"homepage":"https://docs.agnost.ai/typescript-conversation","keywords":["agnost","ai-agents","agent-monitoring","llm-observability","observability","opentelemetry","llm-evaluation","voice-agents","chatbots","vercel-ai-sdk","mastra"],"overrides":{"esbuild":"^0.28.1"},"_npmVersion":"11.19.1","description":"TypeScript SDK for Agnost AI, which monitors AI agents in production: chat agents, voice agents, copilots and MCP servers.","directories":{},"maintainers":[{"name":"prrthh132","email":"ajmeraparth132@gmail.com"}],"_nodeVersion":"24.22.3","dependencies":{"uuid":"^14.0.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","vitest":"^4.1.11","typescript":"^5.0.0","@types/node":"^20.0.0","@types/uuid":"^9.0.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/agnostai_0.2.3_1795774200786_0.8838754637167331"}}},"time":{"created":"2026-03-04T19:54:48.015Z","modified":"2026-11-27T10:10:01.041Z","0.1.0":"2026-03-04T19:54:48.198Z","0.1.1":"2026-03-04T19:57:29.209Z","0.1.2":"2026-03-04T20:51:10.049Z","0.2.0":"2026-07-11T19:02:43.912Z","0.2.2":"2026-11-23T09:14:53.620Z","0.2.3":"2026-11-27T10:10:00.880Z"},"bugs":{"url":"https://docs.agnost.ai"},"author":{"name":"Agnost AI","email":"founders@agnost.ai"},"license":"MIT","homepage":"https://docs.agnost.ai/typescript-conversation","keywords":["agnost","ai-agents","agent-monitoring","llm-observability","observability","opentelemetry","llm-evaluation","voice-agents","chatbots","vercel-ai-sdk","mastra"],"description":"TypeScript SDK for Agnost AI, which monitors AI agents in production: chat agents, voice agents, copilots and MCP servers.","maintainers":[{"name":"prrthh132","email":"ajmeraparth132@gmail.com"}],"readme":"# Agnost AI TypeScript SDK\n\n[![npm version](https://badge.fury.io/js/agnostai.svg)](https://badge.fury.io/js/agnostai)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue.svg)](https://www.typescriptlang.org/)\n\nSend your AI agent's conversations, tool calls and events to [Agnost AI](https://agnost.ai), which monitors AI agents in production. It judges whole conversations to catch failures, frustrated users and broken tool calls, alerts in Slack, and opens pull requests with fixes tested against past runs.\n\n## Installation\n\n```bash\nnpm install agnostai\n```\n\nRequires Node.js 20 or newer. Ships ES module and CommonJS builds with type\ndefinitions. To monitor an MCP server's tool calls, use the\n[`agnost`](https://www.npmjs.com/package/agnost) MCP SDK instead.\n\n## Basic Usage\n\n```typescript\nimport * as agnost from 'agnostai';\n\n// Initialize with your project ID\nagnost.init('your-project-id');\n\n// Begin an AI interaction\nconst interaction = agnost.begin({\n  userId: 'user_123',\n  agentName: 'weather-agent',\n  input: 'What is the weather?'\n});\nif (!interaction) throw new Error('Agnost is not initialized. Call agnost.init() first.');\n\n// ... do async work ...\n\n// Complete the interaction (latency auto-calculated)\ninteraction.end('The weather is sunny.');\n\n// Before a short-lived process exits (scripts, serverless handlers), deliver\n// everything still pending:\nawait agnost.shutdown();\n```\n\nRunnable versions of this and a multi-turn chatbot are in\n[`examples/`](./examples).\n\n## API Reference\n\n### `init(writeKey, config?)`\n\nInitialize the SDK with your project ID.\n\n```typescript\nagnost.init('your-project-id');\n\n// With custom configuration\nagnost.init('your-project-id', {\n  endpoint: 'https://api.agnost.ai',\n  debug: true\n});\n```\n\n### `identify(userId, traits)`\n\nAssociate user characteristics with a user ID.\n\n```typescript\nagnost.identify('user_123', {\n  name: 'John Doe',\n  email: 'john@example.com',\n  age: 30,\n  plan: 'paid'\n});\n```\n\n### `begin(options)`\n\nBegin a partial interaction for deferred completion. Use this when the output is not immediately available.\n\n**Automatic latency tracking** - Latency is automatically calculated from `begin()` to `end()`!\n\n```typescript\n// Pass input directly (recommended)\nconst interaction = agnost.begin({\n  userId: 'user_123',\n  agentName: 'weather-agent',\n  input: 'What is the weather?'\n});\nif (!interaction) throw new Error('Agnost is not initialized. Call agnost.init() first.');\n\ninteraction.setProperty('temperature', '0.7');\n\n// ... do async work ...\n\ninteraction.end('The weather is sunny.');\n// Latency automatically calculated! (~duration from begin to end)\n```\n\n**Alternative: Set input later:**\n```typescript\nconst interaction = agnost.begin({\n  userId: 'user_123',\n  agentName: 'weather-agent'\n});\nif (!interaction) throw new Error('Agnost is not initialized. Call agnost.init() first.');\ninteraction.setInput('What is the weather?');\ninteraction.end('The weather is sunny.');\n```\n\n**Manual latency override (optional):**\n```typescript\ninteraction.end(\n  'The weather is sunny.',\n  true,   // success\n  1500    // Override auto-calculation if needed\n);\n```\n\n**BeginOptions:**\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `userId` | `string` | Yes | User identifier |\n| `agentName` | `string` | Yes | Agent name |\n| `input` | `string` | No | Input text/prompt (can be set later) |\n| `conversationId` | `string` | No | Conversation ID for grouping (auto-generated if not provided) |\n| `properties` | `object` | No | Additional event properties |\n| `event` | `string` | No | Optional event name |\n| `interactionId` | `string` | No | Custom interaction ID (auto-generated if not provided). Useful for retrieving the interaction later with `getInteraction()` |\n\n**Interaction Methods:**\n\n| Method | Description |\n|--------|-------------|\n| `setInput(text)` | Set the input text (optional if passed to `begin()`) |\n| `setProperties(obj)` | Set multiple properties |\n| `setProperty(key, value)` | Set a single property |\n| `end(output, success?, latency?)` | Complete the interaction. **When `success=false`, `output` is the error message.** Latency is auto-calculated if not provided |\n\n### `getInteraction(interactionId)`\n\nRetrieve an active interaction by its ID. Useful when you need to complete an interaction from a different context (e.g., callback, different function) without passing the Interaction object around.\n\n```typescript\n// In your request handler\nfunction handleRequest(requestId: string, userMessage: string) {\n  agnost.begin({\n    userId: 'user_123',\n    agentName: 'chat-agent',\n    input: userMessage,\n    interactionId: requestId  // Use your own ID\n  });\n\n  // Pass only the ID to your AI service\n  callAIService(requestId, userMessage);\n}\n\n// Later, in a callback or different function\nfunction onAIResponse(requestId: string, response: string) {\n  const interaction = agnost.getInteraction(requestId);\n  if (interaction) {\n    interaction\n      .setProperty('model', 'gpt-4')\n      .setProperty('tokens', 250)\n      .end(response);\n  }\n}\n```\n\nReturns `null` if the interaction is not found or has already been completed.\n\n### `flush()`\n\nManually flush all queued events.\n\n```typescript\nawait agnost.flush();\n```\n\n### `shutdown()`\n\nShutdown the SDK and flush remaining events, including conversations whose\n`capture-session` request is still in flight.\n\n```typescript\nawait agnost.shutdown();\n```\n\nIn Node.js, `init()` also registers `beforeExit`, `SIGINT` and `SIGTERM`\nhandlers that call `shutdown()`; the signal handlers then call\n`process.exit(0)`. `shutdown()` removes them. If your app handles those\nsignals itself, call `await agnost.shutdown()` from your handler.\n\n### `setDebugLogs(enabled)`\n\nEnable or disable debug logging.\n\n```typescript\nagnost.setDebugLogs(true);  // See queued events\n```\n\n## Configuration\n\nYou can customize the SDK behavior using the configuration object:\n\n```typescript\nimport * as agnost from 'agnostai';\nimport { ConversationConfig } from 'agnostai';\n\n// Create a custom configuration\nconst config: ConversationConfig = {\n  endpoint: 'https://api.agnost.ai',\n  debug: false\n};\n\n// Apply the configuration\nagnost.init('your-project-id', config);\n```\n\n### Configuration Options\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `endpoint` | `string` | `\"https://api.agnost.ai\"` | API endpoint URL |\n| `debug` | `boolean` | `false` | Enable debug logging |\n\n## Advanced Usage\n\n### Conversation Tracking\n\nGroup related events using `conversationId`:\n\n```typescript\nconst conversationId = `conv_${crypto.randomUUID()}`;\n\n// First message\nconst turn1 = agnost.begin({\n  userId: 'user_123',\n  agentName: 'support-bot',\n  input: 'Hello!',\n  conversationId\n});\nif (!turn1) throw new Error('Agnost is not initialized. Call agnost.init() first.');\nturn1.end('Hi there! How can I help?');\n\n// Follow-up message\nconst turn2 = agnost.begin({\n  userId: 'user_123',\n  agentName: 'support-bot',\n  input: \"What's the weather?\",\n  conversationId\n});\nif (!turn2) throw new Error('Agnost is not initialized. Call agnost.init() first.');\nturn2.end('The weather is sunny.');\n```\n\n### Direct Client Instantiation\n\nFor multiple clients or advanced use cases:\n\n```typescript\nimport { ConversationClient } from 'agnostai';\n\nconst client = new ConversationClient();\nclient.init('your-project-id');\n\nconst interaction = client.begin({\n  userId: 'user_123',\n  agentName: 'greeting-bot',\n  input: 'Hello!'\n});\nif (!interaction) throw new Error('Agnost is not initialized. Call client.init() first.');\n\ninteraction.end('Hello! How can I help you today?');\n\nawait client.shutdown();\n```\n\n### Error Handling\n\nWhen tracking errors, set `success=false` and pass the error message as the `output`:\n\n```typescript\n// With begin() and end()\nconst interaction = agnost.begin({\n  userId: 'user_123',\n  agentName: 'image-agent',\n  input: 'Generate an image'\n});\nif (!interaction) throw new Error('Agnost is not initialized. Call agnost.init() first.');\n\ntry {\n  const result = await generateImage();\n  interaction.end(result);\n} catch (error) {\n  // Error message goes in output when success=false\n  interaction.end(error.message, false);\n}\n```\n\n### Chainable Property Setting\n\n```typescript\nconst interaction = agnost.begin({\n  userId: 'user_123',\n  agentName: 'chat-agent',\n  input: 'Tell me a story'\n});\nif (!interaction) throw new Error('Agnost is not initialized. Call agnost.init() first.');\n\n// Chain multiple property setters\ninteraction\n  .setProperty('model', 'gpt-4')\n  .setProperty('temperature', '0.9')\n  .setProperty('max_tokens', '2000')\n  .setProperties({\n    genre: 'fantasy',\n    length: 'short'\n  });\n\n// ... generate story ...\n\ninteraction.end('Once upon a time...');\n```\n\n### Deferred Input Setting\n\nSometimes you might not know the input until after beginning the interaction:\n\n```typescript\nconst interaction = agnost.begin({\n  userId: 'user_123',\n  agentName: 'dynamic-agent'\n});\nif (!interaction) throw new Error('Agnost is not initialized. Call agnost.init() first.');\n\n// Collect user input later\nconst userInput = await getUserInput();\ninteraction.setInput(userInput);\n\n// Process and complete\nconst response = await processInput(userInput);\ninteraction.end(response);\n```\n\n## TypeScript Support\n\nThis SDK is written in TypeScript and provides full type definitions:\n\n```typescript\nimport * as agnost from 'agnostai';\nimport {\n  ConversationClient,\n  ConversationConfig,\n  BeginOptions,\n  Interaction,\n  UserTraits,\n  EventProperties\n} from 'agnostai';\n\n// All types are available for use\nconst options: BeginOptions = {\n  userId: 'user_123',\n  agentName: 'my-agent',\n  input: 'Hello'\n};\n\nconst traits: UserTraits = {\n  name: 'John',\n  email: 'john@example.com'\n};\n\nconst config: ConversationConfig = {\n  endpoint: 'https://api.agnost.ai',\n  debug: true\n};\n```\n\n## Runtime Support\n\nThe SDK uses the native `fetch` and Web Crypto APIs, available in Node.js 20+\nand all modern browsers.\n\n## Examples\n\n[`examples/`](./examples) has a quickstart, an interactive chatbot and a\ndashboard seeder. Every release runs them against the packed tarball:\n\n```bash\ncd examples && npm install && npm run build\nAGNOST_PROJECT_ID=<your-project-id> npm run quickstart\n```\n\n## Contact\n\nFor support or questions, contact the founders: [founders@agnost.ai](mailto:founders@agnost.ai)\n\n## License\n\nMIT\n","readmeFilename":"README.md"}