Deploy an agent from an OCI image that serves the invocation contract. Creating the agent creates its first revision and makes it active. No sandbox starts until the first session.
Not available yet.
Not available yet.
#!/usr/bin/env bash
set -euo pipefail
# Assumes you ran `anchor auth login` (see the Quickstart).
cat > anchor.yaml <<'YAML'
app: support-bot
image: ghcr.io/acme/support-bot:1.0
processes:
web:
command: ["/app/server"]
env:
PORT: "8080"
ports:
- name: http
target: 8080
protocol: http
health:
path: /ping
listeners:
http:
process: web
port: 8080
access: public
resources:
cpu: 1
memoryMiB: 1024
diskMiB: 2048
YAML
# Creates the app, starts it and prints its URL.
anchor app deploy --file anchor.yamlimport { Sutra } from "@mistrive/sutra";
const sutra = new Sutra({
baseUrl: "https://anchor.jgcp.mistrivedev.com",
});
const agent = await sutra.agents.create({
id: "support-bot",
revision: {
// The image serves POST /invocations and GET /ping on port 8080.
protocol: "HTTP",
sandbox: {
source: { image: "ghcr.io/acme/support-bot:1.0" },
resources: { milliCpus: 1000, memoryBytes: 1024 ** 3, diskBytes: 2 * 1024 ** 3 },
// Each session's sandbox stops after 15 minutes without activity.
lifecycle: { idleTimeout: { seconds: 900, action: "STOP" } },
},
processes: { server: { argv: ["/app/server"] } },
sessionVolume: { mountPath: "/data", sizeBytes: 1024 ** 3 },
},
});
console.log(agent.uri);from mistrive.sutra import Sutra
sutra = Sutra(
base_url="https://anchor.jgcp.mistrivedev.com",
)
agent = sutra.agents.create(
id="support-bot",
revision={
# The image serves POST /invocations and GET /ping on port 8080.
"protocol": "HTTP",
"sandbox": {
"source": {"image": "ghcr.io/acme/support-bot:1.0"},
"resources": {"milli_cpus": 1000, "memory_bytes": 1024**3, "disk_bytes": 2 * 1024**3},
# Each session's sandbox stops after 15 minutes without activity.
"lifecycle": {"idle_timeout": {"seconds": 900, "action": "STOP"}},
},
"processes": {"server": {"argv": ["/app/server"]}},
"session_volume": {"mount_path": "/data", "size_bytes": 1024**3},
},
)
print(agent.uri)#!/usr/bin/env bash
set -euo pipefail
# Assumes you ran `sutra auth login` (see the Quickstart).
# The image serves POST /invocations and GET /ping on port 8080.
sutra agents create support-bot \
--image ghcr.io/acme/support-bot:1.0 \
--protocol http \
--idle-timeout 15m \
--session-volume /data:1GiB \
-- /app/serverWhat a revision holds
| Field | What it sets |
|---|---|
protocol |
HTTP or MCP. See Invocation contract. |
sandbox |
The sandbox each session gets: source (an image, template or snapshot), resources, env, volumes, ports, lifecycle, network and integrations. |
processes |
Named processes that start in each session’s sandbox. |
sessionVolume |
A volume each session keeps across stops, and where it is mounted. |
Set the idle timeout with sandbox.lifecycle.idleTimeout. It decides how long a session stays up without requests.
Change an agent
A revision never changes. To deploy a new image or new settings, create a revision with agent.revisions.create and make it active with agent.update({ activeRevision }). New sessions use it; running sessions finish on the revision they started with. To roll back, make the earlier revision active again. See Revisions.
Delete the agent with agent.delete(). This stops and deletes every session’s sandbox.