@@ -28,10 +28,13 @@ This multi-agent approach gives you better context understanding, more accurate
2828## CLI: Install and start coding
2929
3030Install:
31+
3132``` bash
3233npm install -g codebuff
3334```
35+
3436Run:
37+
3538```
3639cd your-project
3740codebuff
@@ -72,24 +75,40 @@ export default {
7275}
7376```
7477
75- ## SDK: Build custom AI coding tools
78+ ## SDK: Run agents in production
7679
7780``` typescript
7881import { CodebuffClient } from ' codebuff'
7982
80- // Initialize the client
83+ // 1. Initialize the client
8184const client = new CodebuffClient ({
8285 apiKey: ' your-api-key' ,
8386 cwd: ' /path/to/your/project' ,
8487 onError : (error ) => console .error (' Codebuff error:' , error .message ),
8588})
8689
87- // Run a task, like adding error handling to all API endpoints
90+ // 2. Do a coding task...
8891const result = await client .run ({
92+ agent: ' base' , // Codebuff's base coding agent
8993 prompt: ' Add comprehensive error handling to all API endpoints' ,
90- agent: ' base' ,
9194 handleEvent : (event ) => {
92- console .log (' Progress:' , event )
95+ console .log (' Progress' , event )
96+ },
97+ })
98+
99+ // 3. Or, run a custom agent!
100+ const myCustomAgent: AgentDefinition = {
101+ id: ' greeter' ,
102+ displayName: ' Greeter' ,
103+ model: ' openai/gpt-5' ,
104+ instructionsPrompt: ' Say hello!' ,
105+ }
106+ await client .run ({
107+ agent: ' greeter' ,
108+ agentDefinitions: [myCustomAgent ],
109+ prompt: ' My name is Bob.' ,
110+ handleEvent : (event ) => {
111+ console .log (' Progress' , event )
93112 },
94113})
95114```
0 commit comments