@restatedev/agents 0.3.0 → 0.5.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.
Files changed (136) hide show
  1. package/README.md +107 -53
  2. package/dist/calls.d.ts +29 -5
  3. package/dist/calls.d.ts.map +1 -1
  4. package/dist/calls.js +77 -10
  5. package/dist/calls.js.map +1 -1
  6. package/dist/claude/index.d.ts +36 -7
  7. package/dist/claude/index.d.ts.map +1 -1
  8. package/dist/claude/index.js +232 -151
  9. package/dist/claude/index.js.map +1 -1
  10. package/dist/client.d.ts +12 -3
  11. package/dist/client.d.ts.map +1 -1
  12. package/dist/client.js.map +1 -1
  13. package/dist/common.d.ts +151 -70
  14. package/dist/common.d.ts.map +1 -1
  15. package/dist/common.js +246 -204
  16. package/dist/common.js.map +1 -1
  17. package/dist/conversation.d.ts +478 -0
  18. package/dist/conversation.d.ts.map +1 -0
  19. package/dist/conversation.js +1256 -0
  20. package/dist/conversation.js.map +1 -0
  21. package/dist/deepseek/index.d.ts +38 -5
  22. package/dist/deepseek/index.d.ts.map +1 -1
  23. package/dist/deepseek/index.js +322 -106
  24. package/dist/deepseek/index.js.map +1 -1
  25. package/dist/deepseek/persistence.d.ts +9 -3
  26. package/dist/deepseek/persistence.d.ts.map +1 -1
  27. package/dist/deepseek/persistence.js +12 -6
  28. package/dist/deepseek/persistence.js.map +1 -1
  29. package/dist/index.d.ts +2 -2
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +2 -3
  32. package/dist/index.js.map +1 -1
  33. package/dist/langgraph/checkpointer.d.ts +16 -2
  34. package/dist/langgraph/checkpointer.d.ts.map +1 -1
  35. package/dist/langgraph/checkpointer.js +133 -26
  36. package/dist/langgraph/checkpointer.js.map +1 -1
  37. package/dist/langgraph/context.d.ts +10 -0
  38. package/dist/langgraph/context.d.ts.map +1 -0
  39. package/dist/langgraph/context.js +21 -0
  40. package/dist/langgraph/context.js.map +1 -0
  41. package/dist/langgraph/errors.d.ts +16 -0
  42. package/dist/langgraph/errors.d.ts.map +1 -0
  43. package/dist/langgraph/errors.js +30 -0
  44. package/dist/langgraph/errors.js.map +1 -0
  45. package/dist/langgraph/graph.d.ts +25 -0
  46. package/dist/langgraph/graph.d.ts.map +1 -0
  47. package/dist/langgraph/graph.js +346 -0
  48. package/dist/langgraph/graph.js.map +1 -0
  49. package/dist/langgraph/index.d.ts +65 -12
  50. package/dist/langgraph/index.d.ts.map +1 -1
  51. package/dist/langgraph/index.js +227 -171
  52. package/dist/langgraph/index.js.map +1 -1
  53. package/dist/langgraph/nodes.d.ts +70 -0
  54. package/dist/langgraph/nodes.d.ts.map +1 -0
  55. package/dist/langgraph/nodes.js +145 -0
  56. package/dist/langgraph/nodes.js.map +1 -0
  57. package/dist/messages.d.ts +18 -0
  58. package/dist/messages.d.ts.map +1 -0
  59. package/dist/messages.js +182 -0
  60. package/dist/messages.js.map +1 -0
  61. package/dist/object.d.ts +65 -23
  62. package/dist/object.d.ts.map +1 -1
  63. package/dist/object.js +123 -35
  64. package/dist/object.js.map +1 -1
  65. package/dist/opencode/db.d.ts +51 -10
  66. package/dist/opencode/db.d.ts.map +1 -1
  67. package/dist/opencode/db.js +122 -34
  68. package/dist/opencode/db.js.map +1 -1
  69. package/dist/opencode/index.d.ts +105 -21
  70. package/dist/opencode/index.d.ts.map +1 -1
  71. package/dist/opencode/index.js +827 -279
  72. package/dist/opencode/index.js.map +1 -1
  73. package/dist/output.d.ts +15 -7
  74. package/dist/output.d.ts.map +1 -1
  75. package/dist/output.js +44 -26
  76. package/dist/output.js.map +1 -1
  77. package/dist/pi/index.d.ts +39 -11
  78. package/dist/pi/index.d.ts.map +1 -1
  79. package/dist/pi/index.js +281 -77
  80. package/dist/pi/index.js.map +1 -1
  81. package/dist/pi/storage.d.ts +29 -4
  82. package/dist/pi/storage.d.ts.map +1 -1
  83. package/dist/pi/storage.js +18 -6
  84. package/dist/pi/storage.js.map +1 -1
  85. package/dist/signals.d.ts +74 -4
  86. package/dist/signals.d.ts.map +1 -1
  87. package/dist/signals.js +144 -15
  88. package/dist/signals.js.map +1 -1
  89. package/dist/steering.d.ts +31 -0
  90. package/dist/steering.d.ts.map +1 -0
  91. package/dist/steering.js +45 -0
  92. package/dist/steering.js.map +1 -0
  93. package/dist/tools.d.ts +28 -0
  94. package/dist/tools.d.ts.map +1 -1
  95. package/dist/tools.js +34 -5
  96. package/dist/tools.js.map +1 -1
  97. package/package.json +42 -13
  98. package/src/calls.ts +107 -15
  99. package/src/claude/README.md +41 -20
  100. package/src/claude/index.ts +266 -178
  101. package/src/client.ts +14 -3
  102. package/src/common.ts +317 -232
  103. package/src/conversation.ts +1547 -0
  104. package/src/deepseek/README.md +78 -11
  105. package/src/deepseek/index.ts +384 -137
  106. package/src/deepseek/persistence.ts +11 -8
  107. package/src/index.ts +13 -4
  108. package/src/langgraph/README.md +115 -25
  109. package/src/langgraph/checkpointer.ts +168 -28
  110. package/src/langgraph/context.ts +27 -0
  111. package/src/langgraph/errors.ts +26 -0
  112. package/src/langgraph/graph.ts +396 -0
  113. package/src/langgraph/index.ts +326 -181
  114. package/src/langgraph/nodes.ts +243 -0
  115. package/src/messages.ts +244 -0
  116. package/src/object.ts +169 -38
  117. package/src/opencode/README.md +172 -66
  118. package/src/opencode/db.ts +204 -40
  119. package/src/opencode/index.ts +1010 -325
  120. package/src/output.ts +52 -31
  121. package/src/pi/README.md +18 -3
  122. package/src/pi/index.ts +346 -78
  123. package/src/pi/storage.ts +20 -7
  124. package/src/signals.ts +225 -19
  125. package/src/steering.ts +67 -0
  126. package/src/tools.ts +61 -8
  127. package/dist/claude/conversation.d.ts +0 -33
  128. package/dist/claude/conversation.d.ts.map +0 -1
  129. package/dist/claude/conversation.js +0 -95
  130. package/dist/claude/conversation.js.map +0 -1
  131. package/dist/log.d.ts +0 -29
  132. package/dist/log.d.ts.map +0 -1
  133. package/dist/log.js +0 -146
  134. package/dist/log.js.map +0 -1
  135. package/src/claude/conversation.ts +0 -114
  136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,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAC1G,EAAE,MAAM,EAAE,QAAQ,EAAE,CACrB,CAAC;AAEJ;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,GAA2B,EAC3B,MAAc,EACd,IAAY,EACZ,KAAe,EACf,EAAE,QAAQ,GAAG,KAAK,EAAE,MAAM,GAAG,KAAK,EAAE,GAA6C,EAAE,EACjE,EAAE,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,KAAK,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@restatedev/agents",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Agent frameworks in Restate virtual objects, their state in the object's SQL database: pi, OpenCode, LangGraph, Claude (Anthropic SDK) and DeepSeek Harness",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -68,6 +68,10 @@
68
68
  "@deepseek-ai/dsh-atomic-write": "0.2.1-rc.2",
69
69
  "@deepseek-ai/dsh-attachment": "0.2.1-rc.2",
70
70
  "@deepseek-ai/dsh-authorization": "0.2.1-rc.2",
71
+ "@deepseek-ai/dsh-commands": "0.2.1-rc.2",
72
+ "@deepseek-ai/dsh-compaction": "0.2.1-rc.2",
73
+ "@deepseek-ai/dsh-compaction-basic": "0.2.1-rc.2",
74
+ "@deepseek-ai/dsh-compaction-tool-result-pruner": "0.2.1-rc.2",
71
75
  "@deepseek-ai/dsh-credentials": "0.2.1-rc.2",
72
76
  "@deepseek-ai/dsh-deepseek-llm-api-extensions": "0.2.1-rc.2",
73
77
  "@deepseek-ai/dsh-fs": "0.2.1-rc.2",
@@ -87,6 +91,7 @@
87
91
  "@deepseek-ai/dsh-session-projection": "0.2.1-rc.2",
88
92
  "@deepseek-ai/dsh-system-prompt": "0.2.1-rc.2",
89
93
  "@deepseek-ai/dsh-timeout": "0.2.1-rc.2",
94
+ "@deepseek-ai/dsh-token-meter": "0.2.1-rc.2",
90
95
  "@deepseek-ai/dsh-tools": "0.2.1-rc.2",
