2020 * Simple configuration interface for defining a custom agent
2121 */
2222export interface AgentConfig {
23- /** Unique identifier for this agent */
23+ /** Unique identifier for this agent. Use alphanumeric characters and hyphens only. */
2424 id : string
2525
2626 /** Version string (if not provided, will default to '0.0.1' and be bumped on each publish) */
@@ -36,30 +36,32 @@ export interface AgentConfig {
3636 // Tools and Subagents
3737 // ============================================================================
3838
39- /** Tools this agent can use (defaults to common file editing tools) */
39+ /** Tools this agent can use. */
4040 tools ?: ToolName [ ]
4141
42- /** Other agents this agent can spawn */
42+ /** Other agents this agent can spawn. */
4343 subagents ?: SubagentName [ ]
4444
4545 // ============================================================================
4646 // Prompts
4747 // ============================================================================
4848
49- /** Description of what this agent does. Provided to the parent agent so it knows when to spawn this agent . */
49+ /** Prompt for when to spawn this agent as a subagent. Include the main purpose and use cases . */
5050 parentPrompt ?: string
5151
52- /** Background information for the agent. Prefer to use instructionsPrompt for agent instructions. */
52+ /** Background information for the agent. Prefer using instructionsPrompt for agent instructions. */
5353 systemPrompt ?: string
5454
55- /** Instructions for the agent. This prompt is inserted after each user input.
56- * Updating this prompt is the best way to shape the agent's behavior. */
55+ /** Instructions for the agent.
56+ * IMPORTANT: Updating this prompt is the best way to shape the agent's behavior.
57+ * This prompt is inserted after each user input. */
5758 instructionsPrompt ?: string
5859
59- /** Prompt inserted at each agent step. Powerful for changing the agent's behavior. */
60+ /** Prompt inserted at each agent step. Powerful for changing the agent's behavior,
61+ * but prefer instructionsPrompt for most instructions. */
6062 stepPrompt ?: string
6163
62- /** Instructions for spawned sub- agents */
64+ /** Instructions for specific parent agents on when to spawn this agent as a subagent. */
6365 parentInstructions ?: Record < SubagentName , string >
6466
6567 // ============================================================================
@@ -68,14 +70,18 @@ export interface AgentConfig {
6870
6971 /** The input schema required to spawn the agent. Provide a prompt string and/or a params object. */
7072 inputSchema ?: {
71- prompt ?: { type : 'string' , description ?: string }
73+ prompt ?: { type : 'string' ; description ?: string }
7274 params ?: JsonSchema
7375 }
7476
7577 /** Whether to include conversation history (defaults to true) */
7678 includeMessageHistory ?: boolean
7779
78- /** How the agent should output responses after spawned (defaults to 'last_message') */
80+ /** How the agent should output a response to its parent (defaults to 'last_message')
81+ * last_message: The last message from the agent, typcically after using tools.
82+ * all_messages: All messages from the agent, including tool calls and results.
83+ * json: Make the agent output a structured JSON object. Can be used with outputSchema or without if you want freeform json output.
84+ */
7985 outputMode ?: 'last_message' | 'all_messages' | 'json'
8086
8187 /** JSON schema for structured output (when outputMode is 'json') */
@@ -86,6 +92,13 @@ export interface AgentConfig {
8692 // ============================================================================
8793
8894 /** Programmatically step the agent forward and run tools.
95+ *
96+ * You can either yield:
97+ * - A tool call matching the tools schema.
98+ * - 'STEP' to run agent's model and generate one assistant message.
99+ * - 'STEP_ALL' to run the agent's model until it uses the end_turn tool or stops includes no tool calls in a message.
100+ *
101+ * Or use 'return' to end the turn.
89102 *
90103 * Example:
91104 * function* handleSteps({ agentStep, prompt, params}) {
0 commit comments