Overview
Build custom agent environments from any Docker image.
Container templates = Custom Docker environments
Saved templates (instance.snapshot()) = Workspace snapshots
Create a Template
const client = new In10ntClient();
const template = await client.templates.create({
name: 'python-ml',
image: 'python:3.11-slim',
registryType: 'dockerhub',
registryAuth: { // Optional: for private registries
username: 'user',
password: 'pass'
}
});
await template.waitUntilReady(); // Wait for build
Parameters
| Parameter | Type | Required | Description |
|---|
name | string | Yes | Human-readable template name |
image | string | Yes | Base Docker image (e.g., python:3.11-slim) |
registryType | string | Yes | Registry type: dockerhub, private, or gcr |
description | string | No | Template description |
registryAuth | object | No | Authentication for private registries |
Registry Types
dockerhub - Public Docker Hub
private - Private registries
gcr - Google Container Registry
Build Status
building → ready or failed
Wait for Build
await template.waitUntilReady({
timeout: 300000, // 5 min (default)
pollInterval: 5000 // Check every 5s
});
List & Get Templates
// List all
const templates = await client.templates.list();
// Get specific template
const template = await client.templates.get('tmpl_123');
console.log(template.status); // building | ready | failed
// Delete template
await template.delete();
Use Template
// Build template
const template = await client.templates.create({
name: 'ml-env',
image: 'python:3.11-slim',
registryType: 'dockerhub'
});
await template.waitUntilReady();
// Use it
const instance = await client.instances.create({
name: 'ml-agent',
description: 'ML tasks',
containerTemplateId: template.templateId
});
await instance.run('Train classifier');
Private Registry
const template = await client.templates.create({
name: 'private-env',
image: 'registry.example.com/myimage:latest',
registryType: 'private',
registryAuth: {
username: process.env.REGISTRY_USER,
password: process.env.REGISTRY_PASS
}
});
Use environment variables for credentials
Quick Examples
// Python
await client.templates.create({
name: 'python',
image: 'python:3.11-slim',
registryType: 'dockerhub'
});
// Node.js
await client.templates.create({
name: 'node',
image: 'node:20-alpine',
registryType: 'dockerhub'
});
// CUDA/GPU
await client.templates.create({
name: 'cuda',
image: 'nvidia/cuda:12.2-runtime',
registryType: 'dockerhub'
});
Saved Templates (Snapshots)
Saved templates are workspace snapshots created with instance.snapshot(). They are managed via client.savedTemplates:
// List saved templates
const saved = await client.savedTemplates.list();
// Delete a saved template
await client.savedTemplates.delete('old-template');
// Clone from a saved template
const clone = await client.instances.createFromSavedTemplate({
templateName: 'web-app-template',
newInstanceName: 'my-web-app-v2'
});
Template vs Saved Template
| Feature | Container Template | Saved Template |
|---|
| Method | client.templates.create() | instance.snapshot() |
| Creates | Custom Docker environment | Workspace snapshot |
| Build time | 2-5 minutes | Instant |
| Use case | Base environments | Reuse workspaces |
| Clone with | containerTemplateId in create | createFromSavedTemplate() |
HTTP API Reference
Create Template
curl -X POST https://in10t-api-v2.fly.dev/container-templates \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "python-ml",
"image": "python:3.11-slim",
"registryType": "dockerhub"
}'
List Templates
curl -H "Authorization: Bearer YOUR_API_KEY" \
https://in10t-api-v2.fly.dev/container-templates
Get Template Status
curl -H "Authorization: Bearer YOUR_API_KEY" \
https://in10t-api-v2.fly.dev/container-templates/{templateId}/status
Delete Template
curl -X DELETE https://in10t-api-v2.fly.dev/container-templates/{templateId} \
-H "Authorization: Bearer YOUR_API_KEY"
List Saved Templates
curl -H "Authorization: Bearer YOUR_API_KEY" \
https://in10t-api-v2.fly.dev/saved-templates