Amico V2 is a platform-agnostic runtime for AI agents built in Rust. As a framework, it provides a platform for developers to develop their business logic - just like web frameworks like Axum or Rocket.
For detailed architecture design, see ARCHITECTURE.md.
Amico V2 is a complete redesign from the ground up, incorporating modern AI agent framework patterns and best practices:
- Platform-Agnostic Runtime: Run on any platform - OS, browsers, mobile, embedded devices
- Model Abstraction Layer: Provider-agnostic model interface inspired by Vercel's AI SDK
- Workflow Runtime: Support for both long-lived and short-lived runtimes
- Zero-Cost Abstractions: Uses traits and generics instead of dynamic dispatch
- Type-Safe: Extensive compile-time verification
- Event-Driven Architecture: Framework-like event handler interface
Amico V2 consists of four layers:
βββββββββββββββββββββββββββββββββββββββββββ
β Application / Event Handlers β β Your business logic
βββββββββββββββββββββββββββββββββββββββββββ€
β Workflows Layer (Presets) β β Tool loop agents, ReAct, etc.
βββββββββββββββββββββββββββββββββββββββββββ€
β Runtime Layer β β Workflow execution
βββββββββββββββββββββββββββββββββββββββββββ€
β Models Layer β β Model abstractions
βββββββββββββββββββββββββββββββββββββββββββ€
β System Layer β β Tools, side-effects, I/O
βββββββββββββββββββββββββββββββββββββββββββ
- Models Layer (
amico-models): Abstracts AI models by capability (language, image, video, speech, embedding) - System Layer (
amico-system): Defines how agents interact with the world through tools and side-effects - Runtime Layer (
amico-runtime): Executes workflows on different runtime types (long-lived or short-lived) - Workflows Layer (
amico-workflows): Preset workflow patterns (tool loops, ReAct, chain-of-thought, etc.)
- Traits + Generics over Boxing: Always use traits and generics for abstractions, avoid dynamic dispatch
- Compile-time Safety: Extensive use of types to catch errors early
- Zero-cost Abstractions: No runtime overhead from abstraction layers
- Lifetime-aware: Explicit lifetime management instead of
BoxorArc - Async-native: All async operations use
impl Future, notPin<Box<dyn Future>>
amico: The main entry crate that ties everything togetheramico-models: Model abstractions categorized by capabilityamico-system: System layer for tools and side-effectsamico-runtime: Runtime layer for executing workflowsamico-workflows: Preset workflow patterns
use amico::{
EventHandler, EventRouter,
runtime::Runtime,
workflows::ToolLoopAgent,
};
// Define your event handler
struct MyAgentHandler {
agent: ToolLoopAgent<MyModel, MyTools, MyContext>,
}
impl EventHandler<MessageEvent> for MyAgentHandler {
type Context = AgentContext;
type Response = MessageResponse;
type Error = HandlerError;
async fn handle(&self, event: MessageEvent, context: &Self::Context)
-> Result<Self::Response, Self::Error>
{
let response = self.agent
.execute(context, event.content)
.await?;
Ok(MessageResponse::from(response))
}
}
// Create runtime and register handlers
async fn main() {
let runtime = create_runtime();
let mut router = EventRouter::new();
// Register event handlers
router.register("message", MyAgentHandler::new());
router.register("timer", TimerHandler::new());
// Start runtime
runtime.start().await.unwrap();
}V1 is completely deprecated and not compatible with V2.
V2 is a total rewrite that keeps some good concepts from V1 (event-based architecture, platform-agnostic design) while:
- Removing all dynamic dispatch in favor of static generics
- Clarifying separation between models, runtime, system, and workflows
- Providing clearer abstractions inspired by modern frameworks like Vercel's AI SDK
- Focusing on compile-time safety and zero-cost abstractions
V2 is currently in design phase. The architecture and traits are defined, but implementations are placeholders. We're building the conceptual framework first before implementing functionality.
Amico is released under the MIT License OR the Apache-2.0 License.
All images under images/ are licensed under a
Creative Commons Attribution 4.0 International License.
See LICENSE-CC-BY
Contributions are welcome! Please read our contributing guidelines before submitting a pull request.
