Skip to content

Latest commit

 

History

32 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Agent Runtime

A high-performance, event-driven execution runtime for AI agents, workflows, and distributed task orchestration built in Rust.


Vision

Modern AI applications require more than access to LLMs—they require reliable execution infrastructure.

Agent Runtime is being built as the execution layer responsible for:

  • Executing AI agents
  • Managing task lifecycles
  • Scheduling asynchronous work
  • Running concurrent worker pools
  • Tracking execution state
  • Streaming runtime events
  • Providing production-grade observability
  • Scaling to distributed deployments

The long-term goal is to build an open-source runtime for AI systems inspired by platforms such as Temporal, Trigger.dev, Prefect, and Kubernetes.

Rather than becoming another AI framework, Agent Runtime focuses on the infrastructure that powers AI applications at scale.


Current Development Status

✅ Phase 1 — Runtime Foundation (Completed)

Workspace

  • Cargo Workspace
  • Runtime crate
  • API crate

Runtime Core

  • Runtime Manager
  • Worker Pool
  • Async Task Queue
  • Executor Trait
  • Default Executor

Task System

  • Task Model
  • Task Handle
  • Task State Machine
  • Task Registry
  • Shared Task State

API

  • Axum HTTP Server
  • Health Endpoint
  • POST /tasks
  • GET /tasks
  • GET /tasks/{id}

Observability

  • Event Bus
  • Runtime Events
  • Publish / Subscribe Architecture
  • Structured Logging

🚧 Currently Building

Durable Runtime

  • Storage abstraction
  • PostgreSQL backend
  • SQLite backend
  • Retry engine
  • Timeout engine
  • Task persistence
  • Recovery after restart

📅 Planned

Distributed Runtime

  • Distributed worker nodes
  • Leader election
  • Worker heartbeats
  • Distributed queue
  • Horizontal scaling

AI Runtime

  • Python Executor
  • Shell Executor
  • HTTP Executor
  • Workflow Executor
  • LLM Executor
  • Plugin SDK

Control Plane

  • React Dashboard
  • Live WebSocket Updates
  • Worker Monitoring
  • Queue Monitoring
  • Runtime Metrics
  • API Key Management
  • Execution History

Architecture

                    Client SDKs
        (Rust | Python | TypeScript)
                       │
                       ▼
                 HTTP / gRPC API
                       │
                       ▼
                Runtime Manager
        ┌──────────┼───────────┐
        ▼          ▼           ▼
  Task Registry   Task Queue   Event Bus
        ▲            │           ▲
        │            ▼           │
        └──────── Worker Pool ───┘
                     │
                     ▼
                 Executor Trait
                     │
        ┌────────────┼────────────┐
        ▼            ▼            ▼
    Python      LLM Providers     Shell
    Executor     (Planned)      Executor

Runtime Pipeline

Client

↓

POST /tasks

↓

Runtime Manager

↓

Task Registry

↓

Task Queue

↓

Worker Pool

↓

Executor

↓

Registry Update

↓

Event Bus

↓

API / Dashboard

Task Lifecycle

Created
   │
   ▼
Queued
   │
   ▼
Running
   ├────────────► Completed
   ├────────────► Failed
   └────────────► Cancelled

Future versions will support:

Failed

↓

Retrying

↓

Queued

Event-Driven Architecture

Every significant runtime action emits an event.

Examples include:

  • TaskRunning
  • TaskCompleted
  • TaskFailed

Future events:

  • WorkerStarted
  • WorkerStopped
  • QueueDepthChanged
  • RuntimeStarted
  • RuntimeStopped

This event stream will power:

  • Live dashboard
  • Metrics
  • Logging
  • WebSockets
  • OpenTelemetry
  • Audit history

Current API

Health Check

GET /health

Create Task

POST /tasks

List Tasks

GET /tasks

Get Task

GET /tasks/{id}

Repository Structure

agent-runtime/

├── Cargo.toml
├── README.md
├── docs/
│
└── crates/
    ├── api/
    │   ├── Cargo.toml
    │   └── src/
    │
    └── runtime/
        ├── Cargo.toml
        └── src/
            ├── events/
            │   ├── bus.rs
            │   ├── types.rs
            │   └── mod.rs
            │
            ├── executor.rs
            ├── manager.rs
            ├── queue.rs
            ├── registry.rs
            ├── worker.rs
            ├── handle.rs
            ├── tasks.rs
            ├── state.rs
            ├── error.rs
            └── lib.rs

Technology Stack

Layer Technology
Language Rust
Async Runtime Tokio
Web Framework Axum
Serialization Serde
Logging tracing
IDs UUID
Time Chrono
Events Tokio Broadcast
Storage PostgreSQL (planned)
Queue Tokio MPSC → Redis (planned)
Observability OpenTelemetry (planned)
Metrics Prometheus (planned)
Dashboard React + TypeScript (planned)

Development Roadmap

Phase 1 — Runtime Foundation ✅

  • Cargo Workspace
  • Runtime Crate
  • API Crate
  • Async Queue
  • Worker Pool
  • Runtime Manager
  • Executor Trait
  • Task Registry
  • Event Bus
  • REST API

Phase 2 — Durable Runtime

  • Storage Trait
  • PostgreSQL
  • SQLite
  • Retry Engine
  • Timeout Engine
  • Recovery
  • Persistent Execution

Phase 3 — Distributed Runtime

  • Multi-node Workers
  • Distributed Queue
  • Worker Discovery
  • Leader Election
  • Horizontal Scaling

Phase 4 — AI Runtime

  • Python Executor
  • LLM Executor
  • Workflow Engine
  • Tool Execution
  • Plugin SDK
  • Multi-language SDKs

Phase 5 — Control Plane

  • React Dashboard
  • Live WebSockets
  • Queue Visualization
  • Worker Monitoring
  • Runtime Metrics
  • Execution History
  • API Management

Project Goals

  • Build a production-quality execution runtime for AI systems.
  • Learn distributed systems through implementation.
  • Demonstrate production engineering practices.
  • Create reusable infrastructure for AI agents and workflows.
  • Build an observable, extensible, event-driven runtime.

Long-Term Vision

Agent Runtime is designed to become the operating layer for AI applications.

Instead of coupling AI logic directly to application code, developers should be able to submit work to a runtime that provides:

  • Reliable execution
  • Scheduling
  • State management
  • Observability
  • Distributed execution
  • Fault tolerance

The objective is to build infrastructure that enables AI applications to scale with the same engineering principles used in modern cloud-native platforms.


License

MIT License

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages