Thanks to visit codestin.com
Credit goes to github.com

Skip to content

280601922/agno_study

Repository files navigation

Agno Basic Knowledge

Core Agno Features and Utilization

  1. Agent Architecture

Agno agents are autonomous AI programs with three core components:

  • Model: The LLM brain (supports 20+ providers including OpenAI, Anthropic, Google, etc.)
  • Tools: Functions for external system interaction (80+ pre-built toolkits)
  • Instructions: System prompts that guide agent behavior
from agno.agent import Agent
from agno.models.anthropic import Claude
from agno.tools.hackernews import HackerNewsTools

agent = Agent(
    model=Claude(id="claude-sonnet-4-5"),
    tools=[HackerNewsTools()],
    markdown=True,
)
  1. Multi-Agent Teams

Teams orchestrate multiple specialized agents for complex tasks:

from agno.team.team import Team

team = Team(
    name="Research Finance Team",
    mode="coordinate",
    model=Claude(id="claude-sonnet-4-20250514"),
    members=[web_agent, finance_agent],
    tools=[ReasoningTools(add_instructions=True)],
)
  1. Memory System
  • Session Memory: Conversation history via SQLite/PostgreSQL storage
  • User Memory: Personalized insights stored across interactions
  • Session Summaries: Condensed versions of long chats
  1. Knowledge Base (Agentic RAG) Dynamic knowledge retrieval from vector databases:
from agno.knowledge.pdf_url import PDFUrlKnowledgeBase
from agno.vectordb.lancedb import LanceDb

knowledge_base = PDFUrlKnowledgeBase(
    urls=["https://agno-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf"],
    vector_db=LanceDb(table_name="recipes", uri="tmp/lancedb")
)
  1. Reasoning Capabilities

Three approaches to chain-of-thought reasoning:

  • Reasoning Models: Using models trained to reason internally (o-series, Claude)
  • Reasoning Tools: ThinkingTools for explicit chain-of-thought
  • Reasoning Agents: Secondary reasoning agent for complex problem solving
  1. Workflows

Deterministic, stateful, multi-agent programs using Python:

from agno.workflow import Workflow, RunResponse

class BlogPostGenerator(Workflow):
    def run(self, topic: str) -> Iterator[RunResponse]:
        # Custom Python logic with loops, conditionals
        research_content = self.searcher.run(topic)
        analysis = self.analyst.run(research_content.content)
        yield from self.writer.run(analysis.content, stream=True)

AgnoOS Integration

  • What is AgnoOS?

AgnoOS is Agno 2.0's runtime environment that transforms Agno from a framework into a complete operating system for AI agents. Key components:

  1. Pre-built FastAPI Runtime

    Instant API endpoints for agents, teams, and workflows No need to write custom serving code Production-ready from day one

  2. Control Plane

    Web UI for testing and monitoring agents Real-time visibility into agent operations Direct browser connection to your cloud-deployed AgentOS

  3. In-Cloud Privacy

    Complete data sovereignty - no external data transmission Your AgentOS runs entirely in your infrastructure Enterprise-grade security and privacy

  4. Agent Registry

    Unified dashboard for all running agents, teams, workflows Metadata and performance statistics Centralized management interface

  • Practical Examples

Financial Analysis Team

  # Web search specialist
web_agent = Agent(
    name="Web Search Agent",
    tools=[DuckDuckGoTools()],
    instructions="Always include sources"
)

# Financial data specialist  
finance_agent = Agent(
    name="Finance Agent",
    tools=[YFinanceTools(stock_price=True, analyst_recommendations=True)],
    instructions="Use tables to display financial data"
)

# Coordinating team
team = Team(
    members=[web_agent, finance_agent],
    instructions="Provide comprehensive financial analysis"
)

RAG-Enabled Agent

# Thai cuisine expert with knowledge base
agent = Agent(
    model=OpenAIChat(id="gpt-4o"),
    knowledge=PDFUrlKnowledgeBase(
        urls=["https://agno-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf"],
        vector_db=LanceDb(uri="tmp/lancedb", table_name="recipes")
    ),
    tools=[DuckDuckGoTools()],
    instructions=["Search knowledge base first", "Use web search for additional context"]
)

PIC_GENERATE_MODEL DESCRIPTION

Official Document

Please note that the output of the CogView-4 model is an image URL. You will need to download the image using this URL.

Call Example

python api(sdk) method:

  • install python sdk

    uv add zai-sdk
    uv lock && uv sync
  • Verify Installation

    import zai
    print(zai.__version__)  
  • usage example

      from zai import ZhipuAiClient
    
      # 请填写您自己的 APIKey
      client = ZhipuAiClient(api_key="your-api-key")
      response = client.images.generations(
          # 请填写您要调用的模型名称
          model="cogView-4-250304", 
          prompt="一只可爱的小猫咪,坐在阳光明媚的窗台上,背景是蓝天白云",
      )
      print(response.data[0].url)

curl http(s) method:

curl --request POST \
  --url https://open.bigmodel.cn/api/paas/v4/images/generations \
  --header 'Authorization: Bearer  {PIC_GENERATE_MODEL_API_KEY}' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "cogView-4-250304",
  "prompt": "In a classroom in the 1980s, the words“Study hard” were written on the blackboard, and a white Muppet cat was lying on the platform, looking out of the window as the sun shone into the classroom",
  "size": "1024x1024"
}'

About

agno study

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages