Skip to content

Migrate Agno Python Integration to v2 #578

@coldfire-x

Description

@coldfire-x

Agno v2 Migration - Python Integration

Summary

The Agno Python integration examples have been successfully migrated from Agno v1 to v2 to address breaking changes introduced in the Agno framework.

Changes Made

1. Dependency Updates

Files Modified:

  • integrations/agno/python/examples/pyproject.toml
  • integrations/agno/python/examples/requirements.txt

Changes:

- agno>=1.7.7
+ agno>=2.0.0

2. API Migration

All three agent files were updated to use the new Agno v2 API:

Files Modified:

  • integrations/agno/python/examples/server/api/agentic_chat.py
  • integrations/agno/python/examples/server/api/backend_tool_rendering.py
  • integrations/agno/python/examples/server/api/tool_based_generative_ui.py

Import Changes:

- from agno.app.agui.app import AGUIApp
+ from agno.os import AgentOS
+ from agno.os.interfaces.agui import AGUI

Pattern Changes:

- agui_app = AGUIApp(
-     agent=agent,
-     name="Agent Name",
-     app_id="app_id",
-     description="Description"
- )
- app = agui_app.get_app()

+ agent_os = AgentOS(
+     agents=[agent],
+     interfaces=[AGUI(agent=agent)]
+ )
+ app = agent_os.get_app()

3. YFinanceTools API Update

File Modified:

  • integrations/agno/python/examples/server/api/agentic_chat.py

Changes:

- YFinanceTools(
-     stock_price=True,
-     analyst_recommendations=True,
-     stock_fundamentals=True
- )
+ YFinanceTools()

In Agno v2, YFinanceTools no longer accepts boolean parameters to selectively enable tools. All tools are now included by default.

Breaking Changes from Agno v1 → v2

1. AGUIApp Deprecated

  • agno.app.agui.app.AGUIApp has been removed
  • Replaced with AgentOS + AGUI interface pattern

2. Metadata Parameters Removed

The name, app_id, and description parameters from AGUIApp are no longer available in the new AGUI interface. These were not used by the AG-UI protocol.

3. YFinanceTools Constructor

  • No longer accepts tool selection parameters
  • All tools are enabled by default

Migration Guide

For anyone maintaining similar integrations, follow these steps:

Step 1: Update Dependencies

# Update pyproject.toml or requirements.txt
agno>=2.0.0

# Install
uv sync
# or
pip install -U agno

Step 2: Update Imports

# Old (v1)
from agno.app.agui.app import AGUIApp

# New (v2)
from agno.os import AgentOS
from agno.os.interfaces.agui import AGUI

Step 3: Update Agent Wrapping

# Old (v1)
agui_app = AGUIApp(
    agent=agent,
    name="My Agent",
    app_id="my_agent",
    description="Description"
)
app = agui_app.get_app()

# New (v2)
agent_os = AgentOS(
    agents=[agent],
    interfaces=[AGUI(agent=agent)]
)
app = agent_os.get_app()

Step 4: Update YFinanceTools

# Old (v1)
YFinanceTools(stock_price=True, analyst_recommendations=True)

# New (v2)
YFinanceTools()

Testing

Verify Installation

uv run python -c "from agno.os import AgentOS; from agno.os.interfaces.agui import AGUI; print('✅ Success')"

Verify Module Imports

cd integrations/agno/python/examples
uv run python -c "from server.api import agentic_chat, backend_tool_rendering, tool_based_generative_ui; print('✅ All modules loaded')"

Start Server

PORT=9001 uv run python -c "from server import main; main()"
# Server should start on http://0.0.0.0:9001

Test Endpoints

# Check status endpoints
curl http://localhost:9001/agentic_chat/status
curl http://localhost:9001/backend_tool_rendering/status
curl http://localhost:9001/tool_based_generative_ui/status

# Expected response: {"status":"available"}

Compatibility

  • Agno Version: >=2.0.0 (tested with 2.1.7)
  • Python Version: >=3.12,<4.0
  • AG-UI Protocol: >=0.1.8

References

Related Files

  • integrations/agno/python/examples/pyproject.toml
  • integrations/agno/python/examples/requirements.txt
  • integrations/agno/python/examples/server/api/agentic_chat.py
  • integrations/agno/python/examples/server/api/backend_tool_rendering.py
  • integrations/agno/python/examples/server/api/tool_based_generative_ui.py

Issue Type: Maintenance
Priority: High
Status: Completed

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