Skip to content

Commit 4200c04

Browse files
committed
sdk: update README
1 parent e106c6d commit 4200c04

File tree

3 files changed

+13
-21
lines changed

3 files changed

+13
-21
lines changed

sdk/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to the @codebuff/sdk package will be documented in this file.
44

5+
## [0.3.1]
6+
7+
- `CodebuffClient.run` now does not return `null`. Instead, the `CodebuffClient.run(...).output.type` will be `'error'`.
8+
59
## [0.3.0]
610

711
- New more intuitive interface for `CodebuffClient` and `CodebuffClient.run`.

sdk/README.md

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ async function main() {
3939
})
4040
console.log('------- First run ended -------')
4141

42-
if (!run1) {
42+
if (run1.output.type === 'error') {
4343
// The previous run failed, handleEvent should have been called with an error
44-
console.error('First run failed.')
44+
console.error(`First run failed:\n${run1.output.message}`)
4545
process.exit(1)
4646
}
4747

@@ -66,20 +66,18 @@ main()
6666
Here, we create a full agent and custom tools that can be reused between runs.
6767

6868
```typescript
69-
import { z } from 'zod'
70-
import {
71-
CodebuffClient,
72-
AgentDefinition,
73-
getCustomToolDefinition,
74-
} from '@codebuff/sdk'
69+
import { z } from 'zod/v4'
70+
71+
import { CodebuffClient, getCustomToolDefinition } from '@codebuff/sdk'
72+
73+
import type { AgentDefinition } from '@codebuff/sdk'
7574

7675
async function main() {
7776
const client = new CodebuffClient({
7877
// Note: You need to pass in your own API key.
7978
// Get it here: https://www.codebuff.com/profile?tab=api-keys
8079
apiKey: process.env.CODEBUFF_API_KEY,
8180
cwd: process.cwd(),
82-
onError: (e) => console.error('Codebuff error:', e.message),
8381
})
8482

8583
// 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).
@@ -102,16 +100,8 @@ async function main() {
102100
method: z.enum(['GET', 'POST']).default('GET'),
103101
headers: z.record(z.string(), z.string()).optional(),
104102
}),
105-
outputSchema: z.array(
106-
z.object({
107-
type: z.literal('json'),
108-
value: z.object({
109-
message: z.string(),
110-
}),
111-
}),
112-
),
113103
exampleInputs: [{ url: 'https://api.example.com/data', method: 'GET' }],
114-
handler: async ({ url, method, headers }) => {
104+
execute: async ({ url, method, headers }) => {
115105
const response = await fetch(url, { method, headers })
116106
const data = await response.text()
117107
return [
@@ -136,8 +126,6 @@ async function main() {
136126
})
137127

138128
console.log('Final output:', output)
139-
140-
client.closeConnection()
141129
}
142130

143131
main()

sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@codebuff/sdk",
33
"private": false,
4-
"version": "0.3.0",
4+
"version": "0.3.1",
55
"description": "Official SDK for Codebuff — AI coding agent & framework",
66
"license": "Apache-2.0",
77
"type": "module",

0 commit comments

Comments
 (0)