MCPcopy Index your code
hub / github.com/beam-cloud/beta9

github.com/beam-cloud/beta9 @gateway-0.1.700

Chat with this repo
repository ↗ · DeepWiki ↗ · release gateway-0.1.700 ↗ · + Follow
18,807 symbols 56,134 edges 803 files 1,831 documented · 10%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Logo Logo

Run AI Workloads at Scale

Colab ⭐ Star the Repo Documentation Join Slack Twitter AGPL

Beam is a fast, open-source runtime for serverless AI workloads. It gives you a Pythonic interface to deploy and scale AI applications with zero infrastructure overhead.

Watch the demo

✨ Features

  • Fast Cold Starts: Launch containers in under a second using a custom container runtime, scheduler, and embedded caching
  • Parallelization and Concurrency: Fan out workloads to 100s of containers
  • First-Class Developer Experience: Hot-reloading, webhooks, and scheduled jobs
  • Scale-to-Zero: Workloads are serverless by default
  • Volume Storage: Mount distributed storage volumes
  • GPU Support: Run on our cloud (4090s, H100s, and more) or bring your own GPUs

📦 Installation

pip install beam-client

⚡️ Quickstart

  1. Create an account here
  2. Follow our Getting Started Guide

Creating a sandbox

Spin up isolated containers to run LLM-generated code:

from beam import Image, Sandbox


sandbox = Sandbox(image=Image()).create()
response = sandbox.process.run_code("print('I am running remotely')")

print(response.result)

Deploy a serverless inference endpoint

Create an autoscaling endpoint for your custom model:

from beam import Image, endpoint
from beam import QueueDepthAutoscaler

@endpoint(
    image=Image(python_version="python3.11"),
    gpu="A10G",
    cpu=2,
    memory="16Gi",
    autoscaler=QueueDepthAutoscaler(max_containers=5, tasks_per_container=30)
)
def handler():
    return {"label": "cat", "confidence": 0.97}

Run background tasks

Schedule resilient background tasks (or replace your Celery queue) by adding a simple decorator:

from beam import Image, TaskPolicy, schema, task_queue


class Input(schema.Schema):
    image_url = schema.String()


@task_queue(
    name="image-processor",
    image=Image(python_version="python3.11"),
    cpu=1,
    memory=1024,
    inputs=Input,
    task_policy=TaskPolicy(max_retries=3),
)
def my_background_task(input: Input, *, context):
    image_url = input.image_url
    print(f"Processing image: {image_url}")
    return {"image_url": image_url}


if __name__ == "__main__":
    # Invoke a background task from your app (without deploying it)
    my_background_task.put(image_url="https://example.com/image.jpg")

    # You can also deploy this behind a versioned endpoint with:
    # beam deploy app.py:my_background_task --name image-processor

Self-Hosting vs Cloud

Beta9 is the open-source engine powering Beam, our fully-managed cloud platform. You can self-host Beta9 for free or choose managed cloud hosting through Beam.

👋 Contributing

We welcome contributions big or small. These are the most helpful things for us:

❤️ Thanks to Our Contributors

Extension points exported contracts — how you extend this code

OutputWriter (Interface)
OutputWriter is an interface for writing container output [11 implementers]
pkg/runtime/runtime.go
Source (Interface)
(no doc) [7 implementers]
pkg/cache/source.go
IAutoscaler (Interface)
(no doc) [12 implementers]
pkg/abstractions/common/autoscaler.go
WorkerPoolController (Interface)
(no doc) [5 implementers]
pkg/scheduler/pool.go
UsageMetricsRepository (Interface)
(no doc) [5 implementers]
pkg/repository/base.go
Storage (Interface)
(no doc) [5 implementers]
pkg/storage/storage.go
EventClient (Interface)
(no doc) [4 implementers]
pkg/types/event.go
CRIUManager (Interface)
(no doc) [4 implementers]
pkg/worker/criu.go

Core symbols most depended-on inside this repo

Errorf
called by 1804
pkg/cache/logger.go
Fatalf
called by 1280
pkg/cache/logger.go
get
called by 1211
sdk/src/beta9/abstractions/map.py
Fatal
called by 825
pkg/cache/logger.go
Err
called by 784
pkg/repository/events.go
Now
called by 691
pkg/types/backend.go
Context
called by 482
pkg/scheduler/pool.go
Add
called by 454
pkg/cache/client.go

Shape

Method 11,457
Function 4,761
Struct 1,629
Class 648
Interface 188
Route 57
TypeAlias 51
FuncType 16

Languages

Go86%
Python14%

Modules by API surface

proto/gateway.pb.go1,866 symbols
proto/worker_repo.pb.go826 symbols
proto/pod.pb.go417 symbols
proto/worker.pb.go409 symbols
proto/gateway_grpc.pb.go389 symbols
proto/types.pb.go377 symbols
pkg/repository/base.go325 symbols
proto/volume.pb.go281 symbols
sdk/src/beta9/abstractions/sandbox.py245 symbols
sdk/src/beta9/clients/gateway/__init__.py244 symbols
proto/worker_repo_grpc.pb.go236 symbols
pkg/gateway/services/compute/compute_test.go180 symbols

Datastores touched

appDatabase · 1 repos

For agents

$ claude mcp add beta9 \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact