Skip to content

Commit 5d6a1a4

Browse files
committed
docs(sdk): fix README examples to be valid copy-pasteable code
1 parent 3fa8a3c commit 5d6a1a4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

sdk/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,23 +141,24 @@ main()
141141
Loads agent definitions from `.agents` directories on disk.
142142

143143
```typescript
144-
import { loadLocalAgents } from '@codebuff/sdk'
144+
import { loadLocalAgents, CodebuffClient } from '@codebuff/sdk'
145145

146146
// Load from default locations (.agents in cwd, parent, or home)
147147
const agents = await loadLocalAgents({ verbose: true })
148148

149-
// Load from a specific directory
150-
const agents = await loadLocalAgents({ agentsPath: './my-agents' })
149+
// Or load from a specific directory
150+
// const agents = await loadLocalAgents({ agentsPath: './my-agents' })
151151

152-
// Load and validate agents (invalid agents are filtered out)
153-
const agents = await loadLocalAgents({ validate: true, verbose: true })
152+
// Or load and validate agents (invalid agents are filtered out)
153+
// const agents = await loadLocalAgents({ validate: true, verbose: true })
154154

155155
// Access source file path for debugging
156156
for (const agent of Object.values(agents)) {
157157
console.log(`${agent.id} loaded from ${agent._sourceFilePath}`)
158158
}
159159

160160
// Use the loaded agents with client.run()
161+
const client = new CodebuffClient({ apiKey: process.env.CODEBUFF_API_KEY })
161162
const result = await client.run({
162163
agent: 'my-custom-agent',
163164
agentDefinitions: Object.values(agents),

0 commit comments

Comments
 (0)