Skip to content

feat: support for agent sandboxes#226

Draft
MichaelGoberling wants to merge 4 commits intomasterfrom
agent-sandboxes
Draft

feat: support for agent sandboxes#226
MichaelGoberling wants to merge 4 commits intomasterfrom
agent-sandboxes

Conversation

@MichaelGoberling
Copy link
Contributor

@MichaelGoberling MichaelGoberling commented Mar 19, 2026

npm install github:adobe/aio-lib-runtime#agent-sandboxes
const { init } = require('@adobe/aio-lib-runtime')

async function main () {
  const runtime = await init({
    apihost: "http://localhost",
    namespace: "test_namespace",
    api_key: "test_key"
  })

  const sandbox = await runtime.compute.sandbox.create({
    name: 'my-sandbox',
    size: 'MEDIUM',
  })

  console.log('sandbox ready:', sandbox.id)

  const status = await runtime.compute.sandbox.getStatus(sandbox.id)
  console.log('status:', status)

  const result = await sandbox.exec('echo hello from compute', { timeout: 5000 })
  console.log('stdout:', result.stdout.trim())
  console.log('exit code:', result.exitCode)

  await new Promise(resolve => setTimeout(resolve, 3000))

  console.log('executing another command...')
  const result2 = await sandbox.exec('echo hello from compute', { timeout: 5000 })
  console.log('stdout:', result2.stdout.trim())
  console.log('exit code:', result2.exitCode)

  await new Promise(resolve => setTimeout(resolve, 3000))
  
  console.log('executing another command...')
  const result3 = await sandbox.exec('echo hello from compute', { timeout: 5000 })
  console.log('stdout:', result3.stdout.trim())
  console.log('exit code:', result3.exitCode)

  await sandbox.destroy()
  console.log('sandbox destroyed')
}

main().catch(err => { console.error(err); process.exit(1) })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant