Spaces:
Sleeping
Sleeping
| import asyncio | |
| from textwrap import dedent | |
| from agno.agent import Agent | |
| from agno.models.openai import OpenAIChat | |
| from agno.tools.mcp import MCPTools | |
| async def run_agent(message: str) -> None: | |
| """Financial analysis agent using tools of AlphaVantage Financial API""" | |
| # MCP server to access via SSE | |
| async with MCPTools(url="http://127.0.0.1:7860/gradio_api/mcp/sse", transport="sse") as mcp_tools: | |
| agent = Agent( | |
| model=OpenAIChat(id="gpt-4o",api_key="sk-proj-3KEXz61QJobfIoHM9NvsT3BlbkFJvY3FwiIMMOD9hFe97ctp"), | |
| tools=[mcp_tools], | |
| instructions=dedent("""\ | |
| tu es un agent | |
| """), | |
| markdown=True, | |
| show_tool_calls=True, | |
| ) | |
| # Run the agent | |
| await agent.aprint_response(message, stream=True) | |
| if __name__ == "__main__": | |
| #asyncio.run(run_agent("reserve moi un padel: jerome, olivier, bob, john, terrain1, 10h")) | |
| asyncio.run(run_agent("donne moi un rebu en italien en utilisant les fonctions du serveur mcp")) | |
| #asyncio.run(run_agent("donne moi un rebu en utilisant les fonctions du serveur mcp")) | |