OpenAI Agents SDK (Python)
Python க்கான OpenAI Agents SDK: Authorization ஹெடருடன் MCPServerStreamableHttp, mcp_servers இல் ஏஜென்டுக்கு அனுப்பப்படுகிறது.
- API விசை (Bearer)
ஏஜென்ட் குறியீடு
பரிந்துரைக்கப்படுகிறதுimport asyncio, os
from agents import Agent, Runner
from agents.mcp import MCPServerStreamableHttp
async def main():
async with MCPServerStreamableHttp(
name="aicharged",
params={
"url": "https://aicharged.io/api/v1/mcp",
"headers": {"Authorization": f"Bearer {os.environ['AICHARGED_API_KEY']}"},
"timeout": 30,
},
) as server:
agent = Agent(name="Assistant", instructions="Use the aicharged.io tools.", mcp_servers=[server])
result = await Runner.run(agent, "List my recent aicharged.io runs")
print(result.final_output)
asyncio.run(main())
தொகுப்பை நிறுவவும்
pip install openai-agents