代码

cookbook/tools/github_tools.py
from agno.agent import Agent
from agno.tools.github import GithubTools

agent = Agent(
    instructions=[
        "使用你的工具回答有关 agno-agi/agno 仓库的问题",
        "除非被明确要求,否则不要创建任何 issue 或 pull request",
    ],
    tools=[GithubTools()],
    show_tool_calls=True,
)
agent.print_response("List open pull requests", markdown=True)

用法

1

创建虚拟环境

打开 Terminal 并创建一个 python 虚拟环境。

python3 -m venv .venv
source .venv/bin/activate
2

设置你的 GitHub 令牌

export GITHUB_TOKEN=xxx
export OPENAI_API_KEY=xxx
3

安装库

pip install -U PyGithub openai agno
4

运行 Agent

python cookbook/tools/github_tools.py