Skip to content

RobinLmn/cosal

Repository files navigation

Cosal

A platform for personal AI agents. Each agent runs in its own Firecracker microVM with persistent state, a scheduler, and a tool runtime, so it can keep working on your tasks in the background even when you are not using it.

cosal.ai. Built with Rust and TypeScript. CI

A Cosal agent importing a JSON file and rendering it as a live kanban dashboard.

How it works

Every Cosal agent gets its own Firecracker microVM. Inside that VM, a single Rust binary owns everything the agent touches: the conversation, the file system, the scheduler, the memory index, and the tool runtime. The host, which is an API server and a VM router, never sees the contents of a conversation or what tasks an agent is running. Messages cross the API as encrypted blobs and are only decrypted inside the user's VM.

The agent's code is untrusted, so we run it in a separate sandbox for each user and keep the orchestration layer separate from the layer that does the actual work. User data and the compute that uses it stay inside the same VM, and the orchestrator has no access to what is inside. Because the microVMs start in about 1.2 seconds, we don't keep them running while they are idle, so an inactive user costs nothing.

┌──────────────┐    ┌──────────────┐    ┌────────────┐    ┌──────────────────┐
│   Frontend   │←──→│  API server  │←──→│  VM router │←──→│   Agent VM       │
│   Next.js    │    │  Axum/Rust   │    │  Axum/Rust │    │   Axum/Rust      │
│    :3000     │    │    :3001     │    │   :8080    │    │  (Firecracker)   │
└──────────────┘    └──────────────┘    └────────────┘    └──────────────────┘
                            ↕                                       ↕
                    ┌──────────────────────────────────────────────────┐
                    │              Supabase (Postgres + Auth)          │
                    │      Deno edge functions for stateful actions    │
                    └──────────────────────────────────────────────────┘

Two key features

The UI is generated, not hardcoded. The model returns typed descriptions of components, and the React layer checks them and renders them. This lets the agent build dashboards, kanbans, charts, and forms without ever touching the DOM directly. The job tracker shown above was generated this way. The budget dashboard below is another example.

A budget JSON imported by the agent and rendered as a live dashboard.

Each agent runs its own scheduler. Every agent keeps its own cron-style schedule. The API's only job is to wake the right VM at the right time; the schedule and whatever it triggers stay with the agent. So you can say something like "book it if the price drops below £100, otherwise keep watching," and the agent will set up a recurring task for itself that checks every few hours.

A conversational flight search where the agent renders three options as generated cards and then schedules a recurring task to monitor for a price drop.

Getting started

git clone https://github.com/RobinLmn/cosal && cd cosal
cp .env.example .env # add ANTHROPIC_API_KEY and Supabase credentials
make dev

make dev builds the agent-runtime image, starts the API and VM containers, and launches the Next.js dev server at http://localhost:3000. After that the platform is ready to use.

Other useful targets: make build, make release, make test, make logs, make logs-api, make logs-vm, make logs-agent ID=<id>, make down, make clean.

License

Source-available, all rights reserved. See LICENSE. Reading and cloning for review is fine, but modifying, distributing, and creating derivative works requires written permission.

About

A platform for autonomous AI agents running in sandboxed Firecracker microVMs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors