Funera
An LLM agent framework for Rust. Build AI agents with tools, skills, middleware, and pluggable LLM backends — all with multi-layered security and flexible pipeline.
WARNING: This crate is still under development, the documentation may be incomplete or wrong. And the API may change. WARNING: The security features are still under development and testing, and cannot be trusted to be secure.
Architecture
┌─────────────────────────────────────────────────────┐
│ funera-orchestrate high-level builder API │
│ Agent · AgentRuntime · callbacks · streaming │
├─────────────────────────────────────────────────────┤
│ funera_core core engine │
│ ReActLoop · Session · EventBus · Middleware │
│ Security · Provider · Tools · Skills │
├─────────────────────────────────────────────────────┤
│ builtin_tools default tool implementations │
│ ReadTool · WriteTool · EditTool · ShellTool │
└─────────────────────────────────────────────────────┘
Features
- ReAct loop — iterative tool-calling agent execution with configurable max iterations
- Pluggable providers — OpenAI and DeepSeek backends with streaming support
- Tool system — define custom tools by implementing the
Tooltrait; built-in file I/O and shell - Skill system — load prompt templates from YAML-frontmatter Markdown files
- Middleware pipeline — intercept agent events with inspectors (read-only, parallel) and mutators (pass/modify/block, sequential)
- Security layer — tool/shell policies, path allowlisting, audit logging, secure API key storage
- Type-state session — compile-time enforcement of session ownership (
Idle/Acquired)
Installation
Add the root crate to your Cargo.toml:
[]
= { = "https://github.com/dynamder/funera" }
Features
| Feature | Default | Description |
|---|---|---|
builtin-tools |
❌ | Bundled Read, Write, Edit, Shell tools |
tool |
✅ | Tool system (trait, registry, executor) |
deepseek |
✅ | DeepSeek provider |
openai |
❌ | OpenAI provider |
security |
❌ | Tool policy enforcement, path guards, audit logging |
sandbox |
❌ | Kernel-level subprocess isolation (Landlock/Seatbelt/Token) |
middleware |
❌ | Event interception pipeline |
skill |
❌ | Skill loading and prompt injection |
Quick Start
One-shot query
use ;
async
Streaming with callbacks
use ;
async
Multi-turn conversation
let runtime = builder
.api_key
.model
.build?;
let agent = builder
.system_prompt
.build;
let handle = agent.send.await?;
let = handle.await?;
let handle = agent.send.await?;
let = handle.await?;
Custom tool
use async_trait;
use ;
use ;
;
// Register it:
let runtime = builder
.api_key
.model
.with_tool_instance
.build?;
Security configuration
Requires the security feature (and optionally builtin-tools, sandbox):
use ;
async
Project structure
funera/
├── funera_core/ Core agent engine
│ └── src/
│ ├── chat/ Message types, session actor
│ ├── env.rs Shared runtime environment
│ ├── event_bus/ Token, React, EnvState, Tool buses
│ ├── middleware.rs Event interception pipeline
│ ├── provider/ OpenAI & DeepSeek backends
│ ├── re_act/ ReAct loop, Tool trait, Skill system
│ └── security/ Policies, path guard, audit, secrets
├── funera-orchestrate/ High-level builder API
│ ├── src/
│ │ ├── agent.rs Agent & AgentBuilder
│ │ ├── runtime.rs AgentRuntime & AgentRuntimeBuilder
│ │ ├── event.rs AgentEvent enum
│ │ ├── dispatcher.rs Callback dispatch
│ │ └── send_handle.rs Ownership handles
│ └── examples/ Example programs
├── builtin_tools/ Default tool implementations
│ └── src/
│ ├── read.rs ReadTool (file/dir, hashline output)
│ ├── write.rs WriteTool (auto parent dirs)
│ ├── edit.rs EditTool (hashline-anchored editing)
│ └── shell.rs ShellTool (cross-platform, timeout)
License
MIT — see the repository for details.