How Mastra maps to Constal
Understand the execution, persistence, Resource, Channel, Policy, and isolation boundaries behind a deployed Mastra project.
A Mastra deployment keeps the application framework while adopting Constal's ownership boundaries. The installed Mastra package still executes Agent, workflow, network, Tool, middleware, and route behavior. Constal owns admission, durable effect settlement, customer scope, Credentials, code Policy, billing, and recovery around that execution.
Deployment mapping
| Mastra concept | Constal owner |
|---|---|
Exported Mastra registry | One immutable deployment artifact |
| Registered Agent | Agent Resource and entry |
| Workflow, legacy network, or vNext network | Agent Resource with that registry entry |
| External Express or Node server | Server Agent behind a Channel |
threadId | Customer-scoped Session identity |
| Generation, stream, or workflow execution | Run |
suspend() and resume() | Durable wait and authenticated resolution |
| Threads, messages, working memory, snapshots | Owner-scoped Mastra framework domains |
| Semantic vectors | Constal Memory Resource and its configured Store |
| Score | Mastra score row plus idempotent Verdict fact |
| Observability mutation | Framework-domain record plus redacted export event |
Waiting for a model, Resource, or human does not consume active Worker CPU. A suspended workflow is durable state. When the result arrives, Constal leases the next attempt and the installed Mastra code continues from its recorded state.
Tools and external effects
A Mastra Tool remains application code; it is not automatically an external service. Constal applies Tool code Policy, then any external capability invoked by that Tool crosses its bound Resource. OpenAI, Anthropic, and Bedrock calls map to Model Resources. Tavily and Exa map to governed search or service operations. MCP uses an MCP Resource. Daytona or E2B coding Tools use a SandboxPool Resource, and Stagehand Tools use a Browser Resource.
Every paid or externally visible operation receives a deterministic Run-journal position. If a Worker disappears after settlement, the replacement attempt receives the recorded result instead of repeating the provider call.
HTTP and composition
Public framework HTTP is a Channel, not a Mastra-specific gateway service. Channel authentication and Channel code Policy run before target selection. Agent code Policy runs before the server Agent's Session and Run. Registered middleware and custom routes then execute unchanged inside that Run.
Peer service-discovery URLs map to deployment-pinned Channels. The parent Run journals the terminal Channel response, while the child request follows the normal Channel, Agent, Session, customer, billing, and response path.
Customer isolation
The same artifact can serve multiple customers without sharing Credentials, memory coordinates, framework data, cost scope, or Policy snapshots. Constal derives those owners from authenticated admission; Mastra input cannot select another customer's owner or raw CRN. Review Identity, Policy, and authority, Scoped bindings, and Resources, effects, and recovery for the underlying contracts.
Next steps
Use the deployment tutorial to publish a project, then keep Mastra compatibility and operations beside your release checklist.