Pydantic AI
Pydantic AI: MCPToolset โดยใช้คีย์ API เป็น auth แล้วเพิ่มเข้า toolsets ของเอเจนต์
- คีย์ API (Bearer)
- ลงชื่อเข้าใช้ด้วย OAuth
โค้ดเอเจนต์
แนะนำimport asyncio, os
from pydantic_ai import Agent
from pydantic_ai.mcp import MCPToolset
toolset = MCPToolset("https://aicharged.io/api/v1/mcp", auth=os.environ["AICHARGED_API_KEY"])
agent = Agent("openai:gpt-6.1-sol", toolsets=[toolset])
async def main():
result = await agent.run("List my recent aicharged.io runs")
print(result.output)
asyncio.run(main())
ติดตั้งแพ็กเกจ
pip install pydantic-ai