Skip to content

Commit e14c69a

Browse files
committed
Tweak readme
1 parent 05f26be commit e14c69a

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

README.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,13 @@ This multi-agent approach gives you better context understanding, more accurate
2828
## CLI: Install and start coding
2929

3030
Install:
31+
3132
```bash
3233
npm install -g codebuff
3334
```
35+
3436
Run:
37+
3538
```
3639
cd your-project
3740
codebuff
@@ -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
7881
import { CodebuffClient } from 'codebuff'
7982

80-
// Initialize the client
83+
// 1. Initialize the client
8184
const 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...
8891
const 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

Comments
 (0)