Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: simple agent #2

Merged
merged 2 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions agents/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class AgentSettings(BaseSettings):
"""

gpt_4: str = "gpt-4o"
gpt_4o_mini: str = "gpt-4o-mini"
embedding_model: str = "text-embedding-3-small"
default_max_completion_tokens: int = 16000
default_temperature: float = 0
Expand Down
36 changes: 36 additions & 0 deletions agents/simple_agent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from typing import Optional

from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.storage.agent.postgres import PostgresAgentStorage

from agents.settings import agent_settings
from db.session import db_url


simple_agent_storage = PostgresAgentStorage(table_name="simple_agent", db_url=db_url)


def get_simple_agent(
user_id: Optional[str] = None,
session_id: Optional[str] = None,
debug_mode: bool = False,
) -> Agent:
return Agent(
name="Simple Agent",
role="Simple agent",
agent_id="simple-agent",
session_id=session_id,
user_id=user_id,
model=OpenAIChat(
id=agent_settings.gpt_4o_mini,
max_tokens=agent_settings.default_max_completion_tokens,
temperature=agent_settings.default_temperature,
),
storage=simple_agent_storage,
add_history_to_messages=True,
num_history_responses=5,
add_datetime_to_instructions=True,
markdown=True,
debug_mode=debug_mode,
)
5 changes: 3 additions & 2 deletions api/routes/playground.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from agents.finance import get_finance_agent
from agents.research import get_research_agent
from agents.web_search import get_web_search_agent

from agents.simple_agent import get_simple_agent
# Import workflows
from workflows.blog_post_generator import get_blog_post_generator
from workflows.investment_report_generator import get_investment_report_generator
Expand All @@ -18,14 +18,15 @@
finance_agent = get_finance_agent(debug_mode=True)
research_agent = get_research_agent(debug_mode=True)
web_search_agent = get_web_search_agent(debug_mode=True)
simple_agent = get_simple_agent(debug_mode=True)

blog_post_generator = get_blog_post_generator(debug_mode=True)
investment_report_generator = get_investment_report_generator(debug_mode=True)
startup_idea_validator = get_startup_idea_validator(debug_mode=True)

# Create a playground instance
playground = Playground(
agents=[web_search_agent, research_agent, finance_agent],
agents=[simple_agent,web_search_agent, research_agent, finance_agent],
workflows=[blog_post_generator, investment_report_generator, startup_idea_validator],
)
# Log the playground endpoint with phidata.app
Expand Down
Loading