Agno

repository·main·Indexed 12 days ago

https://github.com/phidatahq/phidata

A framework and runtime for building, running, and managing production-grade agent platforms. Agno provides an SDK for building agents, an AgentOS runtime for serving them, and a UI for management. It features a 'Capability Ladder' for incrementally adding tools, structured output, storage, memory, state, knowledge, learning, guardrails, human-in-the-loop, teams, and workflows to agentic software.

Tokens
257K
Snippets
872
Records
1.4K
Agent score
99%

What's inside Agno

  1. Introduction to Agno

    main

    Agno is a framework and runtime designed for building, running, and managing agent platforms. It provides three main components:

    1. Agno SDK: Used to build your agents.
    2. AgentOS Runtime: Used to run your agent platform as a service.
    3. AgentOS UI: Used to manage the platform.

    Agno is designed to give developers control over their agent stack, including data, memory, and security (via JWT-based RBAC), while enabling a learning loop through simulations and usage data.

  2. Overview of Team Workflow Tool Examples

    main

    The 03_tools cookbook directory contains several examples demonstrating how to manage and control tool usage within Agno Team workflows. Key capabilities demonstrated include:

    • Async Support: Using async_tools.py for asynchronous tool execution and async_toolkit_context.py to show how async toolkit tools appear in the team system message context.
    • Customization: Implementing custom tool logic via custom_tools.py.
    • Control & Constraints:
      • Limiting the total number of tool calls per Team run using tool_call_limit.py.
      • Forcing the model to use specific tools via tool_choice.py.
    • Hooks: Extending tool behavior using tool_hooks.py and member_tool_hooks.py.
  3. Overview of Agent Skills examples

    main

    The Agent Skills cookbook provides examples for defining and utilizing agent skills and helper scripts. Available examples include:

    • basic_skills.py: Demonstrates fundamental skill implementation.
    • sample_skills/code-review/scripts/check_style.py: Demonstrates how to implement code style checking skills.
    • sample_skills/git-workflow/scripts/commit_message.py: Demonstrates how to implement git workflow skills, such as generating commit messages.
  4. Overview of Agno features

    main

    Agno provides a comprehensive suite of features for production-grade agent platforms:

    • Production API: Over 50 endpoints supporting SSE and websockets.
    • Storage: Self-hosted storage for sessions, memory, knowledge, and traces.
    • Integrations: 100+ pre-built toolkits (e.g., GitHub, Slack, Postgres).
    • Context Providers: Live data access from Slack, Drive, wikis, MCP, and custom sources.
    • Human Approval: Ability to pause runs for user confirmation or block specific tools.
    • Observability: OpenTelemetry tracing, run history, and audit logs.
    • Security: Out-of-the-box JWT-based RBAC and multi-tenant isolation.
    • Interfaces: Expose agents via Slack, Telegram, WhatsApp, Discord, AG-UI, and A2A.
    • Scheduling: Built-in cron-based scheduling and background jobs.
    • Deployment: Container-based deployment on Docker, Railway, AWS, GCP, etc.
  5. Explore Agno agent examples

    main

    The cookbook/examples directory contains small, complete agent implementations that demonstrate different use cases:

    • second_brain: Demonstrates personal memory managed behind your own MCP server.
    • metrics_desk: Allows querying your production database from any MCP client.
    • team_brain: Implements a shared decision log that an entire team can write into.
  6. Explore Agno Agent Hooks

    main

    Agno provides several types of hooks to intercept and modify the agent's lifecycle. The following patterns are available in the cookbook examples:

    • Pre-hooks (pre_hook_input.py): Run logic before the agent processes user input.
    • Post-hooks (post_hook_output.py): Run logic after the agent has generated a response.
    • Session State Hooks (session_state_hooks.py): Hooks designed to read from or modify the agent's session state.
    • Stream Lifecycle Hooks (stream_hook.py): Intercept the lifecycle of a streaming response.
    • Tool Hooks (tool_hooks.py): Middleware-style hooks that wrap every individual tool call made by the agent.
  7. Understand core learning primitives in Agno

    main

    Agno provides several core primitives for managing user information, memory, and knowledge. These patterns allow agents to extract, update, and retrieve information to maintain context across sessions. The primary modes for these operations are:

    • ALWAYS mode: Information is extracted or updated automatically during every interaction.
    • AGENTIC mode: The agent decides when to perform updates or extractions based on the conversation context.

    Key primitives include:

    • User Profile: Extracting and updating structured user information.
    • User Memory: Managing long-term memory about user preferences and history.
    • Session Context: Tracking summaries, planning, goals, and progress within a specific session.
    • Learned Knowledge: Storing and retrieving information via vector search.
    • Entity Memory: Using specialized tools to manage entity-specific data (Note: Entity tools are AGENTIC-only in version 2.8.4).
  8. Monitor Agno agents and workflows with observability integrations

    main

    Agno provides observability support for tracing and monitoring agents, teams, and workflows. You can integrate with various third-party observability platforms using OpenInference or direct integrations.

    Supported root integrations include:

    • Arize Phoenix: via openinference or moving traces between projects.
    • Langfuse: via openinference or openlit.
    • LangSmith: via openinference.
    • Logfire: via openinference.
    • MLflow: via openinference.
    • Traceloop, Weave, Langtrace, Langwatch, Maxim, Opik, and Atla.
    • Trace to Database: for custom storage.

    For complex architectures, there are specialized tracing examples for:

    • Teams: Tracing multi-agent team interactions.
    • Workflows: Tracing structured workflow execution.
  9. Explore Data Labeling workflows by modality

    main

    The cookbook provides specialized agents for different data types. Each workflow folder typically contains a basic.py (the smallest runnable example) and various task-specific variants.

    Text Workflows

    • _01_text_classification/: Assigning N labels (sentiment, intent, topic).
    • _02_text_multilabel_classification/: Assigning subsets of N tags (hierarchical or flat).
    • _03_text_extraction/: Converting text into typed Pydantic objects.
    • _04_text_span_labeling/: Marking character/token spans (NER, PII, evidence).
    • _05_text_pairwise_preference/: Ranking A vs B (RLHF data shape).

    Image Workflows

    • _06_image_classification/: Single or multi-label classification.
    • _07_image_extraction/: Extracting attributes, OCR, or captions into typed objects.
    • _08_image_bounding_boxes/: Region detection using (x, y, w, h) coordinates.
    • _09_image_extraction_to_vectordb/: Extraction, embedding, and storage for similarity search.

    Audio Workflows

    • _10_audio_classification/: Clip-level labels (language, emotion, etc.).
    • _11_audio_transcription/: Speech-to-text with diarization and timestamps.
    • _12_audio_extraction/: Extracting action items, attendees, or decisions from recordings.

    Video Workflows

    • _13_video_classification/: Clip-level labels.
    • _14_video_extraction/: Event detection, scene descriptions, and action timestamps.

    Document Workflows

    • _15_document_classification/: Classifying invoices, receipts, contracts, etc.
    • _16_document_extraction/: Extracting data from multipage PDFs into typed objects.
  10. Explore Agent Memory patterns and APIs

    main

    The Agent Memory cookbook is organized into several functional areas:

    • Core Memory Patterns: Files 01_agent_with_memory.py through 08_memory_tools.py demonstrate how agents use memory.
    • Direct Memory Management: The memory_manager/ directory provides examples of using the MemoryManager API directly with PostgreSQL.
    • Memory Optimization: The optimize_memories/ directory contains examples of strategies for optimizing agent memories.

    Note: SurrealDB memory manager examples have moved to cookbook/integrations/surrealdb/.

  11. Evaluate output quality using Agent-as-Judge

    main

    Agent-as-Judge is an evaluation pattern where a model-based scoring system is used to assess the quality of an agent's output. This approach allows for automated, model-driven evaluation of complex tasks that are difficult to score with simple heuristics.

    Available implementation patterns in the cookbook include:

    • Basic Scoring: Sync and async numeric scoring with persisted results (agent_as_judge_basic.py).
    • Binary Evaluation: Simple PASS/FAIL quality checks (agent_as_judge_binary.py).
    • Batch Evaluation: Evaluating multiple cases at once with a summary output (agent_as_judge_batch.py).
    • Custom Evaluators: Using a specific agent designed for evaluation tasks (agent_as_judge_custom_evaluator.py).
    • Team Evaluation: Assessing the quality of responses generated by a multi-agent team (agent_as_judge_team.py and agent_as_judge_team_post_hook.py).
    • Guideline-based Scoring: Numeric scoring that incorporates specific evaluation guidelines (agent_as_judge_with_guidelines.py).
    • Tool-use Evaluation: Evaluating responses specifically from agents that utilize tools (agent_as_judge_with_tools.py).
    • Metric Tracking: Using post-hooks to track evaluation model metrics under the eval_model detail key (agent_as_judge_eval_metrics.py).