ai-agents-sdk
v1.2.7
Published
Easy way to define and use your AI agents through multiple providers
Readme
AI Agents SDK
A simple and effective solution to define and use your AI agents across multiple providers.
📋 Description
AI Agents SDK is a library that simplifies the integration and usage of AI agents across different providers. It offers a unified interface to work with AI models from various platforms.
🚀 Installation
npm install ai-agents-sdk🔧 Configuration
- Create a
.envfile at the root of your project. - Add your API keys:
OPENAI_API_KEY=your_openai_api_key
ANTHROPIC_API_KEY=your_anthropic_api_key💻 Usage
import { Agent } from 'ai-agents-sdk';
// Create a new agent
const agent = new Agent({
name: 'agentName',
provider: 'openai', // or 'anthropic'
model: 'gpt-4', // or any other supported model
// rules, can also be " system: '' "
system: loadFile('./prompts/articleGenerator.txt'),
// Output typing for #.generateObject()
output: z.object({
title: z.string(),
content: z.string()
}),
});
// Use the agent
const response = await agent.chat('Hello, how can I help you?');🛠️ Dependencies
- @ai-sdk/anthropic
- @ai-sdk/openai
- ai
- dotenv
- openai
- zod
🏗️ Development
# Install dependencies
npm install
# Development
npm run dev
# Build
npm run build📝 Available Scripts
npm run build- Compiles the TypeScript projectnpm run dev- Launches development mode with hot-reloadnpm run prepare- Prepares the package for publishingnpm run prepublishOnly- Runs the build before publishing
🤝 Contribution
Contributions are welcome! Feel free to:
- Fork the project
- Create a branch for your feature
- Commit your changes
- Push to the branch
- Open a Pull Request
📄 License
ISC
📞 Support
For any questions or issues, please contact me at me[at]matteow[dot]pro
