Skip to content

Serena + OpenRouter + Agno (ERROR OPENAI_API_KEY not set) #149

@sunwukonga

Description

@sunwukonga

Intention

To use OpenRouter and Serena with Agno.

Observation

Image

This is confusing, because it seems to me that the Serena + Agno documentation in the README must not work for anyone, since only Claude and Gemini are configured out of the box.

Expected

README instructions for Agno + Serena should work with models other than OpenAI.

Investigation

  1. This seems to be caused by AgentMemory not supporting any models other than OpenAI-like models.
    [Bug]: Wrong Classifier on AgentMemory for Ollama agno-agi/agno#2607 (comment)

  2. Serena is currently using agno 1.2.15 but the latest agno version is 1.5.6 which uses memory in a different way that seems to allow specification of the model. https://docs.agno.com/agents/memory#show-me-the-code%3A-memory-%26-storage-in-action

Attempted Remediation

  1. Attempted to specify OpenRouter with "openai/o3", but AgentMemory reaches for OpenAI by default, using the env OPENAI_API_KEY directly.
  2. Attempted to modify SerenaAgnoAgentProvider to specify the OpenRouter model into the classifier argument of Agent, but no cigar.
  3. Added OpenRouter model simultaneously for classifier, summarizer, and manager.
  4. Updated agno to 1.5.6 and made the appropriate changes to src/serena/agno.py to use the supplied model.
  5. Removed memory from Agent and set enable_agentic_memory to False.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions