GemAI_Backend / main.py
Aasher's picture
Add markdown rendering of agent response
14f5f58
from agno.agent import Agent
from agno.models.google import Gemini
from agno.models.groq import Groq
from agno.db.redis import RedisDb
from agno.os import AgentOS
from agno.memory import MemoryManager
from app.prompts import AGENT_INSTRUCTIONS
from app.tools import fetch_products
from app.config import settings
import os
from dotenv import load_dotenv
load_dotenv()
redis_db = RedisDb(
db_url=os.getenv("REDIS_URL"),
memory_table="user_memories",
)
tools = [fetch_products]
shopping_agent = Agent(
model=Gemini(id=settings.AGENT_MODEL),
name=settings.AGENT_NAME,
id=settings.AGENT_ID,
markdown=True,
add_datetime_to_context=True,
db=redis_db,
tools=tools,
instructions=AGENT_INSTRUCTIONS,
enable_agentic_memory=True,
memory_manager=MemoryManager(
Groq(id=settings.MEMORY_MANAGER_MODEL),
db=redis_db,
),
add_history_to_context=True,
num_history_runs=settings.NUM_HISTORY_RUNS,
)
agent_os = AgentOS(
os_id="shopping-agent-os",
description="A shopping Agent OS that helps users find the best products from amazon based on their needs.",
agents=[shopping_agent]
)
app = agent_os.get_app()
if __name__ == "__main__":
agent_os.serve(app="main:app", port=7860, host="0.0.0.0", reload=True)