Installation¶
This guide covers different methods to install @arcaelas/agent in your project.
Package Managers¶
NPM¶
Yarn¶
PNPM¶
Bun¶
Requirements¶
Ensure your environment meets these minimum requirements:
- Node.js ≥ 16.0.0
- TypeScript ≥ 4.5.0 (for TypeScript projects)
- Modern Browser (ES2020+ support for browser usage)
Environment Setup¶
API Keys¶
Create a .env file in your project root:
# OpenAI (Primary provider)
OPENAI_API_KEY=your_openai_api_key
# Anthropic Claude (Optional backup)
ANTHROPIC_API_KEY=your_anthropic_api_key
# Groq (Optional backup)
GROQ_API_KEY=your_groq_api_key
TypeScript Configuration¶
Ensure your tsconfig.json includes:
{
"compilerOptions": {
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "node",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true
}
}
Browser Usage¶
ES Modules¶
<script type="module">
import { Agent, Tool } from 'https://cdn.skypack.dev/@arcaelas/agent';
// Your code here
</script>
UMD (Global)¶
<script src="https://unpkg.com/@arcaelas/agent/dist/index.umd.js"></script>
<script>
const { Agent, Tool } = ArcaelasAgent;
// Your code here
</script>
Verification¶
Test your installation with this simple example:
import { Agent } from '@arcaelas/agent';
import OpenAI from 'openai';
// Create a test agent
const agent = new Agent({
name: "Test_Agent",
description: "Verification agent",
providers: [
async (ctx) => {
const openai = new OpenAI({
baseURL: "https://api.openai.com/v1",
apiKey: process.env.OPENAI_API_KEY
});
return await openai.chat.completions.create({
model: "gpt-3.5-turbo",
messages: ctx.messages.map(m => ({
role: m.role,
content: m.content
}))
});
}
]
});
// Test the agent
console.log("Testing agent...");
const [conversation, success] = await agent.call("Say hello");
if (success) {
console.log("✅ Installation successful!");
console.log("Response:", conversation[conversation.length - 1].content);
} else {
console.log("❌ Installation failed. Check your API key.");
}
Expected Output:
Next Steps¶
- Getting Started Guide - Build your first agent
- Core Concepts - Understand the architecture
- Examples - See practical implementations
Troubleshooting¶
Module Not Found¶
If you get "Module not found" errors:
TypeScript Errors¶
If TypeScript shows errors:
- Ensure TypeScript version ≥ 4.5.0
- Check
tsconfig.jsonconfiguration - Run
npm install --save-dev @types/node
API Key Issues¶
If your agent fails to connect:
- Verify API key in
.envfile - Check key format (should start with
sk-) - Ensure
.envis loaded (usedotenvpackage)
Support¶
Need help? Check these resources: