Custom Plugins
Create and register custom plugins with tools for agents. Learn the setup patterns, APIs, and practical examples needed to build reliable Astreus agent systems.
Create and register custom plugins with tools for agents.
Quick Start
Clone the Complete Example
The easiest way to get started is to clone the complete example repository:
git clone https://github.com/astreus-ai/examples
cd examples/custom-plugins
npm installOr Install Package Only
If you prefer to build from scratch:
npm install @astreus-ai/astreusEnvironment Setup
# .env
OPENAI_API_KEY=sk-your-openai-api-key-here
DB_URL=sqlite://./astreus.dbCustom Weather Plugin
import { Agent, ToolDefinition, PluginDefinition } from '@astreus-ai/astreus';
// Define a custom tool
const weatherTool: ToolDefinition = {
name: 'get_weather',
description: 'Get current weather for a location',
parameters: {
location: {
name: 'location',
type: 'string',
description: 'City name',
required: true
},
units: {
name: 'units',
type: 'string',
description: 'Temperature units (celsius or fahrenheit)',
required: false,
enum: ['celsius', 'fahrenheit']
}
},
handler: async (params) => {
// Simulate weather API call
const weather = {
temperature: 22,
conditions: 'sunny',
location: params.location as string
};
return {
success: true,
data: weather
};
}
};
// Create plugin
const weatherPlugin: PluginDefinition = {
name: 'weather-plugin',
version: '1.0.0',
description: 'Weather information tools',
tools: [weatherTool]
};
// Create agent and register plugin
const agent = await Agent.create({
name: 'WeatherAgent',
model: 'gpt-4o'
});
await agent.registerPlugin(weatherPlugin);
// Use the plugin in conversation
const response = await agent.ask("What's the weather like in Tokyo?");
console.log(response); // Agent automatically uses the weather toolRunning the Example
If you cloned the repository:
npm run devIf you built from scratch, create an index.ts file with the code above and run:
npx tsx index.tsRepository
The complete example is available on GitHub: examples/custom-plugins
Last updated: June 7, 2026
In this section
Your First Agent
Create your first AI agent with Astreus framework. Learn the setup patterns, APIs, and practical examples needed to build reliable Astreus agent systems.
Agent with Memory
Build agents with persistent memory capabilities. Learn the setup patterns, APIs, and practical examples needed to build reliable Astreus agent systems.
Agent with Knowledge
Create agents with knowledge base capabilities for enhanced information retrieval. Learn the setup patterns, APIs, and practical examples needed to build...
Agent with Vision
Create agents capable of processing and analyzing images. Learn the setup patterns, APIs, and practical examples needed to build reliable Astreus agent systems.