Restored accidentally deleted agno script

This commit is contained in:
Michael Panchenko committed 2025-04-01 18:49:36 +02:00
1 parent 83f39564cc
commit e6bf952cf6
1 file changed
+27 -24
+27 -24
View File
@@ -1,13 +1,19 @@
import os
from logging import Logger
from agno.agent.agent import Agent
from agno.memory.agent import AgentMemory
from agno.models.anthropic.claude import Claude
from agno.models.google.gemini import Gemini
from agno.playground.playground import Playground
from agno.playground.serve import serve_playground_app
from agno.storage.sqlite import SqliteStorage
from dotenv import load_dotenv
from sensai.util import logging
from sensai.util.helper import mark_used
from serena.agent import SerenaAgent
from serena.agno import SerenaAgnoToolkit
mark_used(Gemini, Claude)
@@ -30,30 +36,27 @@ os.makedirs(os.path.dirname(sql_db_path), exist_ok=True)
if os.path.exists(sql_db_path):
os.remove(sql_db_path)
for tool_name in serena_agent.list_tool_names():
print(tool_name)
model = Claude(id="claude-3-7-sonnet-20250219")
# model = Gemini(id="gemini-2.5-pro-exp-03-25")
# model = Claude(id="claude-3-7-sonnet-20250219")
# # model = Gemini(id="gemini-2.5-pro-exp-03-25")
agno_agent = Agent(
name="Serena",
model=model,
storage=SqliteStorage(table_name="serena_agent_sessions", db_file=sql_db_path),
description="A fully-featured coding assistant",
tools=[SerenaAgnoToolkit(serena_agent)], # type: ignore
show_tool_calls=False,
markdown=True,
system_message=serena_agent.prompt_factory.create_system_prompt(),
read_tool_call_history=False,
telemetry=False,
memory=AgentMemory(),
add_history_to_messages=True,
num_history_responses=100, # you might want to adjust this (expense vs. history awareness)
)
# agno_agent = Agent(
# name="Serena",
# model=model,
# storage=SqliteAgentStorage(table_name="serena_agent_sessions", db_file=sql_db_path),
# description="A fully-featured coding assistant",
# tools=[SerenaAgnoToolkit(serena_agent)], # type: ignore
# show_tool_calls=False,
# markdown=True,
# system_message=serena_agent.prompt_factory.create_system_prompt(),
# read_tool_call_history=False,
# telemetry=False,
# memory=AgentMemory(),
# add_history_to_messages=True,
# num_history_responses=100, # you might want to adjust this (expense vs. history awareness)
# )
# The app object must be in the module scope so that the server can access it for hot reloading
app = Playground(agents=[agno_agent]).get_app()
# # The app object must be in the module scope so that the server can access it for hot reloading
# app = Playground(agents=[agno_agent]).get_app()
# if __name__ == "__main__":
# serve_playground_app("agno_agent:app", reload=False)
if __name__ == "__main__":
serve_playground_app("agno_agent:app", reload=False)