AgentDefinition Type
TheAgentDefinition interface defines the structure and behavior of a Codebuff agent.
Core Properties
id
Type:string (required)
Unique identifier for the agent. Must contain only lowercase letters, numbers, and hyphens.
displayName
Type:string (required)
Human-readable name shown in the UI.
model
Type:ModelName (required)
AI model to use. Can be any model from OpenRouter.
version
Type:string (optional)
Version string for the agent. Defaults to '0.0.1' and increments on each publish.
publisher
Type:string (optional, required for publishing)
Publisher ID. Required if you want to publish the agent to the store.
Reasoning Options
reasoningOptions
Type:object (optional)
Controls reasoning behavior for models that support it. See OpenRouter reasoning docs.
providerOptions
Type:object (optional)
Controls provider routing on OpenRouter. See provider routing docs.
Tools and Subagents
toolNames
Type:(ToolName | string)[] (optional)
Tools the agent can use.
spawnableAgents
Type:string[] (optional)
Other agents this agent can spawn.
mcpServers
Type:Record<string, MCPConfig> (optional)
MCP (Model Context Protocol) servers to connect. Names cannot contain /.
Input and Output
inputSchema
Type:object (optional)
Defines the input schema for spawning the agent.
outputMode
Type:'last_message' | 'all_messages' | 'structured_output' (optional)
How the agent outputs a response to its parent. Defaults to 'last_message'.
last_message: Returns the last message from the agentall_messages: Returns all messages including tool calls and resultsstructured_output: Returns a JSON object (use withoutputSchema)
outputSchema
Type:JsonObjectSchema (optional)
JSON schema for structured output (when outputMode is 'structured_output').
Prompts
spawnerPrompt
Type:string (optional)
Describes when and why to spawn this agent. Critical if the agent is intended to be spawned by other agents.
systemPrompt
Type:string (optional)
Background information for the agent. Prefer using instructionsPrompt for main instructions.
instructionsPrompt
Type:string (required for most agents)
Main instructions for the agent. This is the most important field for shaping agent behavior.
stepPrompt
Type:string (optional)
Prompt inserted at each agent step. Powerful but usually not necessary for smart models.
includeMessageHistory
Type:boolean (optional, defaults to false)
Whether to include conversation history from the parent agent.
inheritParentSystemPrompt
Type:boolean (optional, defaults to false)
Whether to inherit the parent’s system prompt instead of using this agent’s own.
systemPrompt.
handleSteps Generator
handleSteps
Type:Generator function (optional)
Programmatically control agent execution. See Generators for full details.

