refactor: Update travel planner and GitHub agent to use RunOutput and enhance requirements

- Changed `add_datetime_to_instructions` to `add_datetime_to_context` in travel planner for better context handling.
- Updated response type to `RunOutput` in both travel planner and GitHub agent for improved type safety.
- Specified minimum version for the 'agno' package in requirements.txt for compatibility.
This commit is contained in:
Shubhamsaboo
2025-11-09 15:02:32 -08:00
parent 4fc1412062
commit 62f760c18e
4 changed files with 24 additions and 30 deletions
@@ -2,6 +2,7 @@ import re
import asyncio
from textwrap import dedent
from agno.agent import Agent
from agno.run.agent import RunOutput
from agno.tools.mcp import MultiMCPTools
from agno.tools.googlesearch import GoogleSearchTools
from agno.models.openai import OpenAIChat
@@ -118,9 +119,9 @@ async def run_mcp_travel_planner(destination: str, num_days: int, preferences: s
"Generate the complete, detailed itinerary in one response without follow-up questions"
],
tools=[mcp_tools, GoogleSearchTools()],
add_datetime_to_instructions=True,
add_datetime_to_context=True,
markdown=True,
show_tool_calls=False,
debug_mode=False,
)
# Create the planning prompt
@@ -169,7 +170,7 @@ async def run_mcp_travel_planner(destination: str, num_days: int, preferences: s
Generate the complete, highly detailed itinerary in one response without asking for clarification.
"""
response = await travel_planner.arun(prompt)
response: RunOutput = await travel_planner.arun(prompt)
return response.content
finally:
@@ -1,5 +1,5 @@
streamlit
agno
agno>=2.2.10
openai
icalendar
google-search-results
+18 -25
View File
@@ -3,9 +3,9 @@ import os
import streamlit as st
from textwrap import dedent
from agno.agent import Agent
from agno.run.agent import RunOutput
from agno.tools.mcp import MCPTools
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
from mcp import StdioServerParameters
st.set_page_config(page_title="🐙 GitHub MCP Agent", page_icon="🐙", layout="wide")
@@ -86,26 +86,22 @@ async def run_github_agent(message):
}
)
async with stdio_client(server_params) as (read, write):
async with ClientSession(read, write) as session:
mcp_tools = MCPTools(session=session)
await mcp_tools.initialize()
agent = Agent(
tools=[mcp_tools],
instructions=dedent("""\
You are a GitHub assistant. Help users explore repositories and their activity.
- Provide organized, concise insights about the repository
- Focus on facts and data from the GitHub API
- Use markdown formatting for better readability
- Present numerical data in tables when appropriate
- Include links to relevant GitHub pages when helpful
"""),
markdown=True,
)
response = await asyncio.wait_for(agent.arun(message), timeout=120.0)
return response.content
async with MCPTools(server_params=server_params) as mcp_tools:
agent = Agent(
tools=[mcp_tools],
instructions=dedent("""\
You are a GitHub assistant. Help users explore repositories and their activity.
- Provide organized, concise insights about the repository
- Focus on facts and data from the GitHub API
- Use markdown formatting for better readability
- Present numerical data in tables when appropriate
- Include links to relevant GitHub pages when helpful
"""),
markdown=True,
)
response: RunOutput = await asyncio.wait_for(agent.arun(message), timeout=120.0)
return response.content
except asyncio.TimeoutError:
return "Error: Request timed out after 120 seconds"
@@ -152,6 +148,3 @@ if 'result' not in locals():
</div>""",
unsafe_allow_html=True
)
st.markdown("---")
st.write("Built with Streamlit, Agno, and Model Context Protocol ❤️")
@@ -1,5 +1,5 @@
streamlit>=1.28.0
agno>=1.1.0
agno>=2.2.10
mcp>=0.1.0
openai>=1.0.0
asyncio>=3.4.3