Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/package-smoke-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ jobs:
AGENTUITY_CATALYST_URL: https://catalyst-usc.agentuity.cloud
AGENTUITY_STREAM_URL: https://streams-usc.agentuity.cloud
AGENTUITY_KEYVALUE_URL: https://catalyst-usc.agentuity.cloud
AGENTUITY_SANDBOX_URL: https://catalyst-usc.agentuity.cloud
AGENTUITY_OBJECTSTORE_URL: https://catalyst-usc.agentuity.cloud
AGENTUITY_VECTOR_URL: https://catalyst-usc.agentuity.cloud
AGENTUITY_LOG_LEVEL: error
Expand Down Expand Up @@ -125,6 +126,7 @@ jobs:
AGENTUITY_CATALYST_URL=$AGENTUITY_CATALYST_URL
AGENTUITY_STREAM_URL=$AGENTUITY_STREAM_URL
AGENTUITY_KEYVALUE_URL=$AGENTUITY_KEYVALUE_URL
AGENTUITY_SANDBOX_URL=$AGENTUITY_SANDBOX_URL
AGENTUITY_OBJECTSTORE_URL=$AGENTUITY_OBJECTSTORE_URL
AGENTUITY_VECTOR_URL=$AGENTUITY_VECTOR_URL
AGENTUITY_LOG_LEVEL=$AGENTUITY_LOG_LEVEL
Expand Down
11 changes: 3 additions & 8 deletions apps/testing/integration-suite/scripts/get-service-urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,14 @@
*/

import { getServiceUrls } from '../../../../packages/server/src/index';
import { loadConfig } from '../../../../packages/cli/src/config';

async function main() {
// Load config to get region
let region = process.env.AGENTUITY_REGION;

if (!region) {
try {
const config = await loadConfig();
region = config.region || 'local';
} catch {
// Default to local if no config
region = 'local';
}
// Default to local if no config
region = 'local';
}

// Get service URLs for the region
Expand All @@ -27,6 +21,7 @@ async function main() {
// Output as environment variable exports for bash
console.log(`export AGENTUITY_TRANSPORT_URL="${serviceUrls.catalyst}"`);
console.log(`export AGENTUITY_KEYVALUE_URL="${serviceUrls.keyvalue}"`);
console.log(`export AGENTUITY_SANDBOX_URL="${serviceUrls.sandbox}"`);
console.log(`export AGENTUITY_STREAM_URL="${serviceUrls.stream}"`);
console.log(`export AGENTUITY_VECTOR_URL="${serviceUrls.vector}"`);
console.log(`export AGENTUITY_CATALYST_URL="${serviceUrls.catalyst}"`);
Expand Down
3 changes: 3 additions & 0 deletions apps/testing/sandbox/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.env
.env.*
node_modules
84 changes: 84 additions & 0 deletions apps/testing/sandbox/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Sandbox Test App

A simple standalone Bun app to test the `SandboxClient` from `@agentuity/server`.

## Usage

### Prerequisites

Set the required environment variables:

```bash
export AGENTUITY_SDK_KEY="your-api-key"
export AGENTUITY_REGION="local" # or "usc" for production
```

Or use a `.env.local` file (Bun auto-loads it):

```bash
AGENTUITY_SDK_KEY=your-api-key
```

### Run

```bash
# Install dependencies
bun install

# Run the test
bun run start

# Or with specific region
AGENTUITY_REGION=local bun run start
```

### What it does

1. Creates a sandbox with 512Mi memory and 500m CPU
2. Gets sandbox info
3. Executes `echo "Hello from sandbox!"`
4. Executes `ls -la`
5. Executes `uname -a`
6. Destroys the sandbox

### Expected Output

```
🚀 Starting Sandbox Test...

Environment:
AGENTUITY_SDK_KEY: ***bc73
AGENTUITY_STREAM_URL: NOT SET (using default)
AGENTUITY_REGION: local

📦 Creating sandbox...
✅ Sandbox created: sbx_abc123...
Status: creating

📋 Getting sandbox info...
ID: sbx_abc123...
Status: idle

🔧 Executing command: echo "Hello from sandbox!"
Exit code: N/A

🔧 Executing command: ls -la
Exit code: N/A

🔧 Executing command: uname -a
Exit code: N/A

🗑️ Destroying sandbox...
✅ Sandbox destroyed

✨ Sandbox test completed successfully!
```

## Environment Variables

| Variable | Description | Default |
| ------------------------ | -------------------------- | ------------- |
| `AGENTUITY_SDK_KEY` | API key for authentication | Required |
| `AGENTUITY_REGION` | Region for API endpoints | `usc` |
| `AGENTUITY_SANDBOX_URL` | Override sandbox API URL | Auto-detected |
| `AGENTUITY_CATALYST_URL` | Override catalyst API URL | Auto-detected |
67 changes: 67 additions & 0 deletions apps/testing/sandbox/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/**
* Sandbox Test App
*
* A simple standalone Bun app to test the SandboxClient from @agentuity/server.
* This creates a sandbox, executes a command, and then destroys it.
*/

import { SandboxClient } from '@agentuity/server';

async function main() {
console.log('🚀 Starting Sandbox Test...\n');

const client = new SandboxClient();

console.log('📦 Creating sandbox...');
const sandbox = await client.create({
resources: {
memory: '512Mi',
cpu: '500m',
},
});
console.log(`✅ Sandbox created: ${sandbox.id}`);
console.log(` Status: ${sandbox.status}`);

console.log('\n📋 Getting sandbox info...');
const info = await sandbox.get();
console.log(` ID: ${info.sandboxId}`);
console.log(` Status: ${info.status}`);

console.log('\n🔧 Executing command: echo "Hello from sandbox!" (piping to stdout)');
const execution = await sandbox.execute({
command: ['echo', 'Hello from sandbox!'],
pipe: {
stdout: process.stdout,
},
});
console.log(` Exit code: ${execution.exitCode ?? 'N/A'}`);

console.log('\n🔧 Executing command: ls -la (piping to stdout)');
const lsExecution = await sandbox.execute({
command: ['ls', '-la'],
pipe: {
stdout: process.stdout,
},
});
console.log(` Exit code: ${lsExecution.exitCode ?? 'N/A'}`);

console.log('\n🔧 Executing command: uname -a (piping to stdout)');
const unameExecution = await sandbox.execute({
command: ['uname', '-a'],
pipe: {
stdout: process.stdout,
},
});
console.log(` Exit code: ${unameExecution.exitCode ?? 'N/A'}`);

console.log('\n🗑️ Destroying sandbox...');
await sandbox.destroy();
console.log('✅ Sandbox destroyed');

console.log('\n✨ Sandbox test completed successfully!');
}

main().catch((error) => {
console.error('❌ Error:', error.message);
process.exit(1);
});
18 changes: 18 additions & 0 deletions apps/testing/sandbox/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "sandbox-test",
"version": "0.0.1",
"license": "Apache-2.0",
"private": true,
"type": "module",
"scripts": {
"start": "bun run index.ts",
"typecheck": "bunx tsc --noEmit"
},
"dependencies": {
"@agentuity/core": "workspace:*",
"@agentuity/server": "workspace:*"
},
"devDependencies": {
"@types/bun": "latest"
}
}
19 changes: 19 additions & 0 deletions apps/testing/sandbox/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"noEmit": true,
"resolveJsonModule": true,
"declaration": true,
"declarationMap": true,
"outDir": "dist",
"rootDir": ".",
"types": ["bun"]
},
"include": ["*.ts"],
"exclude": ["node_modules", "dist"]
}
13 changes: 13 additions & 0 deletions bun.lock
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,17 @@
"@types/react-dom": "^19.2.3",
},
},
"apps/testing/sandbox": {
"name": "sandbox-test",
"version": "0.0.1",
"dependencies": {
"@agentuity/core": "workspace:*",
"@agentuity/server": "workspace:*",
},
"devDependencies": {
"@types/bun": "latest",
},
},
"packages/auth": {
"name": "@agentuity/auth",
"version": "0.0.105",
Expand Down Expand Up @@ -2694,6 +2705,8 @@

"safer-buffer": ["safer-buffer@2.1.2", "", {}, "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="],

"sandbox-test": ["sandbox-test@workspace:apps/testing/sandbox"],

"sax": ["sax@1.4.3", "", {}, "sha512-yqYn1JhPczigF94DMS+shiDMjDowYO6y9+wB/4WgO0Y19jWYk0lQ4tuG5KI7kj4FTp1wxPj5IFfcrz/s1c3jjQ=="],

"scheduler": ["scheduler@0.27.0", "", {}, "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q=="],
Expand Down
Loading