A powerful, minimal framework for creating autonomous agents using WebAssembly and Rust.
Powerful tools designed to make agent development intuitive and efficient
Instant feedback with our hot-reloading development environment for rapid iteration
High-performance execution powered by WebAssembly and Rust's zero-cost abstractions
Test your agents with rich commands, conversation history, and detailed metrics
Seamless integration with UOMI and third-party language models via a unified API
Comprehensive tools for debugging, performance monitoring, and error tracing
Track agent evolution and development with built-in versioning and lifecycle management
Write clean, concise code that's both powerful and easy to understand. WASP abstracts the complexity while giving you full control.
Leverage Rust's powerful type system
Compiled to efficient, portable WASM
Clean, ergonomic interface for developers
use serde::{Deserialize, Serialize};
use utils::log;
mod utils;
#[derive(Serialize, Deserialize, Debug)]
struct Message {
role: String,
content: String,
}
fn parse_input(input: &str) -> Vec<Message> {
// Parse the input string into a JSON Value
let parsed: Vec<Message> = serde_json::from_str(input)
.expect("Failed to parse input JSON");
parsed
}
fn system_message(content: String) -> Message {
Message {
role: "system".to_string(),
content,
}
}
fn process_messages(
system_message: Message,
mut messages: Vec<Message>) -> Vec<Message> {
messages.insert(0, system_message);
messages
}
#[no_mangle]
pub extern "C" fn run() {
log("Start agent execution!");
//get the input
let input = utils::read_input();
let input = String::from_utf8_lossy(&input);
let input = parse_input(&input);
//create a system message
let system_message = system_message("You are a UOMI Agent!".to_string());
let modified_messages = process_messages(system_message, input);
let ai_input= serde_json::json!({
"messages": modified_messages,
}).to_string();
let ai_input_bytes = ai_input.as_bytes().to_vec();
let ai_response = utils::call_ai_service(1, ai_input_bytes);
let ai_response_str = String::from_utf8(ai_response.clone()).unwrap();
let ai_response_content = extract_ai_response_content(ai_response_str);
let ai_response_content_bytes = ai_response_content.as_bytes().to_vec();
// save output
utils::save_output(&ai_response_content_bytes);
}