代码
cookbook/tools/confluence_tools.py
Copy
from agno.agent import Agent
from agno.tools.confluence import ConfluenceTools
agent = Agent(
name="Confluence agent",
tools=[ConfluenceTools()],
show_tool_calls=True,
markdown=True,
)
agent.print_response("有多少个空间以及它们的名字是什么?")
agent.print_response(
"'LLM 空间' 中的页面内容是什么?"
)
agent.print_response("'LLM' 空间的所有页面名称是什么?")
agent.print_response("能在 'LLM' 空间创建一个名为 'TESTING' 的新页面吗?")
用法
1
创建虚拟环境
打开
Terminal
并创建一个 python 虚拟环境。Copy
python3 -m venv .venv
source .venv/bin/activate
2
设置您的 API 凭证
Copy
export CONFLUENCE_API_TOKEN=xxx
export CONFLUENCE_SITE_URL=xxx
export CONFLUENCE_USERNAME=xxx
export OPENAI_API_KEY=xxx
3
安装库
Copy
pip install -U atlassian-python-api openai agno
4
运行 Agent
Copy
python cookbook/tools/confluence_tools.py