High-performance Rust implementation of the SmartAssist AI agent gateway.
| Crate | Description |
|---|---|
smartassist-core |
Core types, configuration, and shared utilities |
smartassist-sandbox |
Command execution sandboxing with platform-specific profiles |
smartassist-channels |
Messaging channel abstractions (Telegram, Discord, Slack, etc.) |
smartassist-agent |
Agent runtime with tool execution framework |
smartassist-memory |
Memory and context management for agents |
smartassist-gateway |
JSON-RPC gateway server over WebSocket |
smartassist-cli |
Command-line interface |
smartassist-plugin-sdk |
Plugin development kit for extensions |
smartassist-providers |
Model provider integrations (Anthropic, OpenAI, Google) |
smartassist-secrets |
Encrypted secrets and credential management |
# Build all crates
cargo build --workspace
# Build with release optimizations
cargo build --workspace --release
# Build CLI only
cargo build -p smartassist-cli# Run all tests
cargo test --workspace
# Run tests for a specific crate
cargo test -p smartassist-agent
# Run tests with specific channel features
cargo test -p smartassist-channels --features telegram# Start the gateway with Anthropic (default)
ANTHROPIC_API_KEY=your-key cargo run -p smartassist-cli -- gateway run
# Start with OpenAI
OPENAI_API_KEY=your-key cargo run -p smartassist-cli -- gateway run --provider openai
# Start with Google Gemini
GOOGLE_API_KEY=your-key cargo run -p smartassist-cli -- gateway run --provider google
# Start on a specific port with custom model
ANTHROPIC_API_KEY=xxx cargo run -p smartassist-cli -- gateway run --port 18789 --model claude-opus-4-20250514
# Show help
cargo run -p smartassist-cli -- --helpEnvironment variables:
ANTHROPIC_API_KEY- Anthropic Claude API keyOPENAI_API_KEY- OpenAI API keyGOOGLE_API_KEYorGEMINI_API_KEY- Google Gemini API keySMARTASSIST_PROVIDER- Default provider (anthropic, openai, google)SMARTASSIST_MODEL- Default model to use
Messaging channels are feature-gated to reduce compile time and dependencies:
# Build with Telegram support
cargo build -p smartassist-channels --features telegram
# Build with Discord support
cargo build -p smartassist-channels --features discord
# Build with Slack support
cargo build -p smartassist-channels --features slack
# Build with WebSocket support
cargo build -p smartassist-channels --features web
# Build with Signal support
cargo build -p smartassist-channels --features signal
# Build with iMessage support (macOS only)
cargo build -p smartassist-channels --features imessage
# Build with WhatsApp support
cargo build -p smartassist-channels --features whatsapp
# Build with LINE support
cargo build -p smartassist-channels --features line
# Build with all channels
cargo build -p smartassist-channels --features "telegram,discord,slack,web,signal,imessage,whatsapp,line"┌─────────────────────────────────────────────────────────────────┐
│ smartassist-cli │
│ (Command-line interface) │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ smartassist-gateway │
│ (JSON-RPC over WebSocket server) │
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Health │ │ Chat │ │ Sessions │ │ Config │ ... │
│ │ Handler │ │ Handler │ │ Handler │ │ Handler │ │
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
└─────────────────────────────────────────────────────────────────┘
│
┌────────────────────┼────────────────────┐
▼ ▼ ▼
┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ smartassist-agent│ │smartassist- │ │smartassist-memory │
│ (Agent runtime) │ │ channels │ │ (Context store) │
│ │ │ (Messaging) │ │ │
│ ┌────────────┐ │ │ ┌──────────┐ │ │ ┌────────────┐ │
│ │ Tools │ │ │ │ Telegram │ │ │ │ Embeddings │ │
│ ├────────────┤ │ │ ├──────────┤ │ │ ├────────────┤ │
│ │ Sessions │ │ │ │ Discord │ │ │ │ Vector DB │ │
│ ├────────────┤ │ │ ├──────────┤ │ │ └────────────┘ │
│ │ Streaming │ │ │ │ Slack │ │ │ │
│ └────────────┘ │ │ ├──────────┤ │ └──────────────────┘
│ │ │ │ Signal │ │
│ │ │ ├──────────┤ │
│ │ │ │ WhatsApp │ │
│ │ │ ├──────────┤ │
│ │ │ │ Web +more│ │
│ │ │ └──────────┘ │
└──────────────────┘ └──────────────────┘
│
▼
┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
│smartassist- │ │smartassist- │ │ smartassist- │
│ sandbox │ │ providers │ │ secrets │
│ (Cmd execution) │ │ (AI models) │ │ (Credentials) │
└──────────────────┘ └──────────────────┘ └──────────────────┘
│ │ │
▼ ▼ ▼
┌─────────────────────────────────────────────────────────────────┐
│ smartassist-core │
│ (Types & configuration) │
└─────────────────────────────────────────────────────────────────┘
All 4 specification phases are complete:
| Phase | Focus | Status |
|---|---|---|
| Phase 1 | Core Infrastructure (providers, gateway, tools) | Complete |
| Phase 2 | Channels (Telegram, Discord, Slack, Signal, WhatsApp, iMessage, LINE, Web) | Complete |
| Phase 3 | Advanced Features (Plugin SDK, browser automation, memory/embeddings) | Complete |
| Phase 4 | Platform & Polish (CLI, config validation, comprehensive testing) | Complete |
Key metrics: 167 source files, 725 tests passing, 101 agent tools, 46 gateway RPC methods, 11 workspace crates.
The agent includes 101 built-in tools:
read- Read file contentswrite- Write file contentsedit- Edit files with diff-based changesglob- Find files by patterngrep- Search file contents
file_copy- Copy files to a new locationfile_move- Move or rename filesfile_stat- Get file/directory information (size, timestamps, permissions)file_delete- Delete files or directories (requires approval)
zip- Create/extract zip archivestar- Create/extract tar archives (with gzip support)
file_checksum- Compute file hash (MD5, SHA1, SHA256, SHA512)file_verify- Verify file matches expected hash
template- Substitute variables in template stringsformat- Format values (JSON, numbers, bytes, durations)
bash- Execute shell commands
process_list- List running processesprocess_info- Get current process information
sleep- Wait for a specified durationtemp_file- Create a temporary filetemp_dir- Create a temporary directoryecho- Echo a value back (useful for testing)
env_get- Get environment variable valueenv_list- List environment variablesenv_check- Check if environment variables exist
http_request- Make HTTP requests to APIsurl_parse- Parse URL into componentsurl_build- Build URL with query parameters
dns_lookup- DNS record lookupport_check- Check TCP port connectivityhttp_ping- Check HTTP/HTTPS endpoint reachabilitynet_info- Get network interface information
web_fetch- Fetch and process web pagesweb_search- Search the web
message- Send messagessessions_spawn- Create new agent sessionssessions_send- Send to existing sessionssessions_list- List active sessionssessions_history- Get session historysession_status- Get session status
memory_search- Search stored memoriesmemory_get- Retrieve specific memoriesmemory_store- Store information in memorymemory_index- Index and organize memory entries
cron- Schedule recurring tasksgateway- Control the gatewaynodes- Manage distributed nodes
image- Analyze imagestts- Text-to-speech
browser- Browser automation
telegram_actions- Telegram-specific actionsdiscord_actions- Discord-specific actionsslack_actions- Slack-specific actions
notebook_edit- Edit Jupyter notebook cells
lsp- Language Server Protocol for go-to-definition, find-references, hover
task_create- Create tasks to track worktask_list- List all taskstask_update- Update task statustask_get- Get task details
ask_user- Ask user questions with multiple choice optionsconfirm- Request user confirmation for actions
enter_plan_mode- Enter planning mode for implementation designexit_plan_mode- Exit planning mode and submit plan for approval
skill- Invoke a registered skill (slash command)skill_list- List available skills
system_info- Get system information (OS, architecture, environment)health_check- Check agent health and statusdiagnostic- Run diagnostics to troubleshoot issues
context_add- Add information to working context for later referencecontext_get- Retrieve entries from working contextcontext_clear- Clear the working context
diff- Generate diffs between text or filespatch- Preview and apply search/replace changes
git_status- Get repository status (staged, modified, untracked)git_log- View commit historygit_diff- View changesgit_branch- List and manage branches
json_query- Query JSON data using path expressionsjson_transform- Transform JSON (pick, omit, rename, flatten)yaml- Parse and convert between YAML and JSON
base64- Base64 encode/decodehex- Hexadecimal encode/decodehash- Compute hashes (MD5, SHA1, SHA256, SHA512)url_encode- URL encode/decode
now- Get current date and timedate_parse- Parse and format date stringsdate_calc- Date calculations (add, subtract, diff)
case- Convert case (upper, lower, camel, snake, kebab)split_join- Split and join stringsreplace- Text replacement with regex supporttrim_pad- Trim whitespace or pad strings
calc- Mathematical calculations (add, sqrt, power, etc.)random- Generate random numbers, strings, or pick itemsuuid- Generate UUIDs
validate- Validate formats (email, URL, JSON, UUID, IP, etc.)is_empty- Check if value is empty, null, or blank
compare- Compare two values (eq, ne, lt, gt, contains, starts_with, ends_with)assert- Assert a condition is true (returns error if false)match- Match text against regex patterns with capture groupsversion_compare- Compare semantic version strings
The gateway exposes 46+ RPC methods for:
- Health monitoring (
health,status) - Chat interface (
chat,chat.history,chat.abort) - Agent management (
agent,agent.stream) - Session management (
sessions.list,sessions.resolve,sessions.patch,sessions.delete) - Model management (
models.list) - Configuration (
config.get,config.set,config.patch,config.schema) - Channel messaging (
send,send.poll) - Device pairing (
device.pair.list,device.pair.approve,device.pair.reject,device.token.rotate,device.token.revoke) - Node management (
node.list,node.describe,node.pair.request,node.pair.approve,node.pair.reject,node.unpair,node.rename,node.invoke) - Cron scheduling (
cron.list,cron.status,cron.add,cron.update,cron.remove,cron.run,cron.runs,wake) - Execution approvals (
exec.approvals.get,exec.approvals.set,exec.approval.request,exec.approval.resolve) - Skill management (
skills.status,skills.bins,skills.install,skills.update) - System operations (
system-presence,system-event,last-heartbeat,set-heartbeats,logs.tail) - Setup wizard (
wizard.start,wizard.next,wizard.cancel,wizard.status)
The smartassist-providers crate includes integrations for major AI providers:
- Models:
claude-opus-4-20250514,claude-sonnet-4-20250514,claude-3-5-haiku-20241022 - Features: Streaming, tool calling, vision, 200K context
- Models:
gpt-4o,gpt-4o-mini,o1,o3-mini - Features: Streaming, tool calling, vision, 128K context
- Models:
gemini-2.0-flash,gemini-1.5-pro - Features: Streaming, tool calling, vision, 2M context
use smartassist_providers::{anthropic::AnthropicProvider, Provider};
let provider = AnthropicProvider::from_env()?;
let response = provider.chat(
"claude-sonnet-4-20250514",
&[Message::user("Hello!")],
None,
).await?;Create custom plugins using the SDK:
use smartassist_plugin_sdk::prelude::*;
pub struct MyPlugin;
#[async_trait]
impl Plugin for MyPlugin {
fn metadata(&self) -> PluginMetadata {
PluginMetadata {
name: "my-plugin".to_string(),
version: Version::parse("1.0.0").unwrap(),
description: "My custom plugin".to_string(),
author: Some("Author".to_string()),
homepage: None,
license: Some("MIT".to_string()),
capabilities: vec![PluginCapability::Tool],
min_smartassist_version: None,
}
}
async fn initialize(&mut self, ctx: &PluginContext) -> Result<()> {
Ok(())
}
async fn shutdown(&mut self) -> Result<()> {
Ok(())
}
fn as_any(&self) -> &dyn std::any::Any { self }
fn as_any_mut(&mut self) -> &mut dyn std::any::Any { self }
}Plugin capabilities:
Channel- Custom messaging channelsTool- Custom agent toolsModelProvider- Custom AI model providersHook- Middleware and interceptorsStorage- Custom storage backendsMedia- Media processing
MIT