client.run() method executes a Codebuff agent and returns the result.
Basic Usage
RunOptions
agent
The agent to run. Can be:Published agent (recommended):Local agent from .agents directory:Inline agent definition:
prompt
The user prompt describing what you want the agent to do.
previousRun
State from a previous
run() call to continue the conversation.params
Additional structured parameters for the agent.Most agents only need
prompt, but some custom agents accept additional parameters.handleEvent
agentDefinitions
Array of custom agent definitions available for this run.Required when using custom agents. See Custom Agents.
customToolDefinitions
Array of custom tool definitions for this run.See Custom Tools for details.
Other Options
AllCodebuffClientOptions can also be passed to override client defaults:
Return Value: RunState
Therun() method returns a Promise<RunState>:
Checking Results
Multi-Turn Conversations
PasspreviousRun to maintain context across multiple interactions:
Error Handling
Cancellation
UseAbortSignal to cancel a run:

