← Coding Blog

Building a Multi-Tenant Agent Harness with VMA

  • Agent Harnesses
  • System Design
  • OpenRouter
  • Multi-Tenant SaaS

How tasks and updates move

Votrix Managed Agents (VMA) is a multi-tenant agent harness. The API saves accepted input before handing the task to Cloud Tasks. An async worker runs the agent and its sandbox tools. The request returns once accepted, so your app can start watching results.

VMA asynchronous execution and SSE streamingThe application submits work to the VMA API, which checks Organization access and saves accepted input before dispatching through Cloud Tasks. An asynchronous worker runs Deep Agents and LangGraph with an E2B sandbox. The worker saves sequenced events to PostgreSQL and publishes temporary text previews through LISTEN and NOTIFY. A separate SSE endpoint combines event history and live previews for the application. Reconnection resumes from the last saved event sequence.Your appBackend + UIServer-held API keyVMA APIOrganization checkSave accepted inputCloud TasksAsync dispatchQueue a turnAsync workerDeep Agents / LangGraphTools → E2B sandboxEvent logPostgreSQL · seqSaved, replayable eventsLive previewsLISTEN / NOTIFYTemporary text deltasSSE endpointHistory + live updatesResume from last seqSSESave eventsLive previewsVMA asynchronous execution and SSE streamingThe application submits work to the VMA API, which checks Organization access and saves accepted input before dispatching through Cloud Tasks. An asynchronous worker runs Deep Agents and LangGraph with an E2B sandbox. The worker saves sequenced events to PostgreSQL and publishes temporary text previews through LISTEN and NOTIFY. A separate SSE endpoint combines event history and live previews for the application. Reconnection resumes from the last saved event sequence.Your appBackend + UIServer-held API keyVMA APIOrganization checkSave accepted inputCloud TasksAsync dispatchQueue a turnAsync workerDeep Agents / LangGraphTools → E2B sandboxEvent logPostgreSQL · seqSaved, replayable eventsLive previewsLISTEN / NOTIFYTemporary text deltasSSE endpointHistory + live updatesResume from last seqSSE · resume from last seq
Cloud dispatch mode. Saved events can be replayed; live previews are temporary.

SSE reads saved events independently of the worker. Temporary text previews arrive through PostgreSQL notifications; saved events carry the history that a reconnect can replay.

OpenRouter integration

The runtime sends model calls through OpenRouter. Agents choose from VMA’s model catalog, so different model providers share the same agent execution path.

Each Account owns a dedicated OpenRouter inference key, stored encrypted. A Session keeps its assigned Account, and each turn uses that Account’s key. The platform’s management credential provisions and manages those keys; it is not used for inference.

Every model request carries the VMA Session ID as OpenRouter’s session_id. This groups calls from the same conversation in OpenRouter and connects provider usage to the Session that produced it. The runtime also handles model-specific routing, prompt-cache settings, and retries for transient failures.

Let the page reconnect

VMA sends progress over SSE (Server-Sent Events). Each saved Session event has a sequence number, so the frontend can resume reading from its last event after a disconnect.

Track whose work costs money

Usage comes from OpenRouter’s reported USD snapshots. VMA exposes Account totals and cumulative spending for a Session, so you can attribute model costs to the work that produced them.

VMA’s Accounts group usage and spending. You can use that information in your own plans and billing logic. An Account tracks costs; it does not give a user permission to access data. Your application still owns pricing and final bills.

The VMA API docs have the full resource model and examples.