handlers

package
v0.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Overview

Package handlers implements the E2B-compatible StrictServerInterface generated by oapi-codegen. Supported operations delegate to the AgentBox service layer; unsupported operations return 501.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VaultRefsIn added in v0.0.10

func VaultRefsIn(rules []agentsv1alpha1.InjectionRule) []string

VaultRefsIn returns every vault entry name referenced by these rules.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server implements e2bgen.StrictServerInterface. Supported: GET/POST /sandboxes, GET/DELETE /sandboxes/:id, POST /sandboxes/:id/timeout,

GET /templates, GET /templates/:id, GET/POST/DELETE /api-keys, GET /health

Every other operation answers 501 with a message naming the alternative; see unsupported.go.

func NewServer

func NewServer(svcs Services, k8sClient client.Client, gatewayDomain string) *Server

NewServer creates a new E2B handler Server.

func (*Server) DeleteSecretsSecretID added in v0.0.10

func (*Server) GetEventsSandboxes added in v0.0.11

func (*Server) GetEventsWebhooks added in v0.0.11

func (*Server) GetSecrets added in v0.0.10

func (*Server) GetSecretsSecretID added in v0.0.10

func (*Server) GetV2Sandboxes

GetV2Sandboxes is the paginated list endpoint the current E2B SDK targets (GET /v2/sandboxes). It applies the same namespace/team/user scoping as the legacy GetSandboxes, then filters by the optional metadata/state query params and returns one page. The next-page cursor is returned via the "x-next-token" response header — the SDK paginator reads it there and stops once it is absent.

func (*Server) GetV2Templates added in v0.0.10

func (*Server) PostEventsWebhooks added in v0.0.11

func (*Server) PostSandboxesSandboxIDConnect

PostSandboxesSandboxIDConnect re-attaches to a sandbox by ID, returning the same shape create does so an SDK can rebuild its handle from an ID alone.

Upstream, connect resumes a *paused* sandbox. AgentBox has no pause — a sandbox is either running in its pool Pod or gone — so here it means "attach to a running one", and a sandbox that was killed or expired is a 404 (which the SDKs surface as sandbox-not-found).

The timeout in the body is applied as upstream defines it: expiry becomes now plus that value, so it can move a deadline in either direction. Note that the SDKs default it (300s in Python), so a bare connect() shortens a sandbox that was created with a longer timeout — pass the timeout you want, or use POST /sandboxes/{id}/timeout to set one without re-attaching. A missing or non-positive value leaves the deadline alone rather than failing the attach.

func (*Server) PostSecrets added in v0.0.10

func (*Server) PostSecretsSecretID added in v0.0.10

func (*Server) PostV2Sandboxes added in v0.0.11

PostV2Sandboxes serves POST /v2/sandboxes.

func (*Server) PostV2SandboxesSandboxIDConnect added in v0.0.11

PostV2SandboxesSandboxIDConnect serves POST /v2/sandboxes/{sandboxID}/connect.

Upstream defaults an omitted v2 timeout to 300s. Here an omitted timeout leaves the deadline alone, as it does on v1: the SDKs always send one, and silently shortening a sandbox created with a longer timeout is the worse failure for a caller that did not send it.

func (*Server) PutSandboxesSandboxIDNetwork added in v0.0.7

PutSandboxesSandboxIDNetwork replaces a running sandbox's egress filtering. Per E2B's contract the body is a full replacement: an omitted field clears it, so an empty body means "unrestricted" rather than "leave as it was".

type Services

type Services struct {
	Sandbox service.SandboxService
	APIKey  service.APIKeyService
	// Vault serves the /secrets endpoints. Nil leaves them answering 501, so a
	// deployment without a vault behaves as it did before rather than
	// pretending to have an empty one.
	Vault service.VaultService
	// Federation exposes other clusters' Env capacity for the template listing.
	// Nil lists only this cluster's Envs.
	Federation *federation.Registry
	// LocalClusterID identifies this cluster in federation records.
	LocalClusterID string
	// Metrics queries the cluster's metrics backend. Nil disables the metrics
	// endpoints.
	Metrics *promclient.Client
	// MetricsSelector returns the PromQL label matcher for this cluster. Nil
	// means no cluster scoping, which is only correct for a backend that serves
	// a single cluster.
	MetricsSelector func() string
	// Forwarder enables cross-cluster forwarding via E2B API.
	// localClusterID is embedded in the forwarder itself; no separate field needed.
	// When Forwarder is nil, cross-cluster requests will be rejected.
	Forwarder *service.CrossClusterForwarder
}

Services bundles service dependencies for E2B handlers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL