@@ -56,7 +56,7 @@ export interface AgentDefinition {
5656 // ============================================================================
5757
5858 /** Tools this agent can use. */
59- toolNames ?: ToolName [ ]
59+ toolNames ?: ( ToolName | ( string & { } ) ) [ ]
6060
6161 /** Other agents this agent can spawn, like 'codebuff/file-picker@0.0.1'.
6262 *
@@ -95,7 +95,7 @@ export interface AgentDefinition {
9595 *
9696 * all_messages: All messages from the agent, including tool calls and results.
9797 *
98- * json : Make the agent output a JSON object. Can be used with outputSchema or without if you want freeform json output.
98+ * structured_output : Make the agent output a JSON object. Can be used with outputSchema or without if you want freeform json output.
9999 */
100100 outputMode ?: 'last_message' | 'all_messages' | 'structured_output'
101101
@@ -146,6 +146,14 @@ export interface AgentDefinition {
146146 * input: { paths: ['file1.txt', 'file2.txt'] }
147147 * }
148148 * yield 'STEP_ALL'
149+ *
150+ * // Optionally do a post-processing step here...
151+ * yield {
152+ * toolName: 'set_output',
153+ * input: {
154+ * output: 'The files were read successfully.',
155+ * },
156+ * }
149157 * }
150158 *
151159 * Example 2:
@@ -162,7 +170,8 @@ export interface AgentDefinition {
162170 * ],
163171 * },
164172 * }
165- * yield 'STEP'
173+ * const { stepsComplete } = yield 'STEP'
174+ * if (stepsComplete) break
166175 * }
167176 * }
168177 */
@@ -183,16 +192,32 @@ export interface AgentDefinition {
183192
184193export interface AgentState {
185194 agentId : string
186- parentId : string
195+ parentId : string | undefined
196+
197+ /** The agent's conversation history: messages from the user and the assistant. */
187198 messageHistory : Message [ ]
199+
200+ /** The last value set by the set_output tool. This is a plain object or undefined if not set. */
201+ output : Record < string , any > | undefined
188202}
189203
190204/**
191205 * Message in conversation history
192206 */
193207export interface Message {
194208 role : 'user' | 'assistant'
195- content : string
209+ content :
210+ | string
211+ | Array <
212+ | {
213+ type : 'text'
214+ text : string
215+ }
216+ | {
217+ type : 'image'
218+ image : string
219+ }
220+ >
196221}
197222
198223/**
0 commit comments