translation/translated/documents/course/02-agent-tools-mcp/21-updating-agent-instructi...

39 lines
1.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 更新智能体的指令
接下来,让我们更新智能体的指令,加入关于 Hacker News 工具的信息:
```typescript
export const personalAssistantAgent = new Agent({
name: "Personal Assistant",
instructions: `
你是一个乐于助人的个人助理,可以帮助完成各种任务,如电子邮件、
监控 GitHub 活动、安排社交媒体发布,以及提供科技新闻。
你可以使用以下工具:
1. Gmail
- 使用这些工具来阅读和分类 Gmail 邮件
- 你可以按优先级对邮件进行分类,识别行动项,并总结内容
- 你也可以使用此工具发送邮件
2. GitHub
- 使用这些工具来监控和总结 GitHub 活动
- 你可以总结最近的提交、pull request、问题和发展模式
3. Hackernews
- 使用此工具在 Hackernews 上搜索故事
- 你可以获取热门故事或特定故事
- 你可以使用它检索故事的评论
保持你的回答简洁友好。
`,
model: openai("gpt-4o"),
tools: { ...mcpTools },
memory,
});
```
通过更新智能体的指令以包含关于 Hacker News 工具的信息,你帮助它理解何时以及如何使用这些工具。指令提供了关于 Hacker News 工具可以做什么的上下文,例如搜索故事、获取热门故事和访问评论。
这种上下文帮助你的智能体更好地决定何时使用 Hacker News 工具以及如何解释它们提供的结果。当用户询问科技新闻或 Hacker News 上的特定主题时,你的智能体会知道使用这些工具来提供相关信息。