aidale-plugin
Built-in plugins for Aidale (tool use, RAG, etc.).
Overview
aidale-plugin provides runtime extensions through lifecycle hooks:
- ToolUsePlugin: Function calling and tool execution
- More plugins coming soon (RAG, memory, guardrails, etc.)
Available Plugins
ToolUsePlugin
Enables AI to call external functions/tools:
use ;
use Arc;
// Define a tool
async
// Register tools
let mut tools = new;
tools.register;
// Add plugin to executor
let executor = builder
.plugin
.finish;
The plugin automatically:
- Injects tool definitions into requests
- Detects tool calls in responses
- Executes tools and continues conversation
- Handles errors gracefully
Plugin System
Plugins use lifecycle hooks to extend runtime behavior:
Tool Registry
Flexible tool registration system:
use ToolRegistry;
let mut registry = new;
// Register function
registry.register;
// Get tool
if let Some = registry.get
Usage
Via the main aidale crate:
[]
= { = "0.1", = ["plugins"] }
Directly:
[]
= "0.1"
= "0.1"
Examples
Complete Tool Use Example
use *;
use ;
use Arc;
async
Custom Plugins
Implement the Plugin trait:
use ;
use async_trait;
Planned Plugins
- RAGPlugin: Retrieval-Augmented Generation
- MemoryPlugin: Conversation memory management
- GuardrailsPlugin: Safety and content filtering
- CachePlugin: Semantic caching
- MetricsPlugin: Usage tracking and analytics
Plugin vs Layer
When to use Plugins:
- Business logic (tools, RAG, memory)
- Runtime behavior modification
- Multi-turn conversation handling
When to use Layers:
- Infrastructure concerns (logging, retry, caching)
- Request/response transformation
- Error handling patterns
Related Crates
aidale-core- Core traits and runtimeaidale-provider- Provider implementationsaidale-layer- Middleware layers
License
MIT OR Apache-2.0