Runtm

repository·main·Indexed 43 days ago

https://github.com/runtm-ai/runtm

Open-source sandboxes for AI coding agents to build, test, and deploy software in isolated, secure environments with live HTTPS endpoints. Features include a Go-based runtm-api CLI for programmatic agent interaction, a Python-based runtm CLI for manual management, and auto-stop deployment tiers (starter, standard, performance) to optimize costs.

Tokens
369.4K
Snippets
1.3K
Records
1.6K
Agent score
55%

What's inside Runtm

  1. Overview of Open Source Runtime capabilities

    main

    The core of Runtime is open source, allowing teams to run the platform on their own infrastructure. Key capabilities include:

    • Self-Hosting: Run the full Runtime stack on your own infrastructure using Docker Compose.
    • CLI Management: Use the CLI to manage sandboxes, deployments, secrets, and domains locally.
    • OSS Deployment API: Programmatically access deployments, logs, and domains via the open-source deployment API.

    Note: Most users should refer to the hosted platform documentation or the Cloud API Reference. These open-source guides are specifically for teams self-hosting or contributing to the project.

  2. Overview of the Backend Service Template

    main

    The Backend Service Template is a FastAPI-based Python template designed for Runtm. It is intended for API-first services that require Python compute, such as scrapers, crawlers, agent backends with tool calls, webhooks, and data processing integrations.

    Stack:

    • FastAPI: High-performance API framework
    • Pydantic: Data validation and serialization
    • Uvicorn: ASGI server
    • Pytest: Testing framework
  3. web-app Template Specifications and Requirements

    main

    The web-app template is a fullstack architecture designed for interactive applications, dashboards, and SaaS products.

    Technical Stack:

    • Frontend: Next.js 14 (App Router)
    • Backend: Python FastAPI
    • Port: 3000 (The frontend proxies requests to the backend)
    • Health Endpoint: /health

    ⚠️ Critical Resource Requirement: This template requires at least the standard tier (minimum 512MB RAM) because it runs both Node.js and Python processes simultaneously. The starter tier (256MB) is insufficient.

  4. How to use the Runtm (Runtime) Cloud and CLI

    main

    Runtm (Runtime) Cloud is a platform for creating and running AI agents equipped with jobs, success metrics, tools, runbooks, triggers, and guardrails.

    To interact with the cloud, use the runtm-api binary. Note that the pip runtm CLI is intended for local development only and does not interact with the hosted API.

    Accessing Documentation via CLI: If you do not have a fetch tool, you can access documentation directly through the CLI:

    • runtm-api docs: Prints the llms.txt index.
    • runtm-api docs <path>: Prints a specific documentation page (e.g., runtm-api docs build/give-it-tools).
    runtm-api docs build/give-it-tools
  5. Project structure of the backend-service template

    main

    The backend-service template follows a structured layout for FastAPI applications:

    • runtm.yaml: Deployment manifest.
    • runtm.discovery.yaml: Search metadata.
    • Dockerfile: Container build instructions.
    • pyproject.toml: Python dependencies.
    • app/main.py: FastAPI entry point.
    • app/api/v1/: API route definitions (e.g., health.py, routes.py).
    • app/services/: Business logic (e.g., processor.py).
    • app/core/: Core settings and logging (config.py, logging.py).
    • app/db/: Database layer including models, sessions, and migrations.
    • tests/: Test suite.
  6. Runtime Cloud API Capability Map

    main

    The Runtime API provides programmatic control over several functional areas:

    • Sessions: Create and manage cloud development sessions, send prompts, and stream agent output.
    • Deploy: Scaffold, validate, and ship sessions to production with streaming logs.
    • Templates: Manage organization templates, build snapshots, and manage required secrets.
    • Secrets: Access personal and team secret stores (values are write-only).
    • Context: Manage system instructions, skills, MCP servers, docs, and knowledge sources.
    • Guardrails: Manage allowlists, deploy permissions, org limits, and cleanup policies.
    • Activity: Access personal and team telemetry (prompts, usage, traces, and member breakdowns).
    • Integrations: Manage GitHub App, GitHub user tokens, Linear, and Slack.
    • Provider Keys: Manage Bring-Your-Own Anthropic and OpenAI keys and check plan status.
    • WebSockets: Real-time terminal access, prompt streaming, and collaboration presence.
  7. Manage Cloud Development Sessions

    main

    A session is an isolated cloud sandbox where coding agents (such as Claude Code, Codex, or Cursor CLI) execute commands, edit files, and provide live preview URLs. The Cloud API allows you to manage the full lifecycle of these sessions, including listing, creating, retrieving, and destroying them.

    Required Scopes

    Depending on the operation, you need one of the following scopes:

    • sessions:read: Required for listing and getting sessions.
    • sessions:write: Required for creating sessions.
    • sessions:delete: Required for destroying sessions.

    Authentication & Organization Context

    • All session endpoints honor the X-Organization-Id header.
    • Personal keys: May omit the header to operate on personal sessions (organization_id = NULL).
    • Organization keys: Must include the X-Organization-Id header that matches the key's organization.
  8. Use the Docker Template for containerized deployments

    main
    The Docker template is a 'bring your own Dockerfile' approach for deploying any containerized application (Go, Rust, Elixir, etc.) to Runtm. Instead of scaffolding an entire application, it provides the necessary deployment contract files: runtm.yaml (deployment manifest), Dockerfile (your container build), and runtm.discovery.yaml (app metadata).
  9. Explore Open Source Guides and Features

    main

    The open-source version of Runtime provides several specialized guides and features:

    Guides

    • Agent Workflow: Learn how agents propose changes and how humans approve them.
    • Discovery: Learn how to make your deployments searchable and discoverable.
    • Logs & Debugging: Instructions for diagnosing issues with build and runtime logs.
    • Troubleshooting: Solutions for common problems.

    Features

    • Machine Tiers: Manage compute sizes and suspended-state behavior.
    • Secrets: Manage environment variables for your deployments.
    • Database: Utilize persistent SQLite storage for deployed applications.
    • Custom Domains: Connect your own domains with automatic SSL.
    • Authentication: Add authentication layers to your deployed applications.
  10. What is a Skill in Runtime

    main

    A Skill is a reusable bundle that teaches an agent how to perform specific workflows. It serves as the primary unit of agent extension. When a skill is attached to a session or a template, it provides the agent with authoritative guidance, reference materials, and specialized tools.

    A skill bundle consists of four components:

    1. Entry markdown (SKILL.md): The primary instruction document the agent reads.
    2. Files: Reference materials like code samples, schemas, diagrams, or configuration templates mounted into the sandbox.
    3. MCP servers: Configured Model Context Protocol tools (via stdio, http, or sse) that the agent can call.
    4. Required tooling: System or language packages (resolved via mise) installed in the sandbox at template build time.
  11. What is a Runtm Session?

    main

    A session is a sandboxed cloud environment that serves as the core unit of work in Runtime. Each session runs in an isolated, dedicated VM with its own kernel, filesystem, and network namespace. This isolation ensures that one VM per session is used, preventing cross-user or cross-session access.

    Every session includes:

    • Isolated VM: Dedicated compute and network namespace.
    • Workspace: A full Linux filesystem for file operations.
    • Terminal: An interactive PTY accessible via WebSocket.
    • Agent: A coding agent (e.g., claude-code, gemini-cli, cursor-cli) that responds to prompts.
    • Live preview: Port-forwarded HTTPS URLs for running services.
    • Git integration: Capabilities to clone, commit, push, and create PRs.
    • Context: Automatically applied instructions, skills, and knowledge.
    • Guardrails: Enforced policies and deployment gates at the VM level.