repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/culture/01_create_cultural_knowledge.py
cookbook/03_agents/culture/01_create_cultural_knowledge.py
"""Create cultural knowledge to use with your Agents. This minimal example demonstrates how to use Agno's `CultureManager` to create and persist shared cultural knowledge that can be used with your Agents. Cultural knowledge represents reusable insights, rules, and values that Agents can reference to stay consistent ...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/culture/__init__.py
cookbook/03_agents/culture/__init__.py
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/culture/03_automatic_cultural_management.py
cookbook/03_agents/culture/03_automatic_cultural_management.py
"""Automatically update cultural knowledge based on Agent interactions. This example demonstrates how an Agent can autonomously add or refine shared cultural knowledge after completing a task. When `update_cultural_knowledge=True`, the Agent: - Reflects on its interaction and reasoning process. - Identifies reusable ...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/culture/05_test_agent_with_culture.py
cookbook/03_agents/culture/05_test_agent_with_culture.py
"""This is just a sample file you can use to test run Agents with cultural knowledge. There's no agenda to it, just test various inputs and see what the Agent says. """ from agno.agent import Agent from agno.db.sqlite import SqliteDb from agno.models.anthropic import Claude db = SqliteDb(db_file="tmp/demo.db") agen...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/rag/local_rag_langchain_qdrant.py
cookbook/03_agents/rag/local_rag_langchain_qdrant.py
""" Prerequisites: - pip install langchain-qdrant langchain-text-splitters langchain-community fastembed """ from agno.agent import Agent from agno.models.ollama import Ollama from agno.vectordb.langchaindb import LangChainVectorDb from langchain_community.document_loaders import WebBaseLoader from langchain_communit...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/rag/traditional_rag_pgvector.py
cookbook/03_agents/rag/traditional_rag_pgvector.py
""" 1. Run: `./cookbook/run_pgvector.sh` to start a postgres container with pgvector 2. Run: `pip install openai sqlalchemy 'psycopg[binary]' pgvector agno` to install the dependencies 3. Run: `python cookbook/rag/01_traditional_rag_pgvector.py` to run the agent """ from agno.agent import Agent from agno.knowledge.emb...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/rag/rag_with_lance_db_and_sqlite.py
cookbook/03_agents/rag/rag_with_lance_db_and_sqlite.py
"""Run `pip install lancedb` to install dependencies.""" from agno.agent import Agent from agno.db.sqlite.sqlite import SqliteDb from agno.knowledge.embedder.ollama import OllamaEmbedder from agno.knowledge.knowledge import Knowledge from agno.models.ollama import Ollama from agno.vectordb.lancedb import LanceDb # De...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/rag/agentic_rag_pgvector.py
cookbook/03_agents/rag/agentic_rag_pgvector.py
""" 1. Run: `./cookbook/run_pgvector.sh` to start a postgres container with pgvector 2. Run: `pip install openai sqlalchemy 'psycopg[binary]' pgvector agno` to install the dependencies 3. Run: `python cookbook/rag/02_agentic_rag_pgvector.py` to run the agent """ from agno.agent import Agent from agno.knowledge.embedde...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/rag/agentic_rag_lancedb.py
cookbook/03_agents/rag/agentic_rag_lancedb.py
""" 1. Run: `pip install openai lancedb tantivy pypdf sqlalchemy agno` to install the dependencies 2. Run: `python cookbook/rag/04_agentic_rag_lancedb.py` to run the agent """ from agno.agent import Agent from agno.knowledge.embedder.openai import OpenAIEmbedder from agno.knowledge.knowledge import Knowledge from agno...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/rag/rag_sentence_transformer.py
cookbook/03_agents/rag/rag_sentence_transformer.py
"""This cookbook is an implementation of Agentic RAG using Sentence Transformer Reranker with multilingual data. ## Setup Instructions: ### 1. Install Dependencies Run: `pip install agno sentence-transformers` ### 2. Start the Postgres Server with pgvector Run: `sh cookbook/scripts/run_pgvector.sh` ### 3. Run the e...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/rag/traditional_rag_lancedb.py
cookbook/03_agents/rag/traditional_rag_lancedb.py
""" 1. Run: `pip install openai lancedb tantivy pypdf sqlalchemy agno` to install the dependencies 2. Run: `python cookbook/rag/03_traditional_rag_lancedb.py` to run the agent """ from agno.agent import Agent from agno.knowledge.embedder.openai import OpenAIEmbedder from agno.knowledge.knowledge import Knowledge from ...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/rag/agentic_rag_with_reranking.py
cookbook/03_agents/rag/agentic_rag_with_reranking.py
""" 1. Run: `pip install openai agno cohere lancedb tantivy sqlalchemy` to install the dependencies 2. Export your OPENAI_API_KEY and CO_API_KEY 3. Run: `python cookbook/agent_concepts/rag/agentic_rag_with_reranking.py` to run the agent """ from agno.agent import Agent from agno.knowledge.embedder.openai import OpenAI...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/rag/__init__.py
cookbook/03_agents/rag/__init__.py
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/hooks/output_stream_hook_send_notification.py
cookbook/03_agents/hooks/output_stream_hook_send_notification.py
""" Example demonstrating sending a notification to the user after an agent generates a response. It uses a post-hook which executes right after the response is processed. """ import asyncio from typing import Any, Dict from agno.agent import Agent from agno.models.openai import OpenAIChat from agno.run.agent import...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/hooks/output_transformation_post_hook.py
cookbook/03_agents/hooks/output_transformation_post_hook.py
""" Example demonstrating output transformation using post-hooks with Agno Agent. This example shows how to: 1. Transform agent responses by updating RunOutput.content 2. Add formatting, structure, and additional information 3. Enhance the user experience through content modification """ from datetime import datetime...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/hooks/input_transformation_pre_hook.py
cookbook/03_agents/hooks/input_transformation_pre_hook.py
"""Example demonstrating how to use a pre_hook to transform the input of your Agno Agent.""" from typing import Optional from agno.agent import Agent from agno.models.openai import OpenAIChat from agno.run.agent import RunInput from agno.session.agent import AgentSession from agno.utils.log import log_debug def tra...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/hooks/session_state_post_hook.py
cookbook/03_agents/hooks/session_state_post_hook.py
"""Example demonstrating how to use a post_hook to update the session_state. We will create a function that extract a list of topics discussed in the conversation, and keep them in the session state. We will use the function as a post-hook, to run it after every run of the agent. """ from typing import List from agn...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/hooks/input_validation_pre_hook.py
cookbook/03_agents/hooks/input_validation_pre_hook.py
""" Example demonstrating how to use a pre_hook to perform comprehensive input validation for your Agno Agent. Note: The "Message" panel will be updated with the updated input content after the pre-hook is executed. """ from agno.agent import Agent from agno.exceptions import CheckTrigger, InputCheckError from agno.m...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/hooks/session_state_pre_hook.py
cookbook/03_agents/hooks/session_state_pre_hook.py
"""Example demonstrating how to use a pre_hook to update the session_state. We will create a function that extract a list of topics present in the user messages, and keep them in the session state. We will use the function as a pre-hook, to run it before each agent run. """ from typing import List from agno.agent im...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/hooks/output_validation_post_hook.py
cookbook/03_agents/hooks/output_validation_post_hook.py
""" Example demonstrating output validation using post-hooks with Agno Agent. This example shows how to: 1. Validate agent responses for quality and safety 2. Ensure outputs meet minimum standards before being returned 3. Raise OutputCheckError when validation fails """ import asyncio from agno.agent import Agent fr...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/guardrails/prompt_injection.py
cookbook/03_agents/guardrails/prompt_injection.py
""" Example demonstrating how to use checks with Agno Agent to implement guardrails. This example shows how to: 1. An input validation check that checks for prompt injection """ from agno.agent import Agent from agno.exceptions import InputCheckError from agno.guardrails import PromptInjectionGuardrail from agno.mode...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/guardrails/openai_moderation.py
cookbook/03_agents/guardrails/openai_moderation.py
""" Example demonstrating how to use OpenAI moderation guardrails with Agno Agent. This example shows how to: 1. Detect and block content that violates OpenAI's content policy 2. Handle both text and image content moderation 3. Configure moderation for specific categories 4. Use both sync and async moderation checks 5...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/guardrails/pii_detection.py
cookbook/03_agents/guardrails/pii_detection.py
""" Example demonstrating how to use PII detection guardrails with Agno Agent. This example shows how to: 1. Detect and block personally identifiable information (PII) in input 2. Protect sensitive data like SSNs, credit cards, emails, and phone numbers 3. Handle different types of PII violations with appropriate erro...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/async/concurrent_tool_calls.py
cookbook/03_agents/async/concurrent_tool_calls.py
""" This example shows how to use concurrent tool calls in Agno. You should see the tool calls start and complete in parallel. """ from typing import AsyncIterator from agno.agent import Agent from agno.models.openai import OpenAIChat async def get_weather(city: str) -> AsyncIterator[str]: import time prin...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/async/data_analyst.py
cookbook/03_agents/async/data_analyst.py
"""Run `pip install duckdb` to install dependencies.""" import asyncio from textwrap import dedent from agno.agent import Agent from agno.models.openai import OpenAIChat from agno.tools.duckdb import DuckDbTools duckdb_tools = DuckDbTools() duckdb_tools.create_table_from_path( path="https://agno-public.s3.amazon...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/async/streaming.py
cookbook/03_agents/async/streaming.py
import asyncio from agno.agent import Agent from agno.models.openai import OpenAIChat from agno.utils.pprint import apprint_run_response agent = Agent( model=OpenAIChat(id="gpt-4o-mini"), ) async def streaming(): async for response in agent.arun(input="Tell me a joke.", stream=True): print(response....
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/async/tool_use.py
cookbook/03_agents/async/tool_use.py
import asyncio from agno.agent import Agent from agno.models.openai import OpenAIChat from agno.tools.duckduckgo import DuckDuckGoTools agent = Agent( model=OpenAIChat(id="gpt-4o"), tools=[DuckDuckGoTools()], markdown=True, ) asyncio.run(agent.aprint_response("Whats happening in UK and in USA?"))
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/async/basic.py
cookbook/03_agents/async/basic.py
import asyncio from agno.agent import Agent from agno.models.openai import OpenAIChat from agno.utils.pprint import apprint_run_response agent = Agent( model=OpenAIChat(id="gpt-4o-mini"), ) async def basic(): response = await agent.arun(input="Tell me a joke.") print(response.content) async def basic_...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/async/delay.py
cookbook/03_agents/async/delay.py
import asyncio from agno.agent import Agent, RunOutput from agno.models.openai import OpenAIChat from agno.tools.duckduckgo import DuckDuckGoTools from rich.pretty import pprint providers = ["openai", "anthropic", "ollama", "cohere", "google"] instructions = [ "Your task is to write a well researched report on AI...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/async/gather_agents.py
cookbook/03_agents/async/gather_agents.py
import asyncio from agno.agent import Agent from agno.models.openai import OpenAIChat from agno.tools.duckduckgo import DuckDuckGoTools from rich.pretty import pprint providers = ["openai", "anthropic", "ollama", "cohere", "google"] instructions = [ "Your task is to write a well researched report on AI providers....
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/async/__init__.py
cookbook/03_agents/async/__init__.py
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/async/structured_output.py
cookbook/03_agents/async/structured_output.py
import asyncio from typing import List from agno.agent import Agent, RunOutput # noqa from agno.models.openai import OpenAIChat from pydantic import BaseModel, Field from rich.pretty import pprint # noqa class MovieScript(BaseModel): setting: str = Field( ..., description="Provide a nice setting for a ...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/async/reasoning.py
cookbook/03_agents/async/reasoning.py
import asyncio from agno.agent import Agent from agno.models.openai import OpenAIChat task = "9.11 and 9.9 -- which is bigger?" regular_agent = Agent(model=OpenAIChat(id="gpt-4o"), markdown=True) reasoning_agent = Agent( model=OpenAIChat(id="gpt-4o"), reasoning=True, markdown=True, ) asyncio.run(regular...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/dependencies/access_dependencies_in_tool.py
cookbook/03_agents/dependencies/access_dependencies_in_tool.py
""" Example showing how tools can access dependencies passed to the agent. This demonstrates: 1. Passing dependencies to agent.run() 2. A simple tool that receives resolved dependencies """ from datetime import datetime from typing import Any, Dict, Optional from agno.agent import Agent from agno.models.openai impor...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/dependencies/add_dependencies_to_context.py
cookbook/03_agents/dependencies/add_dependencies_to_context.py
import json import httpx from agno.agent import Agent from agno.models.openai import OpenAIChat def get_top_hackernews_stories(num_stories: int = 5) -> str: """Fetch and return the top stories from HackerNews. Args: num_stories: Number of top stories to retrieve (default: 5) Returns: JSO...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/dependencies/add_dependencies_on_run.py
cookbook/03_agents/dependencies/add_dependencies_on_run.py
from agno.agent import Agent from agno.models.openai import OpenAIChat def get_user_profile(user_id: str = "john_doe") -> dict: """Get user profile information that can be referenced in responses. Args: user_id: The user ID to get profile for Returns: Dictionary containing user profile in...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/dependencies/dependencies_functions.py
cookbook/03_agents/dependencies/dependencies_functions.py
"""Example demonstrating how to read from the session state from a dependency function. We will create a function that reads some fields from the session state and return them as a dictionary. We will then use this function as a dependency in an agent, allowing us to get the session state data directly into the contex...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/dependencies/reference_dependencies.py
cookbook/03_agents/dependencies/reference_dependencies.py
import json import httpx from agno.agent import Agent from agno.models.openai import OpenAIChat def get_top_hackernews_stories(num_stories: int = 5) -> str: """Fetch and return the top stories from HackerNews. Args: num_stories: Number of top stories to retrieve (default: 5) Returns: JSO...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/dependencies/__init__.py
cookbook/03_agents/dependencies/__init__.py
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/custom_logging/custom_logging.py
cookbook/03_agents/custom_logging/custom_logging.py
"""Example showing how to use a custom logger with Agno.""" import logging from agno.agent import Agent from agno.utils.log import configure_agno_logging, log_info def get_custom_logger(): """Return an example custom logger.""" custom_logger = logging.getLogger("custom_logger") handler = logging.StreamH...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/custom_logging/custom_logging_advanced.py
cookbook/03_agents/custom_logging/custom_logging_advanced.py
"""Example showing how to use multiple custom loggers with Agno. This is useful for advanced scenarios where you want to use different loggers for different parts of Agno.""" import logging from agno.agent import Agent from agno.team import Team from agno.utils.log import configure_agno_logging def get_custom_agen...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/custom_logging/log_to_file.py
cookbook/03_agents/custom_logging/log_to_file.py
"""Example showing how to use a custom logger with Agno.""" import logging from pathlib import Path from agno.agent import Agent from agno.utils.log import configure_agno_logging, log_info def get_custom_logger(): """Return an example custom logger.""" custom_logger = logging.getLogger("file_logger") #...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/custom_logging/__init__.py
cookbook/03_agents/custom_logging/__init__.py
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/events/reasoning_agent_events.py
cookbook/03_agents/events/reasoning_agent_events.py
import asyncio from agno.agent import RunEvent from agno.agent.agent import Agent from agno.models.openai.chat import OpenAIChat finance_agent = Agent( model=OpenAIChat(id="gpt-4o"), reasoning=True, ) async def run_agent_with_events(prompt: str): content_started = False async for run_output_event in...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/events/basic_agent_events.py
cookbook/03_agents/events/basic_agent_events.py
import asyncio from agno.agent import RunEvent from agno.agent.agent import Agent from agno.models.openai.chat import OpenAIChat from agno.tools.yfinance import YFinanceTools finance_agent = Agent( id="finance-agent", name="Finance Agent", model=OpenAIChat(id="gpt-4o"), tools=[YFinanceTools()], ) as...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/events/__init__.py
cookbook/03_agents/events/__init__.py
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/session/01_persistent_session.py
cookbook/03_agents/session/01_persistent_session.py
from agno.agent.agent import Agent from agno.db.postgres import PostgresDb from agno.models.openai import OpenAIChat db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai" db = PostgresDb(db_url=db_url, session_table="sessions") agent = Agent( model=OpenAIChat(id="gpt-4o-mini"), db=db, session_id="sessi...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/session/12_chat_history_num_messages.py
cookbook/03_agents/session/12_chat_history_num_messages.py
from agno.agent.agent import Agent from agno.db.postgres import PostgresDb from agno.models.openai import OpenAIChat db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai" db = PostgresDb(db_url=db_url, session_table="sessions") agent = Agent( model=OpenAIChat(id="gpt-4o-mini"), db=db, session_id="chat_...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/session/11_custom_session_summary_instructions.py
cookbook/03_agents/session/11_custom_session_summary_instructions.py
""" This example shows how to use the session summary to store the conversation summary. """ from agno.agent.agent import Agent from agno.db.postgres import PostgresDb from agno.models.openai import OpenAIChat from agno.session.summary import SessionSummaryManager # noqa: F401 db_url = "postgresql+psycopg://ai:ai@lo...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/session/09_disable_storing_history_messages.py
cookbook/03_agents/session/09_disable_storing_history_messages.py
""" Simple example demonstrating store_history_messages option """ from agno.agent import Agent from agno.db.sqlite import SqliteDb from agno.models.openai import OpenAIChat from agno.utils.pprint import pprint_run_response agent = Agent( model=OpenAIChat(id="gpt-4o-mini"), db=SqliteDb(db_file="tmp/example_no...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/session/02_persistent_session_history.py
cookbook/03_agents/session/02_persistent_session_history.py
""" This example shows how to use the session history to store the conversation history. add_history_to_context flag is used to add the history to the messages. num_history_runs is used to set the number of history runs to add to the messages. """ from agno.agent.agent import Agent from agno.db.postgres import Postgre...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/session/05_chat_history.py
cookbook/03_agents/session/05_chat_history.py
from agno.agent.agent import Agent from agno.db.postgres import PostgresDb from agno.models.openai import OpenAIChat db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai" db = PostgresDb(db_url=db_url, session_table="sessions") agent = Agent( model=OpenAIChat(id="gpt-4o-mini"), db=db, session_id="chat_...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/session/06_rename_session.py
cookbook/03_agents/session/06_rename_session.py
from agno.agent.agent import Agent from agno.db.postgres import PostgresDb from agno.models.openai import OpenAIChat db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai" db = PostgresDb(db_url=db_url, session_table="sessions") agent = Agent( model=OpenAIChat(id="gpt-4o-mini"), db=db, session_id="chat_...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/session/03_session_summary.py
cookbook/03_agents/session/03_session_summary.py
""" This example shows how to use the session summary to store the conversation summary. """ from agno.agent.agent import Agent from agno.db.postgres import PostgresDb from agno.models.openai import OpenAIChat from agno.session.summary import SessionSummaryManager # noqa: F401 db_url = "postgresql+psycopg://ai:ai@lo...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/session/04_session_summary_references.py
cookbook/03_agents/session/04_session_summary_references.py
""" This example shows how to use the `add_session_summary_to_context` parameter in the Agent config to add session summaries to the Agent context. Start the postgres db locally on Docker by running: cookbook/scripts/run_pgvector.sh """ from agno.agent.agent import Agent from agno.db.postgres import PostgresDb from a...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/session/__init__.py
cookbook/03_agents/session/__init__.py
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/session/12_async_session_summary.py
cookbook/03_agents/session/12_async_session_summary.py
""" This example demonstrates how to use the async `aget_session_summary()` method to retrieve session summaries in async workflows. Start the postgres db locally on Docker by running: cookbook/scripts/run_pgvector.sh """ import asyncio from agno.agent.agent import Agent from agno.db.postgres import AsyncPostgresDb ...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/session/10_disable_storing_tool_messages.py
cookbook/03_agents/session/10_disable_storing_tool_messages.py
""" Simple examples demonstrating store_tool_messages option """ from agno.agent import Agent from agno.db.sqlite import SqliteDb from agno.models.openai import OpenAIChat from agno.tools.hackernews import HackerNewsTools from agno.utils.pprint import pprint_run_response agent = Agent( model=OpenAIChat(id="gpt-4o...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/session/08_cache_session.py
cookbook/03_agents/session/08_cache_session.py
"""Example of how to cache the session in memory for faster access.""" from agno.agent.agent import Agent from agno.db.postgres import PostgresDb from agno.models.openai import OpenAIChat # Setup the database db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai" db = PostgresDb(db_url=db_url, session_table="xxx") ...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/session/07_in_memory_db.py
cookbook/03_agents/session/07_in_memory_db.py
"""This example shows how to use an in-memory database. With this you will be able to store sessions, user memories, etc. without setting up a database. Keep in mind that in production setups it is recommended to use a database. """ from agno.agent import Agent from agno.db.in_memory import InMemoryDb from agno.model...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/multimodal/video_caption_agent.py
cookbook/03_agents/multimodal/video_caption_agent.py
"""Please install dependencies using: pip install openai moviepy ffmpeg """ from agno.agent import Agent from agno.models.openai import OpenAIChat from agno.tools.moviepy_video import MoviePyVideoTools from agno.tools.openai import OpenAITools video_tools = MoviePyVideoTools( process_video=True, generate_captions...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/multimodal/image_to_structured_output.py
cookbook/03_agents/multimodal/image_to_structured_output.py
from typing import List from agno.agent import Agent from agno.media import Image from agno.models.openai import OpenAIChat from pydantic import BaseModel, Field from rich.pretty import pprint class MovieScript(BaseModel): name: str = Field(..., description="Give a name to this movie") setting: str = Field( ...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/multimodal/image_to_image_agent.py
cookbook/03_agents/multimodal/image_to_image_agent.py
from agno.agent import Agent from agno.models.openai import OpenAIChat from agno.tools.fal import FalTools agent = Agent( model=OpenAIChat(id="gpt-4o"), id="image-to-image", name="Image to Image Agent", tools=[FalTools()], markdown=True, instructions=[ "You have to use the `image_to_ima...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/multimodal/image_to_text.py
cookbook/03_agents/multimodal/image_to_text.py
from pathlib import Path from agno.agent import Agent from agno.media import Image from agno.models.openai import OpenAIChat agent = Agent( model=OpenAIChat(id="gpt-4o"), markdown=True, ) image_path = Path(__file__).parent.joinpath("sample.jpg") agent.print_response( "Write a 3 sentence fiction story abo...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/multimodal/02_media_input_to_agent_and_tool.py
cookbook/03_agents/multimodal/02_media_input_to_agent_and_tool.py
""" Comprehensive test for joint media access functionality. This demonstrates: 1. Initial image upload and analysis 2. DALL-E image generation within the same run 3. Analysis of both original and generated images 4. Cross-run media persistence (accessing images from previous runs) """ from typing import Optional, Se...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/multimodal/audio_sentiment_analysis.py
cookbook/03_agents/multimodal/audio_sentiment_analysis.py
import requests from agno.agent import Agent from agno.db.sqlite import SqliteDb from agno.media import Audio from agno.models.google import Gemini db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai" agent = Agent( model=Gemini(id="gemini-2.0-flash-exp"), add_history_to_context=True, markdown=True, ...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/multimodal/audio_multi_turn.py
cookbook/03_agents/multimodal/audio_multi_turn.py
from agno.agent import Agent from agno.db.sqlite import SqliteDb from agno.models.openai import OpenAIChat from agno.utils.audio import write_audio_to_file from rich.pretty import pprint agent = Agent( model=OpenAIChat( id="gpt-4o-audio-preview", modalities=["text", "audio"], audio={"voice"...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/multimodal/generate_image_with_intermediate_steps.py
cookbook/03_agents/multimodal/generate_image_with_intermediate_steps.py
from typing import Iterator from agno.agent import Agent, RunOutputEvent from agno.models.openai import OpenAIChat from agno.tools.dalle import DalleTools from agno.utils.common import dataclass_to_dict from rich.pretty import pprint image_agent = Agent( model=OpenAIChat(id="gpt-4o"), tools=[DalleTools()], ...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/multimodal/01_media_input_for_tool.py
cookbook/03_agents/multimodal/01_media_input_for_tool.py
""" Example showing how tools can access media (images, videos, audio, files) passed to the agent. This demonstrates: 1. Uploading a PDF file to an agent 2. A tool that can access and process the uploaded file (OCR simulation) 3. The LLM responding based on the tool's processing result """ from typing import Optional...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/multimodal/agent_using_multimodal_tool_response_in_runs.py
cookbook/03_agents/multimodal/agent_using_multimodal_tool_response_in_runs.py
from agno.agent import Agent from agno.db.sqlite import SqliteDb from agno.tools.dalle import DalleTools # Create an Agent with the DALL-E tool agent = Agent( tools=[DalleTools()], name="DALL-E Image Generator", add_history_to_context=True, db=SqliteDb(db_file="tmp/test.db"), ) agent.print_response( ...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/multimodal/agent_same_run_image_analysis.py
cookbook/03_agents/multimodal/agent_same_run_image_analysis.py
from agno.agent import Agent from agno.models.openai import OpenAIChat from agno.tools.dalle import DalleTools # Create an Agent with the DALL-E tool agent = Agent( model=OpenAIChat(id="gpt-4.1"), tools=[DalleTools()], name="DALL-E Image Generator" ) response = agent.run( "Generate an image of a dog and tell ...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/multimodal/image_input_multi-turn.py
cookbook/03_agents/multimodal/image_input_multi-turn.py
from agno.agent import Agent from agno.db.in_memory.in_memory_db import InMemoryDb from agno.media import Image from agno.models.openai import OpenAIChat agent = Agent( model=OpenAIChat(id="gpt-4o"), db=InMemoryDb(), add_history_to_context=True, markdown=True, store_media=True, ) agent.print_respo...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/multimodal/image_input_high_fidelity.py
cookbook/03_agents/multimodal/image_input_high_fidelity.py
from agno.agent import Agent from agno.media import Image from agno.models.openai import OpenAIChat agent = Agent( model=OpenAIChat(id="gpt-4o"), markdown=True, ) agent.print_response( "What's in these images", images=[ Image( url="https://upload.wikimedia.org/wikipedia/commons/thu...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/multimodal/image_to_audio.py
cookbook/03_agents/multimodal/image_to_audio.py
from pathlib import Path from agno.agent import Agent, RunOutput from agno.media import Image from agno.models.openai import OpenAIChat from agno.utils.audio import write_audio_to_file from rich import print from rich.text import Text cwd = Path(__file__).parent.resolve() image_agent = Agent(model=OpenAIChat(id="gpt...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/multimodal/audio_streaming.py
cookbook/03_agents/multimodal/audio_streaming.py
import base64 import wave from typing import Iterator from agno.agent import Agent, RunOutputEvent from agno.models.openai import OpenAIChat # Audio Configuration SAMPLE_RATE = 24000 # Hz (24kHz) CHANNELS = 1 # Mono (Change to 2 if Stereo) SAMPLE_WIDTH = 2 # Bytes (16 bits) # Provide the agent with the audio file...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/multimodal/audio_to_text.py
cookbook/03_agents/multimodal/audio_to_text.py
import requests from agno.agent import Agent from agno.media import Audio from agno.models.google import Gemini agent = Agent( model=Gemini(id="gemini-2.0-flash-exp"), markdown=True, ) url = "https://agno-public.s3.us-east-1.amazonaws.com/demo_data/QA-01.mp3" response = requests.get(url) audio_content = resp...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/multimodal/generate_video_using_replicate.py
cookbook/03_agents/multimodal/generate_video_using_replicate.py
from agno.agent import Agent from agno.models.openai import OpenAIChat from agno.tools.replicate import ReplicateTools """Create an agent specialized for Replicate AI content generation""" video_agent = Agent( name="Video Generator Agent", model=OpenAIChat(id="gpt-4o"), tools=[ ReplicateTools( ...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/multimodal/__init__.py
cookbook/03_agents/multimodal/__init__.py
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/multimodal/video_to_shorts.py
cookbook/03_agents/multimodal/video_to_shorts.py
""" 1. Install dependencies using: `pip install opencv-python google-geneai sqlalchemy` 2. Install ffmpeg `brew install ffmpeg` 2. Run the script using: `python cookbook/agent_concepts/video_to_shorts.py` """ import subprocess from pathlib import Path from agno.agent import Agent from agno.media import Video from agn...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/multimodal/audio_input_output.py
cookbook/03_agents/multimodal/audio_input_output.py
import requests from agno.agent import Agent from agno.media import Audio from agno.models.openai import OpenAIChat from agno.utils.audio import write_audio_to_file from rich.pretty import pprint # Fetch the audio file and convert it to a base64 encoded string url = "https://openaiassets.blob.core.windows.net/$web/API...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/multimodal/generate_video_using_models_lab.py
cookbook/03_agents/multimodal/generate_video_using_models_lab.py
from agno.agent import Agent from agno.models.openai import OpenAIChat from agno.tools.models_labs import ModelsLabTools video_agent = Agent( model=OpenAIChat(id="gpt-4o"), tools=[ModelsLabTools()], description="You are an AI agent that can generate videos using the ModelsLabs API.", instructions=[ ...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/context_management/few_shot_learning.py
cookbook/03_agents/context_management/few_shot_learning.py
""" This example demonstrates how to use additional_input with an Agent to teach proper response patterns through few-shot learning. """ from agno.agent import Agent from agno.models.message import Message from agno.models.openai.chat import OpenAIChat # Few-shot examples showing good support patterns support_example...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/context_management/datetime_instructions.py
cookbook/03_agents/context_management/datetime_instructions.py
from agno.agent import Agent from agno.models.openai import OpenAIChat agent = Agent( model=OpenAIChat(id="gpt-4o"), add_datetime_to_context=True, timezone_identifier="Etc/UTC", ) agent.print_response( "What is the current date and time? What is the current time in NYC?" )
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/context_management/location_instructions.py
cookbook/03_agents/context_management/location_instructions.py
from agno.agent import Agent from agno.models.openai import OpenAIChat from agno.tools.duckduckgo import DuckDuckGoTools agent = Agent( model=OpenAIChat(id="gpt-4o"), add_location_to_context=True, tools=[DuckDuckGoTools(cache_results=True)], ) agent.print_response("What city am I in?") agent.print_response...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/context_management/instructions_via_function.py
cookbook/03_agents/context_management/instructions_via_function.py
from typing import List from agno.agent import Agent def get_instructions(agent: Agent) -> List[str]: return [ f"Your name is {agent.name}!", "Talk in haiku's!", "Use poetry to answer questions.", ] agent = Agent( name="AgentX", instructions=get_instructions, markdown=Tr...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/context_management/dynamic_instructions.py
cookbook/03_agents/context_management/dynamic_instructions.py
from agno.agent import Agent from agno.run import RunContext def get_instructions(run_context: RunContext): if run_context.session_state and run_context.session_state.get("current_user_id"): return ( f"Make the story about {run_context.session_state.get('current_user_id')}." ) retu...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/context_management/instructions.py
cookbook/03_agents/context_management/instructions.py
from agno.agent import Agent agent = Agent(instructions="Share a 2 sentence story about") agent.print_response("Love in the year 12000.")
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/context_management/filter_tool_calls_from_history.py
cookbook/03_agents/context_management/filter_tool_calls_from_history.py
""" This example demonstrates max_tool_calls_from_history to limit tool calls sent to the model. How it works: 1. Database stores ALL runs (no limit) 2. num_history_runs loads last N runs from database (default: 3) 3. max_tool_calls_from_history filters loaded history to keep only M most recent tool calls Flow: Datab...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/context_management/__init__.py
cookbook/03_agents/context_management/__init__.py
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/context_management/introduction.py
cookbook/03_agents/context_management/introduction.py
from agno.agent import Agent from agno.db.sqlite import SqliteDb from agno.models.openai import OpenAIChat db = SqliteDb(db_file="tmp/agents.db", session_table="agent_sessions") INTRODUCTION = """Hello, I'm your personal assistant. I can help you only with questions related to mountain climbing.""" agent = Agent( ...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/input_and_output/input_schema_on_agent.py
cookbook/03_agents/input_and_output/input_schema_on_agent.py
from typing import List from agno.agent import Agent from agno.models.openai import OpenAIChat from agno.tools.hackernews import HackerNewsTools from pydantic import BaseModel, Field class ResearchTopic(BaseModel): """Structured research topic with specific requirements""" topic: str focus_areas: List[s...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/input_and_output/json_schema_output.py
cookbook/03_agents/input_and_output/json_schema_output.py
""" Example showing how to use JSON as output schema. Also how to temporarily override the schema for a single run, with automatic restoration afterwards. Note: JSON schemas must be in the provider's expected format. For example, OpenAI expects: {"type": "json_schema", "json_schema": {"name": "...", "schema": {...}}}...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/input_and_output/output_model.py
cookbook/03_agents/input_and_output/output_model.py
""" This example shows how to use the output_model parameter to specify the model that will be used to generate the final response. """ from agno.agent import Agent from agno.models.openai import OpenAIChat from agno.tools.duckduckgo import DuckDuckGoTools agent = Agent( model=OpenAIChat(id="gpt-4.1"), output...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/input_and_output/input_as_message.py
cookbook/03_agents/input_and_output/input_as_message.py
from agno.agent import Agent, Message Agent().print_response( Message( role="user", content=[ {"type": "text", "text": "What's in this image?"}, { "type": "image_url", "image_url": { "url": "https://upload.wikimedia.org/wik...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/input_and_output/parser_model_stream.py
cookbook/03_agents/input_and_output/parser_model_stream.py
import random from typing import Iterator, List from agno.agent import Agent, RunOutputEvent from agno.models.anthropic import Claude from agno.models.openai import OpenAIChat from pydantic import BaseModel, Field from rich.pretty import pprint # noqa class NationalParkAdventure(BaseModel): park_name: str = Fie...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/input_and_output/parser_model_ollama.py
cookbook/03_agents/input_and_output/parser_model_ollama.py
import random from typing import List from agno.agent import Agent, RunOutput from agno.models.ollama import Ollama from agno.models.openai import OpenAIChat from pydantic import BaseModel, Field from rich.pretty import pprint class NationalParkAdventure(BaseModel): park_name: str = Field(..., description="Name ...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/input_and_output/input_as_dict.py
cookbook/03_agents/input_and_output/input_as_dict.py
from agno.agent import Agent Agent().print_response( { "role": "user", "content": [ {"type": "text", "text": "What's in this image?"}, { "type": "image_url", "image_url": { "url": "https://upload.wikimedia.org/wikipedia/com...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/input_and_output/parser_model.py
cookbook/03_agents/input_and_output/parser_model.py
import random from typing import List from agno.agent import Agent, RunOutput # noqa from agno.models.anthropic import Claude from agno.models.openai import OpenAIChat from pydantic import BaseModel, Field from rich.pretty import pprint # noqa class NationalParkAdventure(BaseModel): park_name: str = Field(...,...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/input_and_output/structured_input_output_with_parser_model.py
cookbook/03_agents/input_and_output/structured_input_output_with_parser_model.py
from typing import List from agno.agent import Agent from agno.models.anthropic import Claude from agno.models.openai import OpenAIChat from agno.tools.hackernews import HackerNewsTools from pydantic import BaseModel, Field from rich.pretty import pprint # Define your input schema class ResearchTopic(BaseModel): ...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false
agno-agi/agno
https://github.com/agno-agi/agno/blob/26b9daa0fb760c3ad8384e1ba9218b1bce854535/cookbook/03_agents/input_and_output/instructions.py
cookbook/03_agents/input_and_output/instructions.py
"""Example demonstrating how to use a function as instructions for an agent. We will create a function that builds instructions for the agent, based on the session state. We will then use this function as instructions for the agent, allowing us to dynamically build the instructions based on the session state. """ fro...
python
Apache-2.0
26b9daa0fb760c3ad8384e1ba9218b1bce854535
2026-01-04T14:41:49.609528Z
false