Skip to main content

Run the Demo

The recommended runnable demo for the Mastra SDK is the public Mastra coding-agent POC:

This POC demonstrates:

  • secure E2B sandbox creation
  • file and directory operations
  • shell command execution
  • OpenBox governance, approvals, and guardrails for agent activity

Prerequisites​

  • Node.js 24.10+
  • npm
  • an E2B API key
  • an OpenAI API key
  • an OpenBox Core URL and API key
  • an OpenBox agent DID and private key unless Require signing is disabled for the agent

Clone The Repository​

git clone -b dev https://github.com/OpenBox-AI/poc-mastra-coding-agent
cd poc-mastra-coding-agent

Install Dependencies​

From the POC root:

npm install

This installs @openbox-ai/openbox-mastra-sdk from npm. You do not need a sibling SDK checkout.

Configure Environment​

Copy the example environment file:

cp .env.example .env.local

Required values:

VariablePurpose
E2B_API_KEYaccess to E2B sandbox execution
OPENAI_API_KEYmodel access for the coding agent
OPENBOX_URLOpenBox Core base URL
OPENBOX_API_KEYOpenBox API key
OPENBOX_AGENT_DIDagent DID, required by default unless Require signing is disabled
OPENBOX_AGENT_PRIVATE_KEYbase64 raw Ed25519 seed, required by default unless Require signing is disabled

Common runtime options:

VariablePurposeTypical value
OPENBOX_GOVERNANCE_POLICYbehavior when OpenBox is unavailablefail_closed
OPENBOX_VALIDATEvalidate the API key at startuptrue
OPENBOX_GOVERNANCE_TIMEOUTOpenBox API timeout in milliseconds for this demo environment5000

Run The Demo​

Start the local development server:

npm run dev

Other useful commands:

npm run build
npm run start

What To Try​

Example prompts:

  • create a sandbox and write hello_world.txt with print("Hello World")
  • create a sandbox, write a file, then read it back
  • create a sandbox and run a shell command

If OpenBox approvals or guardrails are enabled for the registered agent, the demo will reflect those decisions during execution.

What You Should See In OpenBox​

After running the coding agent, OpenBox should show:

  • agent runs for the coding-agent workflow
  • activity boundaries for governed tool calls
  • approvals or guardrail outcomes where policy requires them
  • model usage on the agent run
  • operational telemetry associated with sandbox and tool activity

Troubleshooting​

E2B_API_KEY is missing or invalid​

Check that the runtime is loading .env.local and that the key is valid for your E2B account.

OpenBox requests are failing​

Verify:

  • OPENBOX_URL is reachable from your machine
  • OPENBOX_API_KEY is correct
  • if Require signing is enabled, OPENBOX_AGENT_DID and OPENBOX_AGENT_PRIVATE_KEY are both set for the same registered agent
  • OPENBOX_VALIDATE is set appropriately for the environment

Next Steps​