91
96
  "@deepseek-ai/dsh-user-approval": "0.2.1-rc.2",
92
97
  "@earendil-works/chord": "1.4.0",
@@ -98,13 +103,13 @@
98
103
  "@langchain/langgraph-checkpoint": "1.1.5",
99
104
  "@langchain/langgraph-checkpoint-validation": "1.1.1",
100
105
  "@langchain/openai": "1.7.0",
101
- "@opencode/core": "2.0.32",
102
- "@opencode/plugin": "2.0.32",
103
- "@opencode/sdk": "2.0.32",
104
- "@opencode/server": "2.0.32",
106
+ "@opencode/core": "2.2.6",
107
+ "@opencode/plugin": "2.2.6",
108
+ "@opencode/sdk": "2.2.6",
109
+ "@opencode/server": "2.2.6",
105
110
  "@restatedev/restate-sdk": "1.18.2",
106
- "@restatedev/sessions": "0.3.0",
107
- "effect": "4.0.1",
111
+ "@restatedev/sessions": "0.5.0",
112
+ "effect": "4.1.0",
108
113
  "zod": "4.6.5"
109
114
  },
110
115
  "peerDependencies": {
@@ -112,6 +117,10 @@
112
117
  "@deepseek-ai/cordis": "~4.0.5",
113
118
  "@deepseek-ai/dsh-agent": "0.2.1-rc.2",
114
119
  "@deepseek-ai/dsh-agent-loop": "0.2.1-rc.2",
120
+ "@deepseek-ai/dsh-commands": "0.2.1-rc.2",
121
+ "@deepseek-ai/dsh-compaction": "0.2.1-rc.2",
122
+ "@deepseek-ai/dsh-compaction-basic": "0.2.1-rc.2",
123
+ "@deepseek-ai/dsh-compaction-tool-result-pruner": "0.2.1-rc.2",
115
124
  "@deepseek-ai/dsh-llm": "0.2.1-rc.2",
116
125
  "@deepseek-ai/dsh-llm-deepseek-api-key": "0.2.1-rc.2",
117
126
  "@deepseek-ai/dsh-llm-pi-ai": "0.2.1-rc.2",
@@ -120,7 +129,9 @@
120
129
  "@deepseek-ai/dsh-session-persistence": "0.2.1-rc.2",
121
130
  "@deepseek-ai/dsh-session-projection": "0.2.1-rc.2",
122
131
  "@deepseek-ai/dsh-system-prompt": "0.2.1-rc.2",
132
+ "@deepseek-ai/dsh-token-meter": "0.2.1-rc.2",
123
133
  "@deepseek-ai/dsh-tools": "0.2.1-rc.2",
134
+ "@deepseek-ai/dsh-user-approval": "0.2.1-rc.2",
124
135
  "@earendil-works/chord": "^1.4.0",
125
136
  "@earendil-works/pi-ai": "^1.4.0",
126
137
  "@earendil-works/pi-durable": "^1.4.0",
@@ -129,12 +140,12 @@
129
140
  "@langchain/langgraph": "^1.4.18",
130
141
  "@langchain/langgraph-checkpoint": "^1.1.5",
131
142
  "@langchain/openai": "^1.7.0",
132
- "@opencode/core": "2.0.32",
133
- "@opencode/plugin": "2.0.32",
134
- "@opencode/sdk": "2.0.32",
135
- "@opencode/server": "2.0.32",
136
- "@restatedev/sessions": "^0.3.0",
137
- "effect": "4.0.1",
143
+ "@opencode/core": "2.2.6",
144
+ "@opencode/plugin": "2.2.6",
145
+ "@opencode/sdk": "2.2.6",
146
+ "@opencode/server": "2.2.6",
147
+ "@restatedev/sessions": "^0.5.0",
148
+ "effect": "4.1.0",
138
149
  "zod": "^4.6.5"
139
150
  },
140
151
  "peerDependenciesMeta": {
@@ -150,6 +161,18 @@
150
161
  "@deepseek-ai/dsh-agent-loop": {
151
162
  "optional": true
152
163
  },
164
+ "@deepseek-ai/dsh-commands": {
165
+ "optional": true
166
+ },
167
+ "@deepseek-ai/dsh-compaction": {
168
+ "optional": true
169
+ },
170
+ "@deepseek-ai/dsh-compaction-basic": {
171
+ "optional": true
172
+ },
173
+ "@deepseek-ai/dsh-compaction-tool-result-pruner": {
174
+ "optional": true
175
+ },
153
176
  "@deepseek-ai/dsh-llm": {
154
177
  "optional": true
155
178
  },
@@ -174,9 +197,15 @@
174
197
  "@deepseek-ai/dsh-system-prompt": {
175
198
  "optional": true
176
199
  },
200
+ "@deepseek-ai/dsh-token-meter": {
201
+ "optional": true
202
+ },
177
203
  "@deepseek-ai/dsh-tools": {
178
204
  "optional": true
179
205
  },
206
+ "@deepseek-ai/dsh-user-approval": {
207
+ "optional": true
208
+ },
180
209
  "@earendil-works/chord": {
181
210
  "optional": true
182
211
  },
package/src/calls.ts CHANGED
@@ -3,21 +3,28 @@
3
3
  // a call is made once, however often its tool call runs.
4
4
  //
5
5
  // A crash or a suspension restarts the handler. pi, Claude and LangGraph then
6
- // run a tool call that was cut off again, with its id. OpenCode and the
7
- // DeepSeek Harness tell the model it was interrupted instead, and the model
6
+ // run a tool call that was cut off again, with its id. The DeepSeek Harness
7
+ // tells the model it was interrupted instead, and the model
8
8
  // makes it again with a new id: made with the same tool and input, it is the
9
9
  // call an earlier attempt made, so it takes that call's id, and so the same
10
10
  // idempotency key: the same Restate call (a wait for a signal, a sub-agent's
11
11
  // task), which it waits for again, or whose answer it gets.
12
12
  //
13
13
  // A call is kept until the framework's transcript has its result under the
14
- // last id it was made with ({@link settle}, at each publish, and before each
14
+ // last id it was made with ({@link settleCalls}, at each publish, and before each
15
15
  // tool call): one that answered just before a crash, whose result the
16
16
  // framework had not stored, is made again as the same call. An error there
17
- // is not its result (OpenCode gives the call it interrupted one, and the
18
- // model makes it again), unless the call answered with that error: a
17
+ // is not its result (the DeepSeek Harness gives the call it interrupted
18
+ // one, and the model makes it again), unless the call answered with that error: a
19
19
  // terminal error is its result too. Once stored, the model has its result,
20
20
  // and an identical call it makes later is a call of its own.
21
+ //
22
+ // A framework's own wait ({@link waitFor} of tools.ts) is its tool call's
23
+ // alone: the framework stored its tool call before it waits, so a retried
24
+ // attempt waits again under the same id, and a new call with the same input
25
+ // (the model asking again, after the first's answer) waits anew. An approval
26
+ // a tool call waited for is not the call: a stopped turn does not report the
27
+ // call as done because its approval returned ({@link outcomes}).
21
28
  import type * as restate from '@restatedev/sessions';
22
29
  import { Schema, ScopeKey } from '@restatedev/sessions/internal';
23
30
  import { randomUUID } from 'node:crypto';
@@ -32,6 +39,13 @@ interface Call {
32
39
  done?: true;
33
40
  /** It answered with this error (`Error: <message>`), a terminal one: its result, as the transcript has it. */
34
41
  failed?: string;
42
+ /** An approval its tool call waited for ({@link waitFor}): its answer is not the tool call's. */
43
+ approval?: true;
44
+ /**
45
+ * The prompt whose turn made it (`answerOnce`'s), if any: an invocation
46
+ * that prompts more than once keeps the calls of each apart.
47
+ */
48
+ prompt?: string;
35
49
  }
36
50
 
37
51
  /** The calls an invocation's tools made that the transcript has no result of yet. */
@@ -74,29 +88,75 @@ async function load(ctx: CallsContext, invocation: string): Promise<Calls> {
74
88
  /** Each attempt's id, and its calls, by its context. */
75
89
  const ATTEMPT = new ScopeKey<{ id: string; calls: Promise<Calls> }>('the calls of an attempt');
76
90
 
77
- /** The attempt of `ctx`: its id, and the calls of its invocation. */
91
+ /** The attempt of `ctx`: its id, and the calls of its invocation (loaded once, shared by calls made at once). */
78
92
  function attemptOf(ctx: restate.SessionContext) {
79
93
  return ATTEMPT.of(ctx, () => ({ id: randomUUID(), calls: load(ctx, ctx.request.id) }));
80
94
  }
81
95
 
96
+ /** `value` as JSON with its objects' keys sorted: the same input, however its keys came, is the same call. */
97
+ function canonical(value: unknown): string {
98
+ return JSON.stringify(value, (_key, v: unknown) =>
99
+ v !== null && typeof v === 'object' && !Array.isArray(v)
100
+ ? Object.fromEntries(
101
+ Object.entries(v as Record<string, unknown>).toSorted(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)),
102
+ )
103
+ : v,
104
+ );
105
+ }
106
+
107
+ /** The prompt whose turn the tools of `ctx` run for, while `answerOnce` answers it. */
108
+ const PROMPT = new ScopeKey<string>('the prompt of the calls');
109
+
110
+ /**
111
+ * Run `work` (a turn's) with the calls its tools make kept as prompt
112
+ * `prompt`'s: they are matched, and rejoined, within it only. An invocation
113
+ * that prompts twice, its second prompt making the call its first made
114
+ * (the same tool and input), would otherwise take the first's after a crash
115
+ * (its record not yet forgotten), and never make its own.
116
+ */
117
+ export async function forPrompt<T>(ctx: restate.SessionContext, prompt: string, work: () => Promise<T>): Promise<T> {
118
+ const outer = PROMPT.get(ctx);
119
+ PROMPT.set(ctx, prompt);
120
+ try {
121
+ return await work();
122
+ } finally {
123
+ if (outer === undefined) PROMPT.delete(ctx);
124
+ else PROMPT.set(ctx, outer);
125
+ }
126
+ }
127
+
82
128
  /**
83
129
  * The call of tool `tool` with `input` that tool call `callId` makes: the
84
- * one it made before (a run again), or the one an earlier attempt made with
85
- * the same tool and input (made again under a new id), or else a new one.
86
- * `run(id)` makes it with its own id, and stores that it answered.
130
+ * one it made to `tool` before (a run again), or else, if `rejoin`, the one
131
+ * an earlier attempt made with the same tool and input (made again under a
132
+ * new id), or else a new one, an `approval` its tool call waits for if so.
133
+ * `answered()` stores that it answered.
87
134
  */
88
- export async function callOf(ctx: restate.SessionContext, tool: string, input: unknown, callId: string) {
135
+ export async function callOf(
136
+ ctx: restate.SessionContext,
137
+ tool: string,
138
+ input: unknown,
139
+ callId: string,
140
+ { rejoin = true, approval = false }: { rejoin?: boolean; approval?: boolean } = {},
141
+ ) {
89
142
  const attempt = attemptOf(ctx);
90
143
  const state = await attempt.calls;
91
- const json = JSON.stringify(input);
144
+ const json = canonical(input);
145
+ const prompt = PROMPT.get(ctx);
146
+ const ours = state.calls.filter((c) => c.prompt === prompt);
147
+ // A tool call may make more than one call (an approval, then the tool's
148
+ // own), each to a tool of its own.
92
149
  let call =
93
- state.calls.find((c) => c.ids.includes(callId)) ??
94
- state.calls.find((c) => c.attempt !== attempt.id && c.tool === tool && c.input === json);
150
+ ours.find((c) => c.ids.includes(callId) && c.tool === tool) ??
151
+ (rejoin ? ours.find((c) => c.attempt !== attempt.id && c.tool === tool && c.input === json) : undefined);
95
152
  if (call) {
96
153
  call.attempt = attempt.id;
97
154
  if (!call.ids.includes(callId)) call.ids.push(callId);
98
155
  } else {
99
- state.calls.push((call = { tool, input: json, ids: [callId], attempt: attempt.id }));
156
+ call = { tool, input: json, ids: [callId], attempt: attempt.id };
157
+ if (approval) call.approval = true;
158
+ if (prompt !== undefined) call.prompt = prompt;
159
+ state.calls.push(call);
100
160
  }
101
161
  await store(ctx, state);
102
162
  const made = call;
@@ -123,10 +183,42 @@ export async function callOf(ctx: restate.SessionContext, tool: string, input: u
123
183
  * otherwise take one an earlier attempt made, and the model has the result
124
184
  * of.
125
185
  */
126
- export async function settle(ctx: restate.SessionContext, stored: (id: string, failed?: string) => boolean) {
186
+ export async function settleCalls(ctx: restate.SessionContext, stored: (id: string, failed?: string) => boolean) {
127
187
  const state = await attemptOf(ctx).calls;
128
188
  const kept = state.calls.filter((c) => !c.done || !stored(c.ids.at(-1)!, c.failed));
129
189
  if (kept.length === state.calls.length) return;
130
190
  state.calls = kept;
131
191
  await store(ctx, state);
132
192
  }
193
+
194
+ /**
195
+ * Which of `callIds` made a Restate call that answered, in this invocation
196
+ * or in `invocation`: each with the terminal error it answered with
197
+ * (`Error: <message>`), or `undefined` if it succeeded. A tool call whose
198
+ * call did not answer, or that made none, is left out; so is one whose only
199
+ * answered call is its approval, which it ran (or was denied) after.
200
+ *
201
+ * An earlier `invocation`'s calls are read only while they are still
202
+ * stored, until an invocation of the key makes calls of its own; read,
203
+ * never changed. With `prompt`, the calls of its turn only.
204
+ */
205
+ export async function outcomes(
206
+ ctx: restate.SessionContext,
207
+ callIds: Iterable<string>,
208
+ invocation?: string,
209
+ prompt?: string,
210
+ ): Promise<Map<string, string | undefined>> {
211
+ const state =
212
+ invocation !== undefined && invocation !== ctx.request.id
213
+ ? await load(ctx, invocation)
214
+ : await attemptOf(ctx).calls;
215
+ const wanted = new Set(callIds);
216
+ const found = new Map<string, string | undefined>();
217
+ for (const call of state.calls) {
218
+ if (!call.done || call.approval) continue;
219
+ // Another prompt's call, of the same invocation: not this turn's.
220
+ if (prompt !== undefined && call.prompt !== undefined && call.prompt !== prompt) continue;
221
+ for (const id of call.ids) if (wanted.has(id)) found.set(id, call.failed);
222
+ }
223
+ return found;
224
+ }
@@ -4,7 +4,8 @@ The Anthropic SDK's tool runner (`client.beta.messages.toolRunner` in
4
4
  [`@anthropic-ai/sdk`](https://github.com/anthropics/anthropic-sdk-typescript))
5
5
  is a light agent harness: the tool-calling loop, in the process, with nothing
6
6
  stored. It keeps the conversation in its params, so an agent built on it is
7
- durable when the conversation is: here it is in the agent's SQL database
7
+ durable when the conversation is: here it is the agent's conversation of
8
+ turns, in its SQL database
8
9
  ([SQL in Restate virtual objects](../../../sessions/README.md)).
9
10
 
10
11
  It is lighter than the Claude Agent SDK, which runs Claude Code as a
@@ -24,15 +25,30 @@ const assistant = claude.agent({ name: 'assistant', system: 'Answer briefly.', t
24
25
  await serve(assistant);
25
26
  ```
26
27
 
27
- | Option | What |
28
- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
29
- | `model` | `anthropic/model-id`; or else `MODEL`, or else `anthropic/claude-sonnet-5-5` (`ANTHROPIC_API_KEY`) |
30
- | `system` | The system prompt |
31
- | `tools` | `tool()`s and Restate's tools of `@restatedev/agents`, or the SDK's runnable tools (such as `betaZodTool`) |
32
- | `output` | A zod object: the answer as data, which the agent replies with as JSON, and `chat` answers with (see [Structured answers](../../README.md#structured-answers)) |
33
- | `client` | The Anthropic client (a base URL or a proxy of your own, say); by default one with `ANTHROPIC_API_KEY` |
34
- | `maxTokens` | The most tokens of each of the model's replies (default 16000): a reply cut off there fails its message (a terminal error) |
35
- | `effort` | How much effort the model puts into each reply: `low`, `medium`, `high`, `xhigh` or `max` (default: the model's) |
28
+ | Option | What |
29
+ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
30
+ | `model` | `anthropic/model-id`; or else `MODEL`, or else `anthropic/claude-sonnet-5-5` (`ANTHROPIC_API_KEY`) |
31
+ | `system` | The system prompt |
32
+ | `tools` | `tool()`s and Restate's tools of `@restatedev/agents`, or the SDK's runnable tools (such as `betaZodTool`) |
33
+ | `output` | A zod object: the answer as data, which the agent replies with as JSON, and `chat` answers with (see [Structured answers](../../README.md#structured-answers)): asked for natively where the model has structured outputs |
34
+ | `nativeOutput` | Whether `output` is asked for with the API's structured outputs (`output_config.format`) rather than in the prompt (default: if the model has them, as Claude's 4.5 models and later do) |
35
+ | `client` | The Anthropic client (a base URL or a proxy of your own, say); by default one with `ANTHROPIC_API_KEY` |
36
+ | `maxTokens` | The most tokens of each of the model's replies (default 16000): a reply cut off there fails its message (a terminal error) |
37
+ | `effort` | How much effort the model puts into each reply: `low`, `medium`, `high`, `xhigh` or `max` (default: the model's) |
38
+
39
+ With `output`, a model with structured outputs is asked for the answer
40
+ natively: each request of the run has the JSON schema of `output` as its
41
+ `output_config.format` (the SDK's `betaZodOutputFormat`), which holds the
42
+ model's final reply to it, while its tool calls go on as before. Neither
43
+ the system prompt nor the prompt asks for it. The reply is checked all the
44
+ same, against what the API does not hold it to (a string's `max`, an
45
+ `enum`: the SDK moves them into the schema's descriptions), and a reply
46
+ that does not fit is asked again once, as when asked in the prompt. A
47
+ declined reply, or one cut off at `maxTokens`, ends the turn, as without
48
+ `output`. A schema the API refuses (one too complex for it, say) refuses
49
+ the message: `nativeOutput: false` asks in the prompt, as for a model
50
+ without structured outputs (Claude 3, Opus 4 and 4.1, Sonnet 4) or a model
51
+ id the agent does not know.
36
52
 
37
53
  For a session object of your own, `claude.chat(options)` is the handler and
38
54
  `claude.messages()` the view; `options` may be a function of the
@@ -42,23 +58,28 @@ often the handler runs; each prompt of an invocation is a prompt of its own.
42
58
 
43
59
  ## Through crashes
44
60
 
45
- The conversation ([`conversation.ts`](conversation.ts)) is the messages in
46
- the object's database, in order, each with the invocation it belongs to, and
47
- the answer to each. The handler is not replayed: a retried attempt runs it
48
- again from the start, with the stored messages.
61
+ The conversation is the object's conversation of turns
62
+ ([docs/conversation.md](../../docs/conversation.md)), whose items are the
63
+ SDK's messages. The runner starts from what the model sees of it: the
64
+ earlier turns as their prompt and answer (as many as `budget` holds, the
65
+ earliest summarized), the latest `window` turns whole. The handler is not
66
+ replayed: a retried attempt runs it again from the start, from what is
67
+ stored.
49
68
 
50
69
  - **Each reply is stored before its tools run, and their results before the
51
70
  next request.** So a crash during the tools resumes them with the same tool
52
- call ids, without asking the model again.
71
+ call ids, without asking the model again; and a stored final reply is the
72
+ answer, without asking the model for it again.
53
73
  - **A tool is idempotent by its tool call id** (`callId` of `tool()`'s
54
74
  `run`, or `callId(context)` for the SDK's tools), which it passes on, such
55
75
  as in an idempotency key.
56
76
  - **A tool's error fails the attempt**, and Restate retries it; a
57
- `restate.TerminalError` of a `@restatedev/agents` tool is its answer to the
58
- model.
59
- - **A message is answered once per invocation**: its answer is stored with
60
- the model's last reply, and a retried attempt returns it. A message that a
61
- crash interrupted is finished before the next one starts.
77
+ `restate.TerminalError` of a `@restatedev/agents` tool, and the SDK's
78
+ `ToolError`, are its answer to the model.
79
+ - **A message is answered once per invocation** (`answerOnce`). A turn that
80
+ a killed invocation left is closed (`ended`), never finished: by the next
81
+ message, or by the agent's `settle` once its companion finds the
82
+ invocation gone.
62
83
 
63
84
  ## Run
64
85