Skip to content

entropy-research/rivet_actor_implementation

Repository files navigation

Rivet Actor Implementation

Infrastructure for running coding agents in Daytona sandboxes, orchestrated by Rivet actors.

Architecture

┌─────────────────────────────────────────────────────────────┐
│                        Server (Hono)                        │
│  /api/sessions  /api/integrations  /api/workflows           │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│                     Rivet Actor Registry                    │
│  ┌──────────┐  ┌────────────────────┐  ┌─────────────────┐ │
│  │ Session  │  │ IntegrationRegistry│  │ WorkflowRegistry│ │
│  └──────────┘  └────────────────────┘  └─────────────────┘ │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│                     Daytona Sandbox                         │
│  ┌─────────────────────────────────────────────────────┐   │
│  │                  sandbox-agent server                │   │
│  │  ┌─────────┐  ┌─────────┐  ┌─────────┐  ┌────────┐ │   │
│  │  │ Claude  │  │ Codex   │  │OpenCode │  │  Amp   │ │   │
│  │  └─────────┘  └─────────┘  └─────────┘  └────────┘ │   │
│  └─────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────┘

Quick Start

1. Install dependencies

npm install

2. Configure environment

Copy env.example to .env and fill in:

# Required
DAYTONA_API_KEY=your-daytona-api-key
ANTHROPIC_API_KEY=your-anthropic-key  # For Claude agent

# Optional
OPENAI_API_KEY=your-openai-key        # For Codex agent

3. Run the server

npm run dev

4. Create a session

curl -X POST http://localhost:3000/api/sessions \
  -H "Content-Type: application/json" \
  -d '{"repo": "owner/repo", "author": "user", "agent": "claude"}'

API Reference

Sessions

Endpoint Method Description
/api/sessions GET List all sessions
/api/sessions POST Create a new session
/api/sessions/:id GET Get session status
/api/sessions/:id/start POST Start the session
/api/sessions/:id/prompt POST Send prompt to agent
/api/sessions/:id/trace GET Get event trace
/api/sessions/:id/stop POST Stop the session

Integrations

Endpoint Method Description
/api/integrations GET List all integrations
/api/integrations/:name GET Describe an integration
/api/integrations/all GET Get all integration metadata

Workflows

Endpoint Method Description
/api/workflows GET List all workflows
/api/workflows/:name GET Describe a workflow

Testing

Unit tests

npm test

Sandbox tests (requires API keys)

npm run test:sandbox

Integration tests

npm run test:integration

Project Structure

rivet_actor_implementation/
├── src/
│   ├── actors/
│   │   ├── session.ts              # Session actor (core)
│   │   ├── integration-registry.ts # Integration discovery
│   │   └── workflow-registry.ts    # Workflow discovery
│   ├── sandbox/
│   │   ├── daytona.ts              # Daytona sandbox provider
│   │   └── agent.ts                # sandbox-agent SDK wrapper
│   ├── config.ts                   # Configuration
│   ├── types.ts                    # Shared types
│   ├── registry.ts                 # Rivet actor registry
│   ├── server.ts                   # Hono server
│   └── index.ts                    # Main exports
├── tests/
│   ├── unit/                       # Unit tests
│   ├── sandbox/                    # Sandbox integration tests
│   └── integration/                # API integration tests
├── package.json
├── tsconfig.json
└── vitest.config.ts

Actors

Session Actor

The core actor that wraps a coding agent session:

  • Creates Daytona sandbox with sandbox-agent
  • Manages agent session lifecycle
  • Captures event trace
  • Broadcasts real-time updates

Integration Registry Actor

Singleton actor for dynamic integration discovery:

  • Stores integration metadata
  • Provides list/describe APIs
  • Tracks configuration status

Workflow Registry Actor

Singleton actor for workflow discovery:

  • Stores workflow metadata
  • Provides list/describe APIs
  • Tracks deployment status
  • Finds workflows by trigger

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors