hehe
A modular AI Agent framework in Rust.
Features
- Multi-modal Messages: Text, image, audio, video, file support
- Tool System: 7 built-in tools + extensible
- Storage Abstraction: SQLite, memory cache, vector store, FTS5
- Streaming: SSE + AgentEvent
- Session Management: Persistent conversation state
- Safety: Dangerous operation marking + sandbox
Installation
Or add to your project:
[]
= { = "crates/hehe-agent" }
= { = "crates/hehe-llm" }
= { = "crates/hehe-tools" }
Quick Start
CLI Usage
# Set API key
# Interactive chat
# Single message
# Start HTTP server
# With options
Library Usage
use Agent;
use OpenAiProvider;
use create_default_registry;
use Arc;
async
Architecture
hehe/
├── hehe-core # Base types, messages, events
├── hehe-store # SQLite, cache, vector, FTS5
├── hehe-llm # LLM providers (OpenAI)
├── hehe-tools # Tool system, built-in tools
├── hehe-agent # Agent runtime, ReAct loop
├── hehe-server # HTTP/SSE API
└── hehe-cli # Command-line interface
Dependency Graph
hehe-cli
│
┌────────────┼────────────┐
▼ ▼ ▼
hehe-server hehe-agent (direct)
│ │
└─────┬──────┘
▼
┌───────┼───────┐
▼ ▼ ▼
hehe-llm hehe-tools hehe-store
└───────┼───────┘
▼
hehe-core
Built-in Tools
| Tool | Description | Dangerous |
|---|---|---|
read_file |
Read file contents | No |
write_file |
Write to file | Yes |
list_directory |
List directory (recursive) | No |
search_files |
Glob pattern search | No |
execute_shell |
Execute shell command | Yes |
http_request |
HTTP requests | No |
get_system_info |
System information | No |
HTTP API
Endpoints
GET /health Health check
GET /ready Ready check
POST /api/v1/chat Sync chat
POST /api/v1/chat/stream SSE streaming chat
Example
# Sync chat
# Streaming chat
Examples
See the examples/ directory for more usage examples:
basic_chat.rs- Basic chat examplewith_tools.rs- Using toolshttp_server.rs- HTTP server setupcustom_tool.rs- Creating custom tools
License
MIT OR Apache-2.0