Skip to content

DigitalOcean.Agents reference

Source: packages/digitalocean/src/Agents/CreateSession.ts

Starts Harness Runtime agent sessions from an environment config at run time: each session gets an isolated sandbox running the config’s agent. DigitalOcean has no API to mint a token a runtime could use, so pass one (a personal access token with the agents scopes); it reaches the host as a secret.

const Coder = DigitalOcean.Agents.EnvironmentConfig("coder", {
manifest: {
apiVersion: "agents.digitalocean.com/v1alpha1",
kind: "Agent",
spec: { runtime: { adapter: "opencode" } },
},
});
export default class Api extends DigitalOcean.App<Api>()(
"Api",
{ main: import.meta.url },
Effect.gen(function* () {
const env = yield* Coder;
const token = yield* Config.Redacted("DO_AGENTS_TOKEN");
const sessions = yield* DigitalOcean.Agents.CreateSession(env, { token });
return {
fetch: Effect.gen(function* () {
const session = yield* Effect.acquireRelease(sessions.create(), (s) =>
Effect.ignore(s.delete),
);
yield* session.send("Write hello.txt containing 'hi'.");
const out = yield* session.exec(["cat", "hello.txt"]);
return HttpServerResponse.text(out.stdout);
}).pipe(Effect.orDie),
};
}).pipe(Effect.provide(DigitalOcean.Agents.CreateSessionHttp)),
) {}

Source: packages/digitalocean/src/Agents/CreateSessionHttp.ts Kind: Layer · Provides: DigitalOcean.Agents.CreateSession

CreateSession over the Harness Runtime API, signed with the token the host was given.

Source: packages/digitalocean/src/Agents/EnvironmentConfig.ts

A Harness Runtime environment config: the immutable spec of an agent environment (runtime adapter, sandbox, tools, secrets) that sessions start from. DigitalOcean never updates a config, so any change replaces it; a replaced config stays resolvable for sessions already running on it.

EnvironmentConfig: Defining an Environment

Section titled “EnvironmentConfig: Defining an Environment”
const env = yield* DigitalOcean.Agents.EnvironmentConfig("coder", {
manifest: {
apiVersion: "agents.digitalocean.com/v1alpha1",
kind: "Agent",
spec: { runtime: { adapter: "opencode" } },
},
});

Source: packages/digitalocean/src/Agents/Template.ts

A custom Harness Runtime sandbox template: an OCI image built on one of DigitalOcean’s agent bases. Environment specs refer to it by name. A new image or baseTemplate rebuilds it in place.

yield* DigitalOcean.Agents.Template("tools", {
baseTemplate: "coding-claude-code",
image: "ghcr.io/acme/agent-tools:1.4.0",
});

Source: packages/digitalocean/src/Agents/Trigger.ts

A Harness Runtime trigger: starts an agent run in a fresh session on a cron schedule or on each webhook delivery, and sends its output by email, to Slack, or nowhere. The schedule, prompt, session spec and output update in place; switching between cron and webhook replaces the trigger.

yield* DigitalOcean.Agents.Trigger("standup", {
cron: { expression: "0 9 * * 1-5", timeZone: "America/New_York" },
prompt: "Summarize yesterday's merged pull requests.",
session: {
apiVersion: "agents.digitalocean.com/v1alpha1",
kind: "Agent",
spec: { runtime: { adapter: "opencode" }, permissions: { defaultAction: "allow" } },
},
output: { mode: "email", email: "team@example.com" },
});