Quick Start
Three lines to decide
const act = new AgenticAct({
provider: 'openai',
apiKey: 'sk-...',
// 路由准则 — 告诉 AI 怎么思考、怎么选
prompt: `他工作时极度讨厌被打断,除非紧急一律静默排队。
做饭时喜欢听语音播报。晚上 11 点后不要用语音。`,
actions: [
{
id: 'voice',
name: '语音播报',
description: '通过音箱语音告知。适合用户没在看屏幕的场景',
schema: { content: 'string', volume: 'low|normal' },
handler: async (params) => speaker.say(params.content)
}
]
})
// 只决策
const decision = await act.decide({ text: '外卖到了', image: cameraFrame })
// → { action: 'voice', params: { content: '外卖到楼下了', volume: 'low' } }
// 决策 + 执行
const result = await act.run({ text: '会议要开始了' })
// → { action: 'voice', params: {...}, executed: true }