Skip to content

100+ AI Agents, Agent Skills and RAG Apps - Free and Open Source.

refactor: Enhance AI agents with ExaTools integration and update requirements

Shubhamsaboob687794a5278
diff --git a/advanced_ai_agents/multi_agent_apps/agent_teams/ai_competitor_intelligence_agent_team/competitor_agent_team.py b/advanced_ai_agents/multi_agent_apps/agent_teams/ai_competitor_intelligence_agent_team/competitor_agent_team.py
index 10932def..20b13ba7 100644
--- a/advanced_ai_agents/multi_agent_apps/agent_teams/ai_competitor_intelligence_agent_team/competitor_agent_team.py
+++ b/advanced_ai_agents/multi_agent_apps/agent_teams/ai_competitor_intelligence_agent_team/competitor_agent_team.py
@@ -1,6 +1,7 @@
import streamlit as st
-# from exa_py import Exa
from agno.agent import Agent
+from agno.run.agent import RunOutput
+from agno.tools.exa import ExaTools
from agno.tools.firecrawl import FirecrawlTools
from agno.models.openai import OpenAIChat
from agno.tools.duckduckgo import DuckDuckGoTools
@@ -66,10 +67,6 @@ if "openai_api_key" in st.session_state and "firecrawl_api_key" in st.session_st
if (search_engine == "Perplexity AI - Sonar Pro" and "perplexity_api_key" in st.session_state) or \
(search_engine == "Exa AI" and "exa_api_key" in st.session_state):
- # Initialize Exa only if selected
- if search_engine == "Exa AI":
- exa = Exa(api_key=st.session_state.exa_api_key)
-
firecrawl_tools = FirecrawlTools(
api_key=st.session_state.firecrawl_api_key,
scrape=False,
@@ -77,23 +74,42 @@ if "openai_api_key" in st.session_state and "firecrawl_api_key" in st.session_st
limit=5
)
+ # Create ExaTools agent for finding competitor URLs
+ if search_engine == "Exa AI":
+ exa_tools = ExaTools(
+ api_key=st.session_state.exa_api_key,
+ category="company",
+ num_results=3
+ )
+ competitor_finder_agent = Agent(
+ model=OpenAIChat(id="gpt-4o", api_key=st.session_state.openai_api_key),
+ tools=[exa_tools],
+ debug_mode=True,
+ markdown=True,
+ instructions=[
+ "You are a competitor finder agent. Use ExaTools to find competitor company URLs.",
+ "When given a URL, find similar companies. When given a description, search for companies matching that description.",
+ "Return ONLY the URLs, one per line, with no additional text."
+ ]
+ )
+
firecrawl_agent = Agent(
model=OpenAIChat(id="gpt-4o", api_key=st.session_state.openai_api_key),
tools=[firecrawl_tools, DuckDuckGoTools()],
- show_tool_calls=True,
+ debug_mode=True,
markdown=True
)
analysis_agent = Agent(
model=OpenAIChat(id="gpt-4o", api_key=st.session_state.openai_api_key),
- show_tool_calls=True,
+ debug_mode=True,
markdown=True
)
# New agent for comparing competitor data
comparison_agent = Agent(
model=OpenAIChat(id="gpt-4o", api_key=st.session_state.openai_api_key),
- show_tool_calls=True,
+ debug_mode=True,
markdown=True
)
@@ -145,22 +161,16 @@ if "openai_api_key" in st.session_state and "firecrawl_api_key" in st.session_st
else: # Exa AI
try:
+ # Use ExaTools agent to find competitor URLs
if url:
- result = exa.find_similar(
- url=url,
- num_results=3,
- exclude_source_domain=True,
- category="company"
- )
+ prompt = f"Find 3 competitor company URLs similar to: {url}. Return ONLY the URLs, one per line."
else:
- result = exa.search(
- description,
- type="neural",
- category="company",
- use_autoprompt=True,
- num_results=3
- )
- return [item.url for item in result.results]
+ prompt = f"Find 3 competitor company URLs matching this description: {description}. Return ONLY the URLs, one per line."
+
+ response: RunOutput = competitor_finder_agent.run(prompt)
+ # Extract URLs from the response
+ urls = [line.strip() for line in response.content.strip().split('\n') if line.strip() and line.strip().startswith('http')]
+ return urls[:3] # Return up to 3 URLs
except Exception as e:
st.error(f"Error fetching competitor URLs from Exa: {str(e)}")
return []
@@ -263,7 +273,7 @@ if "openai_api_key" in st.session_state and "firecrawl_api_key" in st.session_st
formatted_data = json.dumps(competitor_data, indent=2)
print("Analysis Data:", formatted_data) # For debugging
- report = analysis_agent.run(
+ report: RunOutput = analysis_agent.run(
f"""Analyze the following competitor data in JSON format and identify market opportunities to improve my own company:
{formatted_data}
diff --git a/advanced_ai_agents/multi_agent_apps/agent_teams/ai_competitor_intelligence_agent_team/requirements.txt b/advanced_ai_agents/multi_agent_apps/agent_teams/ai_competitor_intelligence_agent_team/requirements.txt
index 90958613..8b1080ff 100644
--- a/advanced_ai_agents/multi_agent_apps/agent_teams/ai_competitor_intelligence_agent_team/requirements.txt
+++ b/advanced_ai_agents/multi_agent_apps/agent_teams/ai_competitor_intelligence_agent_team/requirements.txt
@@ -1,5 +1,4 @@
-exa-py==1.7.1
firecrawl-py==1.9.0
duckduckgo-search==7.2.1
-agno
+agno>=2.2.10
streamlit==1.41.1
\ No newline at end of file
diff --git a/advanced_ai_agents/multi_agent_apps/agent_teams/ai_finance_agent_team/finance_agent_team.py b/advanced_ai_agents/multi_agent_apps/agent_teams/ai_finance_agent_team/finance_agent_team.py
index 8758cf89..47fa68e3 100644
--- a/advanced_ai_agents/multi_agent_apps/agent_teams/ai_finance_agent_team/finance_agent_team.py
+++ b/advanced_ai_agents/multi_agent_apps/agent_teams/ai_finance_agent_team/finance_agent_team.py
@@ -1,17 +1,21 @@
from agno.agent import Agent
+from agno.team import Team
from agno.models.openai import OpenAIChat
-from agno.storage.agent.sqlite import SqliteAgentStorage
+from agno.db.sqlite import SqliteDb
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.tools.yfinance import YFinanceTools
-from agno.playground import Playground, serve_playground_app
+from agno.os import AgentOS
+
+# Setup database for storage
+db = SqliteDb(db_file="agents.db")
web_agent = Agent(
name="Web Agent",
role="Search the web for information",
model=OpenAIChat(id="gpt-4o"),
tools=[DuckDuckGoTools()],
- storage=SqliteAgentStorage(table_name="web_agent", db_file="agents.db"),
- add_history_to_messages=True,
+ db=db,
+ add_history_to_context=True,
markdown=True,
)
@@ -21,20 +25,21 @@ finance_agent = Agent(
model=OpenAIChat(id="gpt-4o"),
tools=[YFinanceTools(stock_price=True, analyst_recommendations=True, company_info=True, company_news=True)],
instructions=["Always use tables to display data"],
- storage=SqliteAgentStorage(table_name="finance_agent", db_file="agents.db"),
- add_history_to_messages=True,
+ db=db,
+ add_history_to_context=True,
markdown=True,
)
-agent_team = Agent(
- team=[web_agent, finance_agent],
+agent_team = Team(
name="Agent Team (Web+Finance)",
model=OpenAIChat(id="gpt-4o"),
- show_tool_calls=True,
+ members=[web_agent, finance_agent],
+ debug_mode=True,
markdown=True,
)
-app = Playground(agents=[agent_team]).get_app()
+agent_os = AgentOS(agents=[agent_team])
+app = agent_os.get_app()
if __name__ == "__main__":
- serve_playground_app("finance_agent_team:app", reload=True)
\ No newline at end of file
+ agent_os.serve(app="finance_agent_team:app", reload=True)
\ No newline at end of file
diff --git a/advanced_ai_agents/multi_agent_apps/agent_teams/ai_finance_agent_team/requirements.txt b/advanced_ai_agents/multi_agent_apps/agent_teams/ai_finance_agent_team/requirements.txt
index 958c9bb7..4a467614 100644
--- a/advanced_ai_agents/multi_agent_apps/agent_teams/ai_finance_agent_team/requirements.txt
+++ b/advanced_ai_agents/multi_agent_apps/agent_teams/ai_finance_agent_team/requirements.txt
@@ -1,6 +1,5 @@
openai
-agno
+agno>=2.2.10
duckduckgo-search
yfinance
-fastapi[standard]
sqlalchemy
\ No newline at end of file
diff --git a/advanced_ai_agents/single_agent_apps/ai_movie_production_agent/movie_production_agent.py b/advanced_ai_agents/single_agent_apps/ai_movie_production_agent/movie_production_agent.py
index 0b201170..8815ed0b 100644
--- a/advanced_ai_agents/single_agent_apps/ai_movie_production_agent/movie_production_agent.py
+++ b/advanced_ai_agents/single_agent_apps/ai_movie_production_agent/movie_production_agent.py
@@ -2,23 +2,24 @@
import streamlit as st
from agno.agent import Agent
from agno.run.agent import RunOutput
+from agno.team import Team
from agno.tools.serpapi import SerpApiTools
-from agno.models.anthropic import Claude
+from agno.models.google import Gemini
from textwrap import dedent
# Set up the Streamlit app
st.title("AI Movie Production Agent 🎬")
st.caption("Bring your movie ideas to life with the teams of script writing and casting AI agents")
-# Get Anthropic API key from user
-anthropic_api_key = st.text_input("Enter Anthropic API Key to access Claude Sonnet 3.5", type="password")
+# Get Google API key from user
+google_api_key = st.text_input("Enter Google API Key to access Gemini 2.5 Flash", type="password")
# Get SerpAPI key from the user
serp_api_key = st.text_input("Enter Serp API Key for Search functionality", type="password")
-if anthropic_api_key and serp_api_key:
+if google_api_key and serp_api_key:
script_writer = Agent(
name="ScriptWriter",
- model=Claude(id="claude-3-5-sonnet-20240620", api_key=anthropic_api_key),
+ model=Gemini(id="gemini-2.5-flash", api_key=google_api_key),
description=dedent(
"""\
You are an expert screenplay writer. Given a movie idea and genre,
@@ -34,7 +35,7 @@ if anthropic_api_key and serp_api_key:
casting_director = Agent(
name="CastingDirector",
- model=Claude(id="claude-3-5-sonnet-20240620", api_key=anthropic_api_key),
+ model=Gemini(id="gemini-2.5-flash", api_key=google_api_key),
description=dedent(
"""\
You are a talented casting director. Given a script outline and character descriptions,
@@ -50,10 +51,10 @@ if anthropic_api_key and serp_api_key:
tools=[SerpApiTools(api_key=serp_api_key)],
)
- movie_producer = Agent(
+ movie_producer = Team(
name="MovieProducer",
- model=Claude(id="claude-3-5-sonnet-20240620", api_key=anthropic_api_key),
- team=[script_writer, casting_director],
+ model=Gemini(id="gemini-2.5-flash", api_key=google_api_key),
+ members=[script_writer, casting_director],
description="Experienced movie producer overseeing script and casting.",
instructions=[
"Ask ScriptWriter for a script outline based on the movie idea.",
diff --git a/advanced_ai_agents/single_agent_apps/ai_movie_production_agent/requirements.txt b/advanced_ai_agents/single_agent_apps/ai_movie_production_agent/requirements.txt
index fc46b552..cdb30392 100644
--- a/advanced_ai_agents/single_agent_apps/ai_movie_production_agent/requirements.txt
+++ b/advanced_ai_agents/single_agent_apps/ai_movie_production_agent/requirements.txt
@@ -1,5 +1,4 @@
streamlit
-agno
-anthropic
+agno>=2.2.10
google-search-results
lxml_html_clean
\ No newline at end of file