Files
idoubi 67e120b2ed Initial commit: Open Agent SDK (TypeScript)
Open-source Agent SDK with 30+ built-in tools, MCP integration,
multi-turn sessions, subagents, and streaming support.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 17:51:53 +08:00

27 lines
777 B
TypeScript

/**
* Example 5: Custom System Prompt
*
* Shows how to customize the agent's behavior with a system prompt.
*
* Run: npx tsx examples/05-custom-system-prompt.ts
*/
import { createAgent } from '../src/index.js'
async function main() {
console.log('--- Example 5: Custom System Prompt ---\n')
const agent = createAgent({
model: process.env.CODEANY_MODEL || 'claude-sonnet-4-6',
maxTurns: 5,
systemPrompt:
'You are a senior code reviewer. When asked to review code, focus on: ' +
'1) Security issues, 2) Performance concerns, 3) Maintainability. ' +
'Be concise and use bullet points.',
})
const result = await agent.prompt('Read src/agent.ts and give a brief code review.')
console.log(result.text)
}
main().catch(console.error)