Skip to content

Commit b0cb41f

Browse files
Update README.md
1 parent 7333145 commit b0cb41f

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

sdk/README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ npm install @codebuff/sdk
1010

1111
## Prerequisites
1212

13-
- Create a Codebuff account and get your [Codebuff API key here](https://www.codebuff.com/profile?tab=api-keys).
13+
- Create a Codebuff account and get your [Codebuff API key here](https://www.codebuff.com/api-keys).
1414

1515
## Usage
1616

@@ -21,7 +21,8 @@ import { CodebuffClient } from '@codebuff/sdk'
2121

2222
async function main() {
2323
const client = new CodebuffClient({
24-
// Note: You need to pass in your own API key here. Get one: https://www.codebuff.com/profile?tab=api-keys
24+
// You need to pass in your own API key here.
25+
// Get one here: https://www.codebuff.com/api-keys
2526
apiKey: process.env.CODEBUFF_API_KEY,
2627
cwd: process.cwd(),
2728
onError: (e) => console.error('Codebuff error:', e.message),
@@ -32,6 +33,7 @@ async function main() {
3233
agent: 'base',
3334
prompt: 'Create a simple calculator class',
3435
handleEvent: (event) => {
36+
// This will fire for all events that happen during the run, like when each agent starts/stops and when they respond.
3537
console.log(event) // Log all events
3638
},
3739
})
@@ -40,9 +42,9 @@ async function main() {
4042
const run2 = await client.run({
4143
agent: 'base',
4244
prompt: 'Add unit tests for the calculator',
43-
previousRun: run1,
45+
previousRun: run1, // <-- this is where your next run differs from the previous run
4446
handleEvent: (event) => {
45-
console.log(event) // Log all events
47+
console.log(event)
4648
},
4749
})
4850

@@ -54,6 +56,8 @@ main()
5456

5557
### Example 2: Custom Agents and Tools
5658

59+
Here, we create a full agent and custom tools that can be reused between runs.
60+
5761
```typescript
5862
import { z } from 'zod'
5963
import {
@@ -64,12 +68,14 @@ import {
6468

6569
async function main() {
6670
const client = new CodebuffClient({
67-
// Note: You need to pass in your own API key. Get it here: https://www.codebuff.com/profile?tab=api-keys
71+
// Note: You need to pass in your own API key.
72+
// Get it here: https://www.codebuff.com/profile?tab=api-keys
6873
apiKey: process.env.CODEBUFF_API_KEY,
6974
cwd: process.cwd(),
7075
onError: (e) => console.error('Codebuff error:', e.message),
7176
})
7277

78+
// This is a custom agent that can be used instead of the `base` agent or other agents on the Codebuff store (https://codebuff.com/store).
7379
const myCustomAgent: AgentDefinition = {
7480
id: 'my-custom-agent',
7581
model: 'openai/gpt-5',

0 commit comments

Comments
 (0)