Package Installation
PromptSmith is distributed as an npm package and works with both Vercel AI SDK and Mastra. Choose the installation method that fits your project.For Vercel AI SDK
If you’re using Vercel AI SDK for your AI agents, install these packages:promptsmith-ts- The core PromptSmith libraryzod- Schema validation and type inference for toolsai- Vercel AI SDK for LLM integration
For Mastra
If you’re using Mastra for your AI agents, install these packages:promptsmith-ts- The core PromptSmith libraryzod- Schema validation and type inference for tools@mastra/core- Mastra agent framework
For Both Frameworks
If you want to use PromptSmith with both Vercel AI SDK and Mastra in the same project:PromptSmith works seamlessly with both frameworks in the same project, giving you maximum flexibility.
Model Provider Setup
You’ll also need to install a model provider SDK. PromptSmith works with any provider supported by Vercel AI SDK or Mastra.Popular Providers
- OpenAI
- Anthropic
- Google
- Mistral
Requirements
Make sure your environment meets these minimum requirements:Node.js Version
Node.js >= 18.0.0 is required. PromptSmith uses modern JavaScript features that require Node 18 or higher.Check your Node version:
TypeScript (Optional)
TypeScript >= 5.0.0 is recommended but not required. PromptSmith provides full type definitions for the best development experience.If using TypeScript, install it:
TypeScript Configuration
For the best TypeScript experience, configure yourtsconfig.json:
tsconfig.json
PromptSmith is written in TypeScript and provides full type definitions out of the box. No additional
@types packages needed!Environment Variables
Set up your API keys for the model providers you’re using:.env
Verify Installation
Create a simple test file to verify everything is working:test.ts
Module Exports
PromptSmith provides three main export paths:Builder Module
Tester Module
Templates Module
Troubleshooting
Module not found: Can't resolve 'promptsmith-ts'
Module not found: Can't resolve 'promptsmith-ts'
Make sure you’ve installed the package:If using a monorepo, ensure the package is installed in the correct workspace.
TypeError: Cannot read property 'ZodType' of undefined
TypeError: Cannot read property 'ZodType' of undefined
Install Zod as a peer dependency:Zod is required for tool schema validation.
SyntaxError: Cannot use import statement outside a module
SyntaxError: Cannot use import statement outside a module
PromptSmith uses ESM. Add to your Or use
package.json:.mjs file extensions.TypeScript errors about missing types
TypeScript errors about missing types
Make sure you’re using TypeScript 5.0 or higher:PromptSmith includes its own type definitions, no
@types package needed.Next Steps
Now that you have PromptSmith installed, you’re ready to build your first agent!Quick Start Guide
Build your first agent in 5 minutes
API Reference
Explore the complete API documentation
Examples
Learn from real-world examples
Templates
Use pre-built templates for common use cases