withruntime 0.35.0 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BLAXEL.md +207 -204
- package/COMPATIBILITY.md +367 -337
- package/DAYTONA.md +180 -173
- package/E2B.md +246 -230
- package/README.md +182 -142
- package/README.src.md +182 -142
- package/VERCEL.md +173 -168
- package/agent-platforms-inventory.json +387 -0
- package/dist/agents-cli.d.ts +7 -1
- package/dist/agents-cli.js +470 -6
- package/dist/agents-deploy.d.ts +1 -1
- package/dist/agents-deploy.js +62 -1
- package/dist/apps-cli.d.ts +3 -3
- package/dist/apps-cli.js +10 -5
- package/dist/browsers-cli.d.ts +1 -1
- package/dist/browsers-cli.js +122 -3
- package/dist/ci-cli.d.ts +11 -1
- package/dist/ci-cli.js +69 -6
- package/dist/cli-update.d.ts +11 -0
- package/dist/cli-update.js +46 -0
- package/dist/cli-words.js +1 -0
- package/dist/cli.d.ts +4 -6
- package/dist/cli.js +249 -58
- package/dist/daytona/daytona.js +1 -1
- package/dist/e2b/sandbox.d.ts +6 -5
- package/dist/e2b/sandbox.js +6 -5
- package/dist/errors.d.ts +4 -3
- package/dist/errors.js +7 -3
- package/dist/index.d.ts +5 -5
- package/dist/inngest/index.d.ts +96 -0
- package/dist/inngest/index.js +183 -0
- package/dist/jobs-code/cron.d.ts +12 -0
- package/dist/jobs-code/cron.js +93 -0
- package/dist/jobs-code/registry.d.ts +31 -0
- package/dist/jobs-code/registry.js +30 -0
- package/dist/jobs-code/runner.d.ts +1 -0
- package/dist/jobs-code/runner.js +74 -0
- package/dist/jobs-deploy.d.ts +22 -0
- package/dist/jobs-deploy.js +247 -0
- package/dist/jobs-import.d.ts +15 -0
- package/dist/jobs-import.js +231 -0
- package/dist/products/agents.d.ts +413 -2
- package/dist/products/agents.js +176 -0
- package/dist/products/apps.d.ts +2 -1
- package/dist/products/browsers.d.ts +87 -0
- package/dist/products/browsers.js +67 -0
- package/dist/products/builds.d.ts +11 -2
- package/dist/products/ci.d.ts +21 -1
- package/dist/products/jobs.d.ts +77 -0
- package/dist/products/jobs.js +5 -0
- package/dist/products/observability.d.ts +31 -3
- package/dist/products/plans.d.ts +5 -3
- package/dist/products/secrets.d.ts +67 -14
- package/dist/products/secrets.js +41 -12
- package/dist/transport.d.ts +6 -1
- package/dist/transport.js +38 -1
- package/dist/trigger/index.d.ts +202 -0
- package/dist/trigger/index.js +244 -0
- package/dist/types.d.ts +14 -0
- package/package.json +14 -3
|
@@ -65,6 +65,13 @@ export type AgentDefinition = {
|
|
|
65
65
|
volume: string;
|
|
66
66
|
path: string;
|
|
67
67
|
}[];
|
|
68
|
+
/** Where each session's sandbox may connect, enforced by its network
|
|
69
|
+
* rules from its first packet: with allow, only those hosts. Absent:
|
|
70
|
+
* anywhere. */
|
|
71
|
+
network?: {
|
|
72
|
+
internet: boolean;
|
|
73
|
+
allow?: string[];
|
|
74
|
+
};
|
|
68
75
|
/** How long a session's sandbox runs with nothing happening before it
|
|
69
76
|
* pauses; default 60. */
|
|
70
77
|
idlePauseSeconds?: number;
|
|
@@ -85,6 +92,93 @@ export type AgentDefinition = {
|
|
|
85
92
|
memory?: {
|
|
86
93
|
scope: "key" | "agent";
|
|
87
94
|
};
|
|
95
|
+
/** The model the harness runs (claude-opus-5-5, gpt-5.1-codex,
|
|
96
|
+
* gemini-3-pro); absent, the harness's default. The harness reads it as
|
|
97
|
+
* RUNTIME_AGENT_MODEL, and Claude Code, the Claude Agent SDK, Codex,
|
|
98
|
+
* Gemini CLI and the OpenAI Agents SDK each by their own setting. */
|
|
99
|
+
model?: string;
|
|
100
|
+
/** What a session's start may override (`StartAgentSession.overrides`). */
|
|
101
|
+
sessionOverrides?: AgentSessionOverrideLimits;
|
|
102
|
+
/** Child sessions its tree may hold open at once, a workflow's steps
|
|
103
|
+
* from inside it included: 1 to 1000, default 100. */
|
|
104
|
+
maxChildren?: number;
|
|
105
|
+
/** A second model a session asks for advice mid-task (`advise` in the
|
|
106
|
+
* sandbox). Each question and answer is kept in the session's log as a
|
|
107
|
+
* `note` whose body holds `advice`. */
|
|
108
|
+
advisor?: AgentAdvisor;
|
|
109
|
+
/** Which tool calls of the harness run, wait for a person, or are
|
|
110
|
+
* refused. Each call is a `tool_call` event in the session's log; one that
|
|
111
|
+
* waits is an ask of the inbox with the options Allow and Deny
|
|
112
|
+
* (`agents.asks.approve`, `agents.asks.deny`), and only that call waits.
|
|
113
|
+
* Absent: every call runs. */
|
|
114
|
+
permissions?: AgentPermissions;
|
|
115
|
+
};
|
|
116
|
+
/** The limits an agent's owner sets on its sessions' overrides. A session
|
|
117
|
+
* may always narrow its MCP servers and disallow tools. */
|
|
118
|
+
export type AgentSessionOverrideLimits = {
|
|
119
|
+
/** The models a session may name; absent, any. */
|
|
120
|
+
models?: string[];
|
|
121
|
+
/** Whether a session may add to the agent's instructions (`append`, the
|
|
122
|
+
* default), also replace them (`replace`), or neither (`none`). */
|
|
123
|
+
instructions?: "append" | "replace" | "none";
|
|
124
|
+
/** The most vCPU a session may ask for; absent, the agent's `vcpu`. */
|
|
125
|
+
maxVcpu?: number;
|
|
126
|
+
/** The most memory a session may ask for; absent, the agent's `memoryMiB`. */
|
|
127
|
+
maxMemoryMiB?: number;
|
|
128
|
+
/** The most budget a session may ask for; absent, the agent's `maxSessionDollars`. */
|
|
129
|
+
maxSessionDollars?: number;
|
|
130
|
+
};
|
|
131
|
+
/** One session's own model, instructions, MCP servers, disallowed tools,
|
|
132
|
+
* size and budget, within its agent's `sessionOverrides`. Recorded on the
|
|
133
|
+
* session (`overrides`) and noted in its log. */
|
|
134
|
+
export type AgentSessionOverrides = {
|
|
135
|
+
/** The model the harness runs for this session. */
|
|
136
|
+
model?: string;
|
|
137
|
+
/** Added after the agent's instructions, or in their place with
|
|
138
|
+
* `instructionsMode: "replace"`; at most 64 KiB with the agent's. */
|
|
139
|
+
instructions?: string;
|
|
140
|
+
/** `append` (the default) or `replace`. */
|
|
141
|
+
instructionsMode?: "append" | "replace";
|
|
142
|
+
/** Names of the agent's MCP servers this session keeps; `[]` keeps none. */
|
|
143
|
+
mcp?: string[];
|
|
144
|
+
/** Tools the harness may not use: Runtime's own (`spawn`, `pr`, `ask`,
|
|
145
|
+
* `remember`, ...; never `wait`, `reply` or `done`) and the harness's
|
|
146
|
+
* (Claude Code's `Bash` or `mcp__github`, Gemini CLI's `run_shell_command`). */
|
|
147
|
+
disallowedTools?: string[];
|
|
148
|
+
/** At most the agent's `sessionOverrides.maxVcpu`, else its own `vcpu`. */
|
|
149
|
+
vcpu?: number;
|
|
150
|
+
/** At most the agent's `sessionOverrides.maxMemoryMiB`, else its own. */
|
|
151
|
+
memoryMiB?: number;
|
|
152
|
+
/** This session's budget, its subagents included; at most the agent's
|
|
153
|
+
* `sessionOverrides.maxSessionDollars`, else its own. */
|
|
154
|
+
maxSessionDollars?: number;
|
|
155
|
+
};
|
|
156
|
+
/** always_allow: the call runs. always_ask: it waits for a person's Allow or
|
|
157
|
+
* Deny. auto: Runtime reads the call and runs it, refuses it (high_risk) or
|
|
158
|
+
* holds it for a person (indeterminate). */
|
|
159
|
+
export type AgentPermissionPolicy = "always_allow" | "always_ask" | "auto";
|
|
160
|
+
export type AgentPermissions = {
|
|
161
|
+
/** Default always_allow. */
|
|
162
|
+
default?: AgentPermissionPolicy;
|
|
163
|
+
/** By the most particular name that matches: the harness's own tool name
|
|
164
|
+
* (Bash, Edit, apply_patch, run_shell_command, mcp__github__create_issue),
|
|
165
|
+
* an MCP server (mcp:github), or a family (shell, edit, read, web, mcp). */
|
|
166
|
+
tools?: Record<string, AgentPermissionPolicy>;
|
|
167
|
+
};
|
|
168
|
+
export type AgentAdvisor = {
|
|
169
|
+
/** claude-opus-5-5, gpt-5.5, gemini-3-pro, or an OpenRouter name. */
|
|
170
|
+
model: string;
|
|
171
|
+
/** Read from the model's name when left out. */
|
|
172
|
+
provider?: "anthropic" | "openai" | "google" | "openrouter" | "openai-compatible";
|
|
173
|
+
/** The egress secret its key is, which must be in `secrets` or `pool`;
|
|
174
|
+
* the provider's usual one when left out (ANTHROPIC_API_KEY, ...). */
|
|
175
|
+
secret?: string;
|
|
176
|
+
/** An OpenAI-compatible endpoint, or another host for the provider's API. */
|
|
177
|
+
baseUrl?: string;
|
|
178
|
+
/** Advice a session may ask for: 1 to 200, default 20. */
|
|
179
|
+
maxCalls?: number;
|
|
180
|
+
/** The advisor's standing words, at most 16 KiB. */
|
|
181
|
+
instructions?: string;
|
|
88
182
|
};
|
|
89
183
|
export type Agent = {
|
|
90
184
|
id: string;
|
|
@@ -119,13 +213,22 @@ export type AgentSession = {
|
|
|
119
213
|
sandboxId: string | null;
|
|
120
214
|
lastSeq: number;
|
|
121
215
|
labels: Record<string, string>;
|
|
216
|
+
/** What its start overrode of its agent's definition, as given; null,
|
|
217
|
+
* nothing. */
|
|
218
|
+
overrides: AgentSessionOverrides | null;
|
|
219
|
+
/** The workflow it is a step of, or null. */
|
|
220
|
+
workflowId: string | null;
|
|
122
221
|
createdAt: string;
|
|
123
222
|
startedAt: string | null;
|
|
124
223
|
endedAt: string | null;
|
|
125
224
|
};
|
|
126
225
|
export type AgentEvent = {
|
|
127
226
|
seq: number;
|
|
128
|
-
|
|
227
|
+
/** turn and tool: a model turn and a tool call of the session's trace,
|
|
228
|
+
* the span in body (`AgentTurn`, `AgentToolCall`). tool_call: one call
|
|
229
|
+
* the harness made under the agent's permissions, body {text, tool,
|
|
230
|
+
* input, toolUseId, evaluatedPermission, evaluation, askId}. */
|
|
231
|
+
kind: "input" | "answer" | "reply" | "ask" | "status" | "result" | "error" | "note" | "child" | "turn" | "tool" | "tool_call";
|
|
129
232
|
/** A key's principal id, slack:<user>, github:<login>, agent (the
|
|
130
233
|
* harness) or runtime. */
|
|
131
234
|
actor: string;
|
|
@@ -135,6 +238,95 @@ export type AgentEvent = {
|
|
|
135
238
|
} & Record<string, unknown>;
|
|
136
239
|
createdAt: string;
|
|
137
240
|
};
|
|
241
|
+
/** Token counts and their cost at the provider's list price, in USD. */
|
|
242
|
+
export type AgentTokens = {
|
|
243
|
+
/** Input tokens not read from or written to the prompt cache. */
|
|
244
|
+
inputTokens: number;
|
|
245
|
+
outputTokens: number;
|
|
246
|
+
cacheReadTokens: number;
|
|
247
|
+
cacheWriteTokens: number;
|
|
248
|
+
costUsd: number;
|
|
249
|
+
};
|
|
250
|
+
/** One model request the session's harness made. */
|
|
251
|
+
export type AgentTurn = Omit<AgentTokens, "costUsd"> & {
|
|
252
|
+
seq: number;
|
|
253
|
+
kind: "turn";
|
|
254
|
+
/** 16 hex digits; a tool call's `turn` names it. */
|
|
255
|
+
id: string;
|
|
256
|
+
provider: "anthropic" | "openai" | "google" | "other";
|
|
257
|
+
model: string;
|
|
258
|
+
startedAt: string;
|
|
259
|
+
durationMs: number;
|
|
260
|
+
/** Until the first bytes of the answer. */
|
|
261
|
+
firstTokenMs: number | null;
|
|
262
|
+
/** null for a model with no list price known. */
|
|
263
|
+
costUsd: number | null;
|
|
264
|
+
stopReason: string | null;
|
|
265
|
+
/** The model API's HTTP status. */
|
|
266
|
+
status: number;
|
|
267
|
+
error: string | null;
|
|
268
|
+
toolCalls: {
|
|
269
|
+
id: string;
|
|
270
|
+
name: string;
|
|
271
|
+
}[];
|
|
272
|
+
};
|
|
273
|
+
/** One tool call: from the turn that asked for it to the request that
|
|
274
|
+
* carried its result back. */
|
|
275
|
+
export type AgentToolCall = {
|
|
276
|
+
seq: number;
|
|
277
|
+
kind: "tool";
|
|
278
|
+
id: string;
|
|
279
|
+
name: string;
|
|
280
|
+
turn: string | null;
|
|
281
|
+
startedAt: string;
|
|
282
|
+
durationMs: number;
|
|
283
|
+
/** The call's input and output, each at most 2,000 characters. */
|
|
284
|
+
input: string;
|
|
285
|
+
output: string;
|
|
286
|
+
error: boolean;
|
|
287
|
+
};
|
|
288
|
+
/** A page of a session's trace: the whole session's totals, by model and
|
|
289
|
+
* by tool, and up to `limit` spans after `after`. Read the next page with
|
|
290
|
+
* `after: nextAfter` until it is null. */
|
|
291
|
+
export type AgentTrace = {
|
|
292
|
+
sessionId: string;
|
|
293
|
+
totals: AgentTokens & {
|
|
294
|
+
turns: number;
|
|
295
|
+
toolCalls: number;
|
|
296
|
+
unpricedTurns: number;
|
|
297
|
+
failedTurns: number;
|
|
298
|
+
failedToolCalls: number;
|
|
299
|
+
modelMs: number;
|
|
300
|
+
toolMs: number;
|
|
301
|
+
};
|
|
302
|
+
models: (AgentTokens & {
|
|
303
|
+
model: string;
|
|
304
|
+
provider: string;
|
|
305
|
+
turns: number;
|
|
306
|
+
unpricedTurns: number;
|
|
307
|
+
})[];
|
|
308
|
+
tools: {
|
|
309
|
+
name: string;
|
|
310
|
+
calls: number;
|
|
311
|
+
failed: number;
|
|
312
|
+
durationMs: number;
|
|
313
|
+
}[];
|
|
314
|
+
spans: (AgentTurn | AgentToolCall)[];
|
|
315
|
+
/** The seq to read the next page after; null when the log held no more. */
|
|
316
|
+
nextAfter: number | null;
|
|
317
|
+
};
|
|
318
|
+
/** OTLP/JSON: an ExportTraceServiceRequest of one page, to POST to a
|
|
319
|
+
* collector's /v1/traces; the first page holds the session's root span. */
|
|
320
|
+
export type AgentTraceOtlp = {
|
|
321
|
+
resourceSpans: Record<string, unknown>[];
|
|
322
|
+
nextAfter: number | null;
|
|
323
|
+
};
|
|
324
|
+
/** Which page of a trace: spans after `after` (0 by default), at most
|
|
325
|
+
* `limit` (200 by default, 500 at most). */
|
|
326
|
+
export type AgentTracePage = {
|
|
327
|
+
after?: number;
|
|
328
|
+
limit?: number;
|
|
329
|
+
};
|
|
138
330
|
export type AgentAskState = "open" | "answered" | "expired" | "withdrawn" | "closed";
|
|
139
331
|
/** One row of the account's inbox: a question a session's harness needs
|
|
140
332
|
* answered to go on. Asks of one agent's sessions sharing a memory, with the same `step` are
|
|
@@ -178,6 +370,20 @@ export type AgentAsk = {
|
|
|
178
370
|
createdAt: string;
|
|
179
371
|
updatedAt: string;
|
|
180
372
|
closedAt: string | null;
|
|
373
|
+
/** The tool call it holds, answered Allow or Deny; null for any other ask. */
|
|
374
|
+
toolCall: AgentAskToolCall | null;
|
|
375
|
+
};
|
|
376
|
+
/** A tool call the agent's permissions hold for a person. */
|
|
377
|
+
export type AgentAskToolCall = {
|
|
378
|
+
/** The harness's name for it: Bash, apply_patch, mcp__github__create_issue. */
|
|
379
|
+
tool: string;
|
|
380
|
+
input: Record<string, unknown>;
|
|
381
|
+
toolUseId?: string;
|
|
382
|
+
/** Its tool_call event in the session's log. */
|
|
383
|
+
seq?: number;
|
|
384
|
+
policy: "always_ask" | "auto";
|
|
385
|
+
/** Why auto held it: indeterminate. */
|
|
386
|
+
reasonCode?: string;
|
|
181
387
|
};
|
|
182
388
|
export type ListAgentAsks = {
|
|
183
389
|
/** Open by default. */
|
|
@@ -194,6 +400,18 @@ export type AnswerAgentAsk = {
|
|
|
194
400
|
text?: string;
|
|
195
401
|
};
|
|
196
402
|
export type AgentTriggerKind = "slack" | "github" | "schedule" | "webhook";
|
|
403
|
+
/** The link that adds Runtime's Slack app to a workspace. */
|
|
404
|
+
export type SlackInstallLink = {
|
|
405
|
+
url: string;
|
|
406
|
+
expiresAt: string;
|
|
407
|
+
};
|
|
408
|
+
/** A Slack workspace added to the account: its id is a slack trigger's `team`. */
|
|
409
|
+
export type SlackTeam = {
|
|
410
|
+
team: string;
|
|
411
|
+
name: string | null;
|
|
412
|
+
botUser: string;
|
|
413
|
+
installedAt: string;
|
|
414
|
+
};
|
|
197
415
|
/** A trigger's rules, each optional. */
|
|
198
416
|
export type AgentTriggerRules = {
|
|
199
417
|
/** Queue order of its sessions when the agent's maxConcurrent is full:
|
|
@@ -239,6 +457,12 @@ export type StartAgentSession = {
|
|
|
239
457
|
* request, one of your customers (`customer:42`). */
|
|
240
458
|
key?: string;
|
|
241
459
|
labels?: Record<string, string>;
|
|
460
|
+
/** This session's own model, instructions, MCP servers, disallowed tools,
|
|
461
|
+
* size and budget, within the agent's `sessionOverrides`: one it does not
|
|
462
|
+
* allow is refused (`permission_denied`, naming what it allows). Words
|
|
463
|
+
* that join an open session carry its own overrides or none (else
|
|
464
|
+
* `conflict`). */
|
|
465
|
+
overrides?: AgentSessionOverrides;
|
|
242
466
|
};
|
|
243
467
|
export type CreateAgentTrigger = ({
|
|
244
468
|
kind: "slack";
|
|
@@ -304,7 +528,7 @@ export type AgentHeldCall = {
|
|
|
304
528
|
resolvedAt: string | null;
|
|
305
529
|
};
|
|
306
530
|
/** The harnesses' names, so `templates["claude-code"]` is known to be there. */
|
|
307
|
-
export type AgentTemplateKey = "claude-code" | "codex" | "gemini-cli" | "claude-agent-sdk" | "openai-agents-sdk" | "review" | "judge";
|
|
531
|
+
export type AgentTemplateKey = "claude-code" | "codex" | "gemini-cli" | "claude-agent-sdk" | "openai-agents-sdk" | "review" | "judge" | "browser";
|
|
308
532
|
/** A file of an agent's memory (`memory.list`). `scope` is whose: empty for
|
|
309
533
|
* the shared memory, which every session reads (one keeping memory per key
|
|
310
534
|
* reads what you wrote there, and never changes it), or a session key
|
|
@@ -384,6 +608,120 @@ export declare const AGENT_TEMPLATES: Readonly<Record<AgentTemplateKey, AgentTem
|
|
|
384
608
|
/** A harness by a key read from a file or a flag, or undefined. */
|
|
385
609
|
export declare function agentTemplate(key: string): AgentTemplate | undefined;
|
|
386
610
|
export declare const AGENT_USES: Readonly<Record<"support" | "team", AgentUse>>;
|
|
611
|
+
/** One phase of a workflow. */
|
|
612
|
+
export type AgentWorkflowPhase = {
|
|
613
|
+
/** A letter, then letters, digits, _ or -; {{<name>}} reads its results. */
|
|
614
|
+
name: string;
|
|
615
|
+
/** Its sessions' agent, by id or name; the workflow's when left out. */
|
|
616
|
+
agent?: string;
|
|
617
|
+
/** Each session's first words: {{input}}, {{item}}, {{index}} (1-based)
|
|
618
|
+
* and {{<earlier phase>}} (its results, numbered) are filled in. */
|
|
619
|
+
input: string;
|
|
620
|
+
/** A list to fan out over (1 to 1000 items, one session each), or an
|
|
621
|
+
* earlier phase's results split: `json`, the JSON array in each result;
|
|
622
|
+
* `lines`, its non-empty lines. Absent: one session. */
|
|
623
|
+
each?: unknown[] | {
|
|
624
|
+
from: string;
|
|
625
|
+
split?: "json" | "lines";
|
|
626
|
+
};
|
|
627
|
+
/** With `each.from`: start each item the moment its source session ends. */
|
|
628
|
+
pipeline?: boolean;
|
|
629
|
+
};
|
|
630
|
+
/** Many sessions in phases, as one piece of work. */
|
|
631
|
+
export type RunAgentWorkflow = {
|
|
632
|
+
name?: string;
|
|
633
|
+
/** The agent of every phase that names none. */
|
|
634
|
+
agent?: string;
|
|
635
|
+
/** What {{input}} is. */
|
|
636
|
+
input?: string;
|
|
637
|
+
labels?: Record<string, string>;
|
|
638
|
+
/** Sessions it may start in all: 1 to 1000, default 100. */
|
|
639
|
+
maxSessions?: number;
|
|
640
|
+
/** Its sessions open at once: 1 to 200, default 20. */
|
|
641
|
+
maxConcurrent?: number;
|
|
642
|
+
/** What it may cost in all, in dollars: default 10. */
|
|
643
|
+
maxDollars?: number;
|
|
644
|
+
phases: AgentWorkflowPhase[];
|
|
645
|
+
};
|
|
646
|
+
export type AgentWorkflowState = "running" | "done" | "failed" | "stopped";
|
|
647
|
+
export type AgentWorkflow = {
|
|
648
|
+
id: string;
|
|
649
|
+
name: string | null;
|
|
650
|
+
state: AgentWorkflowState;
|
|
651
|
+
/** Why it ended: done, steps_failed, max_sessions, budget, stopped,
|
|
652
|
+
* parent_ended, quota, subagent_quota, agent_gone, permission_denied. */
|
|
653
|
+
reason: string | null;
|
|
654
|
+
/** Its last phase's result: one session's as it is, several as a JSON
|
|
655
|
+
* array of their results. */
|
|
656
|
+
result: string | null;
|
|
657
|
+
/** The session that ran it from inside its sandbox, or null. */
|
|
658
|
+
parentSessionId: string | null;
|
|
659
|
+
spec: RunAgentWorkflow;
|
|
660
|
+
maxSessions: number;
|
|
661
|
+
maxConcurrent: number;
|
|
662
|
+
maxDollars: number;
|
|
663
|
+
/** Sessions it has started. */
|
|
664
|
+
started: number;
|
|
665
|
+
/** Raised at every change. */
|
|
666
|
+
version: number;
|
|
667
|
+
labels: Record<string, string>;
|
|
668
|
+
phases: {
|
|
669
|
+
name: string;
|
|
670
|
+
agentId: string;
|
|
671
|
+
/** Items known so far; final once `ready`. */
|
|
672
|
+
total: number;
|
|
673
|
+
ready: boolean;
|
|
674
|
+
pending: number;
|
|
675
|
+
running: number;
|
|
676
|
+
done: number;
|
|
677
|
+
/** Failed, stopped or skipped. */
|
|
678
|
+
failed: number;
|
|
679
|
+
}[];
|
|
680
|
+
cost: {
|
|
681
|
+
dollars: number;
|
|
682
|
+
vcpuSeconds: number;
|
|
683
|
+
gibSeconds: number;
|
|
684
|
+
};
|
|
685
|
+
createdAt: string;
|
|
686
|
+
updatedAt: string;
|
|
687
|
+
endedAt: string | null;
|
|
688
|
+
};
|
|
689
|
+
export type AgentWorkflowStep = {
|
|
690
|
+
phase: string;
|
|
691
|
+
item: number;
|
|
692
|
+
/** What {{item}} was. */
|
|
693
|
+
itemText: string | null;
|
|
694
|
+
state: "pending" | "running" | "done" | "failed" | "stopped" | "skipped";
|
|
695
|
+
reason: string | null;
|
|
696
|
+
/** What its session ended with. */
|
|
697
|
+
result: string | null;
|
|
698
|
+
sessionId: string | null;
|
|
699
|
+
createdAt: string;
|
|
700
|
+
startedAt: string | null;
|
|
701
|
+
endedAt: string | null;
|
|
702
|
+
};
|
|
703
|
+
/** One workflow, to follow and stop. */
|
|
704
|
+
export type AgentWorkflowHandle = {
|
|
705
|
+
readonly id: string;
|
|
706
|
+
/** The workflow as it was when run or read. */
|
|
707
|
+
readonly workflow: AgentWorkflow;
|
|
708
|
+
/** The workflow at each change, as it happens, until it has ended. */
|
|
709
|
+
follow(options?: {
|
|
710
|
+
after?: number;
|
|
711
|
+
signal?: AbortSignal;
|
|
712
|
+
}): AsyncGenerator<AgentWorkflow>;
|
|
713
|
+
/** Until it has ended; answers it then, with its result. */
|
|
714
|
+
wait(options?: {
|
|
715
|
+
signal?: AbortSignal;
|
|
716
|
+
}): Promise<AgentWorkflow>;
|
|
717
|
+
/** Its steps in phase and item order. */
|
|
718
|
+
steps(query?: {
|
|
719
|
+
state?: AgentWorkflowStep["state"][];
|
|
720
|
+
limit?: number;
|
|
721
|
+
}, options?: RequestOptions): Promise<Page<AgentWorkflowStep>>;
|
|
722
|
+
stop(options?: RequestOptions): Promise<AgentWorkflow>;
|
|
723
|
+
get(options?: RequestOptions): Promise<AgentWorkflow>;
|
|
724
|
+
};
|
|
387
725
|
/** One session, to talk to and follow. */
|
|
388
726
|
export type AgentSessionHandle = {
|
|
389
727
|
readonly id: string;
|
|
@@ -404,6 +742,13 @@ export type AgentSessionHandle = {
|
|
|
404
742
|
signal?: AbortSignal;
|
|
405
743
|
}): AsyncGenerator<AgentEvent>;
|
|
406
744
|
stop(options?: RequestOptions): Promise<AgentSession>;
|
|
745
|
+
/** A page of its trace: every model turn and tool call, with timing,
|
|
746
|
+
* tokens and cost, and the session's totals; `{ format: "otlp" }` for
|
|
747
|
+
* OpenTelemetry traces. */
|
|
748
|
+
trace(options?: RequestOptions & AgentTracePage): Promise<AgentTrace>;
|
|
749
|
+
trace(options: RequestOptions & AgentTracePage & {
|
|
750
|
+
format: "otlp";
|
|
751
|
+
}): Promise<AgentTraceOtlp>;
|
|
407
752
|
/** Until it has ended; answers it then. */
|
|
408
753
|
wait(options?: {
|
|
409
754
|
signal?: AbortSignal;
|
|
@@ -411,6 +756,13 @@ export type AgentSessionHandle = {
|
|
|
411
756
|
get(options?: RequestOptions): Promise<AgentSession>;
|
|
412
757
|
};
|
|
413
758
|
export declare function agents(t: Transport): {
|
|
759
|
+
/** Claude Managed Agents' API on Runtime: the options Anthropic's SDK
|
|
760
|
+
* takes, so code written for it runs here unchanged:
|
|
761
|
+
* `new Anthropic(await runtime.agents.anthropic())`. */
|
|
762
|
+
anthropic: () => Promise<{
|
|
763
|
+
baseURL: string;
|
|
764
|
+
apiKey: string;
|
|
765
|
+
}>;
|
|
414
766
|
/** An agent: a name and a definition its sessions start from. */
|
|
415
767
|
create: (input: CreateAgent, options?: RequestOptions) => Promise<Agent>;
|
|
416
768
|
/** By its id or its name. */
|
|
@@ -430,6 +782,15 @@ export declare function agents(t: Transport): {
|
|
|
430
782
|
session(id: string, options?: RequestOptions): Promise<AgentSessionHandle>;
|
|
431
783
|
sessions: {
|
|
432
784
|
get: (id: string, options?: RequestOptions) => Promise<AgentSession>;
|
|
785
|
+
/** A session's trace: every model turn and tool call with its timing,
|
|
786
|
+
* tokens and cost, totals by model and tool; `{ format: "otlp" }` for
|
|
787
|
+
* OpenTelemetry traces in the GenAI semantic conventions. */
|
|
788
|
+
trace: {
|
|
789
|
+
(id: string, options?: RequestOptions & AgentTracePage): Promise<AgentTrace>;
|
|
790
|
+
(id: string, options: RequestOptions & AgentTracePage & {
|
|
791
|
+
format: "otlp";
|
|
792
|
+
}): Promise<AgentTraceOtlp>;
|
|
793
|
+
};
|
|
433
794
|
/** Newest first; of one agent, or in some states. */
|
|
434
795
|
list: (query?: {
|
|
435
796
|
agent?: string;
|
|
@@ -442,6 +803,37 @@ export declare function agents(t: Transport): {
|
|
|
442
803
|
* (`session_open`): stop it first. */
|
|
443
804
|
delete: (id: string, options?: RequestOptions) => Promise<void>;
|
|
444
805
|
};
|
|
806
|
+
/** Many sessions in phases as one piece of work: fanned out over lists
|
|
807
|
+
* or earlier results, in parallel and in pipelines, under maxSessions,
|
|
808
|
+
* maxConcurrent and maxDollars, ending with one result. The database
|
|
809
|
+
* starts each step the moment what it waits on ends; nothing else runs
|
|
810
|
+
* between steps, so a workflow costs only its sessions. */
|
|
811
|
+
workflows: {
|
|
812
|
+
/** Runs it now; answers a handle to follow, wait for and stop. */
|
|
813
|
+
run(input: RunAgentWorkflow, options?: RequestOptions): Promise<AgentWorkflowHandle>;
|
|
814
|
+
/** One you already have, by its id. */
|
|
815
|
+
workflow(id: string, options?: RequestOptions): Promise<AgentWorkflowHandle>;
|
|
816
|
+
get: (id: string, options?: RequestOptions) => Promise<AgentWorkflow>;
|
|
817
|
+
/** The workflow at each change past `after`, as it happens, until it
|
|
818
|
+
* has ended: each read waits up to 30 seconds for the next change. */
|
|
819
|
+
follow: (id: string, options?: {
|
|
820
|
+
after?: number;
|
|
821
|
+
signal?: AbortSignal;
|
|
822
|
+
}) => AsyncGenerator<AgentWorkflow>;
|
|
823
|
+
/** Newest first, each with its phases' progress and cost. */
|
|
824
|
+
list: (query?: {
|
|
825
|
+
state?: AgentWorkflowState[];
|
|
826
|
+
cursor?: string;
|
|
827
|
+
limit?: number;
|
|
828
|
+
}, options?: RequestOptions) => Promise<Page<AgentWorkflow>>;
|
|
829
|
+
steps: (id: string, query?: {
|
|
830
|
+
state?: AgentWorkflowStep["state"][];
|
|
831
|
+
cursor?: string;
|
|
832
|
+
limit?: number;
|
|
833
|
+
}, options?: RequestOptions) => Promise<Page<AgentWorkflowStep>>;
|
|
834
|
+
/** Nothing more of it starts, and its open sessions stop. */
|
|
835
|
+
stop: (id: string, options?: RequestOptions) => Promise<AgentWorkflow>;
|
|
836
|
+
};
|
|
445
837
|
/** The account's inbox: the questions its agents' sessions need answered
|
|
446
838
|
* to go on, one row per step however many sessions ask it. */
|
|
447
839
|
asks: {
|
|
@@ -451,6 +843,25 @@ export declare function agents(t: Transport): {
|
|
|
451
843
|
/** Every session asking it reads the answer next, and wakes. An ask no
|
|
452
844
|
* longer open is refused with `ask_closed`. */
|
|
453
845
|
answer: (id: string, answer: AnswerAgentAsk, options?: RequestOptions) => Promise<AgentAsk>;
|
|
846
|
+
/** Lets a tool call the agent's permissions held run (its ask's Allow). */
|
|
847
|
+
approve: (id: string, options?: RequestOptions) => Promise<AgentAsk>;
|
|
848
|
+
/** Keeps a held tool call from running (its ask's Deny); `message` is
|
|
849
|
+
* told to the agent as the reason. */
|
|
850
|
+
deny: (id: string, message?: string, options?: RequestOptions) => Promise<AgentAsk>;
|
|
851
|
+
};
|
|
852
|
+
/** Runtime's Slack app in your workspaces, for `slack` triggers. */
|
|
853
|
+
slack: {
|
|
854
|
+
/** A link that adds Runtime's Slack app to a workspace, good for 15
|
|
855
|
+
* minutes. Open it in a browser signed in to this account, then
|
|
856
|
+
* approve the app in Slack; Slack sends the browser back to the
|
|
857
|
+
* console once it is added. Opened by anyone outside the account, it
|
|
858
|
+
* adds nothing. */
|
|
859
|
+
install: (options?: RequestOptions) => Promise<SlackInstallLink>;
|
|
860
|
+
/** The workspaces added to this account. */
|
|
861
|
+
teams: (options?: RequestOptions) => Promise<SlackTeam[]>;
|
|
862
|
+
/** Removes a workspace: its token is revoked, and its triggers refuse
|
|
863
|
+
* events until it is added again. */
|
|
864
|
+
remove: (team: string, options?: RequestOptions) => Promise<void>;
|
|
454
865
|
};
|
|
455
866
|
triggers: {
|
|
456
867
|
create: (agent: string, input: CreateAgentTrigger, options?: RequestOptions) => Promise<AgentTrigger>;
|