Skip to content

Instantly share code, notes, and snippets.

@mstrYoda
Created February 28, 2025 08:49
Show Gist options
  • Select an option

  • Save mstrYoda/563850d05b060538e4a3383a85a423d2 to your computer and use it in GitHub Desktop.

Select an option

Save mstrYoda/563850d05b060538e4a3383a85a423d2 to your computer and use it in GitHub Desktop.
ai agent poc with agno (phidata)
from agno.agent import Agent, AgentMemory
from agno.models.google import Gemini
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.tools.file import FileTools
from agno.memory.db.sqlite import SqliteMemoryDb
from agno.memory.summarizer import MemorySummarizer
from agno.memory.classifier import MemoryClassifier
from agno.storage.agent.sqlite import SqliteAgentStorage
gemini_model = Gemini(id="gemini-2.0-flash-exp", api_key="")
leader_memory = SqliteMemoryDb(db_file="leader_memory.db")
leader_storage = SqliteAgentStorage(table_name="agent_sessions", db_file="agent_storage.db")
team = Agent(
model=gemini_model,
description= """
You are an expert about web research and file operations.
Your job is to use the tools provided to solve the given problem.
""",
role="web researcher",
instructions=["If you remember the given task, return your answer from memory",
"If user asks somethink, search for the most relevant information on the web.",
"If user asks a file operation, use the file agent and write the information you gain to file",
"If you face with any error return error message to the user"],
session_id="f6961678-58a9-44e9-b74a-6da11add6f59",
add_history_to_messages=True,
num_history_responses=10,
tools=[DuckDuckGoTools(), FileTools()],
memory = AgentMemory(
db=leader_memory,
update_user_memories_after_run=True, create_user_memories=True, create_session_summary=True,
summarizer=MemorySummarizer(model=gemini_model),
classifier=MemoryClassifier(model=gemini_model)),
storage=leader_storage,
show_tool_calls=True,
monitoring=True,
debug_mode=True,
)
team.cli_app(markdown=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment