{"id":28514106,"url":"https://github.com/voltagent/vercel-ai-sdk-observability","last_synced_at":"2025-07-04T11:31:46.688Z","repository":{"id":296502753,"uuid":"993437537","full_name":"VoltAgent/vercel-ai-sdk-observability","owner":"VoltAgent","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-03T00:14:40.000Z","size":49,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-03T14:06:17.010Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VoltAgent.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-30T19:40:18.000Z","updated_at":"2025-06-04T02:47:48.000Z","dependencies_parsed_at":"2025-05-31T17:40:42.971Z","dependency_job_id":"11a21bde-94ed-4dfd-b51d-cf6b8b3700c7","html_url":"https://github.com/VoltAgent/vercel-ai-sdk-observability","commit_stats":null,"previous_names":["voltagent/vercel-ai-sdk-observability"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/VoltAgent/vercel-ai-sdk-observability","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VoltAgent%2Fvercel-ai-sdk-observability","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VoltAgent%2Fvercel-ai-sdk-observability/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VoltAgent%2Fvercel-ai-sdk-observability/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VoltAgent%2Fvercel-ai-sdk-observability/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VoltAgent","download_url":"https://codeload.github.com/VoltAgent/vercel-ai-sdk-observability/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VoltAgent%2Fvercel-ai-sdk-observability/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263501695,"owners_count":23476472,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-09T01:35:24.697Z","updated_at":"2025-07-04T11:31:46.460Z","avatar_url":"https://github.com/VoltAgent.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VoltAgent LLM Observability Platform + Vercel AI SDK Integration Example\n\nThis example demonstrates how to add **VoltAgent observability** to your existing Vercel AI applications with minimal code changes. Track AI calls, tool usage, and multi-agent workflows in the VoltAgent Developer Console.\n\n![VoltAgent Vercel AI SDK Integration](https://cdn.voltagent.dev/docs/vercel-ai-observability-demo/vercel-ai-demo-with-multi-agent.gif)\n\n## Quick Start\n\n```bash\ngit clone https://github.com/VoltAgent/vercel-ai-sdk-observability\ncd vercel-ai-sdk-observability\nnpm install\n```\n\n### Environment Setup\n\n**Get your VoltAgent API Keys:**\n- Sign up at [https://console.voltagent.dev/](https://console.voltagent.dev/)\n- Create an organization and project\n- Copy your `VOLTAGENT_PUBLIC_KEY` and `VOLTAGENT_SECRET_KEY`\n\n**Get your OpenAI API Key:**\n- Visit [OpenAI Platform](https://platform.openai.com/api-keys)\n- Create a new API key\n\nCreate a `.env` file and add your API keys:\n\n```bash\n# Create .env file\ncp .env.example .env\n```\n\nThen add your keys to the `.env` file:\n\n```env\n# OpenAI API Key\nOPENAI_API_KEY=your_openai_api_key_here\n\n# VoltAgent Keys\nVOLTAGENT_PUBLIC_KEY=your_voltagent_public_key_here\nVOLTAGENT_SECRET_KEY=your_voltagent_secret_key_here\n```\n\n### Run the Demo\n\n```bash\nnpm run dev\n```\n\n## Interactive Learning Demo\n\nWhen you run `npm run dev`, you'll see an interactive menu:\n\n```\n🎬 VoltAgent Progressive Learning Demo\nLearn how to integrate VoltAgent observability step-by-step\n\n🚀 VoltAgent + Vercel AI SDK Progressive Examples\nLearn step-by-step how to add observability:\n\n1. Basic Telemetry (minimal setup)\n2. With Tools (see tool tracking)\n3. With Metadata (agent identification)\n4. More Metadata (user tracking \u0026 tags)\n5. Multi-Agent (parent-child relationships)\n6. Run All Examples\n9. Exit\n\nWhich example would you like to run? (1-6, 9):\n```\n\nEach example builds on the previous one, showing you how to progressively enhance your AI applications with VoltAgent observability.\n\n## What You'll Learn\n\nThis example shows the **progressive enhancement** approach to adding observability:\n\n### 1. **Basic Telemetry** - Just enable tracking\n```typescript\nconst result = await generateText({\n  model: openai(\"gpt-4o-mini\"),\n  prompt: \"Hello, how are you?\",\n  experimental_telemetry: {\n    isEnabled: true, // That's it!\n  },\n});\n```\n\n![Basic Telemetry Example](https://cdn.voltagent.dev/docs/vercel-ai-observability-demo/vercel-ai-demo-basic.gif)\n\n### 2. **With Tools** - Track tool usage automatically\n```typescript\nconst result = await generateText({\n  model: openai(\"gpt-4o-mini\"),\n  prompt: \"What's the weather like in Tokyo?\",\n  tools: {\n    weather: {\n      description: \"Get the weather in a location\",\n      parameters: z.object({\n        location: z.string().describe(\"The location to get the weather for\"),\n      }),\n      execute: async ({ location }) =\u003e {\n        // Your tool logic here\n        return { location, temperature: 22 };\n      },\n    },\n  },\n  experimental_telemetry: {\n    isEnabled: true, // Tools tracked automatically\n  },\n});\n```\n\n![Tools Example](https://cdn.voltagent.dev/docs/vercel-ai-observability-demo/vercel-ai-demo-with-tools.gif)\n\n### 3. **With Agent Identity** - Better organization\n```typescript\nconst result = await generateText({\n  model: openai(\"gpt-4o-mini\"),\n  prompt: \"What's the weather like in Paris?\",\n  tools: { /* ... */ },\n  experimental_telemetry: {\n    isEnabled: true,\n    metadata: {\n      agentId: \"weather-assistant\", // ✨ Named agent\n      instructions: \"You are a helpful weather assistant\",\n    },\n  },\n});\n```\n\n![Agent Identity Example](https://cdn.voltagent.dev/docs/vercel-ai-observability-demo/vercel-ai-demo-with-agentid.gif)\n\n### 4. **Full Metadata** - Production-ready tracking\n```typescript\nconst result = await generateText({\n  model: openai(\"gpt-4o-mini\"),\n  prompt: \"What's the weather like in Berlin?\",\n  tools: { /* ... */ },\n  experimental_telemetry: {\n    isEnabled: true,\n    metadata: {\n      agentId: \"weather-assistant\",\n      instructions: \"You are a helpful weather assistant\",\n      userId: \"demo-user\",           // 🔍 User tracking\n      conversationId: \"weather-chat\", // 💬 Conversation grouping\n      tags: [\"weather\", \"demo\", \"production\"], // 🏷️ Categories\n    },\n  },\n});\n```\n\n![Full Metadata Example](https://cdn.voltagent.dev/docs/vercel-ai-observability-demo/vercel-ai-demo-with-metadata.gif)\n\n### 5. **Multi-Agent** - Complex workflows\n```typescript\n// Parent Agent\nconst { text: plan } = await generateText({\n  model: openai(\"gpt-4o-mini\"),\n  prompt: \"Create a plan for organizing a team meeting\",\n  experimental_telemetry: {\n    isEnabled: true,\n    metadata: {\n      agentId: \"planning-agent\",\n      userId: \"team-lead\",\n      conversationId: \"meeting-organization\",\n    },\n  },\n});\n\n// Child Agent\nconst { text: execution } = await generateText({\n  model: openai(\"gpt-4o-mini\"),\n  prompt: `Execute this plan: ${plan}`,\n  experimental_telemetry: {\n    isEnabled: true,\n    metadata: {\n      agentId: \"execution-agent\",\n      parentAgentId: \"planning-agent\", // 🔗 Parent relationship\n      userId: \"team-lead\",\n      conversationId: \"meeting-organization\",\n    },\n  },\n});\n```\n\n![Multi-Agent Example](https://cdn.voltagent.dev/docs/vercel-ai-observability-demo/vercel-ai-demo-with-multi-agent.gif)\n\n## Setup\n\n1. **Get VoltAgent API Keys**:\n   - Sign up at [console.voltagent.dev](https://console.voltagent.dev)\n   - Create an organization and project\n   - Copy your `VOLTAGENT_PUBLIC_KEY` and `VOLTAGENT_SECRET_KEY`\n\n2. **Set Environment Variables**:\n   ```bash\n   cp .env.example .env.local\n   # Add your keys to .env.local\n   ```\n\n3. **Install and Run**:\n   ```bash\n   npm install\n   npm run dev\n   ```\n\n## What You Get\n\n- 🎯 **AI Call Tracking**: Every Vercel AI SDK call tracked automatically\n- 🔧 **Tool Usage Visibility**: See tool calls, inputs, outputs, and execution time\n- 👤 **User Analytics**: Track AI usage by user and conversation\n- 🔗 **Multi-Agent Support**: Parent-child relationships and event propagation\n- 📊 **Rich Metadata**: Custom tags, instructions, and business context\n- 📈 **Performance Insights**: Execution times, token usage, and costs\n- 🐛 **Debugging**: Detailed traces for troubleshooting AI workflows\n\n## Key Benefits\n\n### ✅ Minimal Code Changes\n```diff\n  const result = await generateText({\n    model: openai(\"gpt-4o-mini\"),\n    prompt: \"Hello world\",\n+   experimental_telemetry: { isEnabled: true }\n  });\n```\n\n### ✅ Progressive Enhancement\nStart with basic tracking, add more metadata as needed:\n- `isEnabled: true` → Basic tracking\n- `+ agentId` → Agent identification  \n- `+ userId` → User analytics\n- `+ conversationId` → Conversation grouping\n- `+ parentAgentId` → Multi-agent workflows\n\n### ✅ Production Ready\nAll examples include production best practices:\n- Error handling\n- Environment variables\n- Graceful shutdown\n- Performance optimization\n\n## Full Documentation\n\n📚 **[Complete Vercel AI SDK Integration Guide](https://voltagent.dev/docs-observability/vercel-ai/)**\n\nThe full documentation includes:\n- Detailed setup instructions\n- Complete metadata reference\n- Best practices for production\n- Error handling patterns\n- Advanced multi-agent examples\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoltagent%2Fvercel-ai-sdk-observability","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoltagent%2Fvercel-ai-sdk-observability","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoltagent%2Fvercel-ai-sdk-observability/lists"}