|
| 1 | +--- |
| 2 | +title: Agno Integration |
| 3 | +sidebar_label: Agno |
| 4 | +description: Integrate Apify with Agno to power AI agents with web scraping, automation, and data insights. |
| 5 | +sidebar_position: 1 |
| 6 | +slug: /integrations/agno |
| 7 | +--- |
| 8 | + |
| 9 | +**Integrate Apify with Agno to power AI agents with web scraping, automation, and data insights.** |
| 10 | + |
| 11 | +--- |
| 12 | + |
| 13 | +## What is Agno? |
| 14 | + |
| 15 | +[Agno](https://docs.agno.com/) is an open-source framework for building intelligent AI agents. It provides a flexible architecture to create agents with custom tools, enabling seamless integration with external services like Apify for tasks such as web scraping, data extraction and automation. |
| 16 | + |
| 17 | +> [!NOTE] |
| 18 | +> Check out the [Agno documentation](https://docs.agno.com/introduction) for more details on building AI agents. |
| 19 | +
|
| 20 | +## How to Use Apify with Agno |
| 21 | + |
| 22 | +This guide shows how to integrate Apify Actors with Agno to empower your AI agents with real-time web data. We'll use the [RAG Web Browser](https://apify.com/apify/rag-web-browser) Actor to fetch web content and the [Google Places Crawler](https://apify.com/compass/crawler-google-places) Actor to extract location-based data. It is very easy to use with any other Actor by just passing the name of the Actor. See and choose from 4,000+ Actors in the [Apify Store](https://apify.com/store). |
| 23 | + |
| 24 | +### Prerequisites |
| 25 | + |
| 26 | +- **Apify API token**: Obtain your token from the [Apify console](https://console.apify.com/account/integrations). |
| 27 | +- **Python environment**: Ensure Python is installed (version 3.8+ recommended). |
| 28 | +- **Required packages**: Install the following dependencies in your terminal: |
| 29 | + |
| 30 | +```bash |
| 31 | +pip install agno apify-client langchain-apify |
| 32 | +``` |
| 33 | + |
| 34 | +## Basic Integration Example |
| 35 | + |
| 36 | +Start by setting up an Agno agent with Apify tools. This example uses the RAG Web Browser Actor to extract content from a specific URL. |
| 37 | + |
| 38 | +```python |
| 39 | +from agno.agent import Agent |
| 40 | +from agno.tools.apify import ApifyTools |
| 41 | + |
| 42 | +# Initialize the agent with Apify tools |
| 43 | +agent = Agent( |
| 44 | + tools=[ |
| 45 | + ApifyTools( |
| 46 | + actors=["apify/rag-web-browser"], |
| 47 | + apify_api_token="YOUR_APIFY_API_TOKEN" # Replace YOUR_APIFY_API_TOKEN with your token |
| 48 | + ) |
| 49 | + ], |
| 50 | + show_tool_calls=True, |
| 51 | + markdown=True |
| 52 | +) |
| 53 | + |
| 54 | +# Fetch and display web content |
| 55 | +agent.print_response("Extract key details from https://docs.agno.com/introduction", markdown=True) |
| 56 | +``` |
| 57 | + |
| 58 | +Running this code will scrape the specified URL and return formatted content your agent can use. |
| 59 | + |
| 60 | +> [!TIP] |
| 61 | +> You can also set the APIFY_API_TOKEN environment variable instead of passing it directly in the code. |
| 62 | +
|
| 63 | +### Advanced Scenario: Travel Planning Agent |
| 64 | + |
| 65 | +Combine multiple Apify Actors to create a powerful travel planning agent. This example uses the RAG Web Browser and Google Places Crawler to gather travel insights and local business data. |
| 66 | + |
| 67 | +```python |
| 68 | +from agno.agent import Agent |
| 69 | +from agno.tools.apify import ApifyTools |
| 70 | + |
| 71 | +# Create a travel planning agent |
| 72 | +agent = Agent( |
| 73 | + name="Travel Planner", |
| 74 | + instructions=[ |
| 75 | + "You are a travel planning assistant. Use web data and location insights to provide detailed travel recommendations." |
| 76 | + ], |
| 77 | + tools=[ |
| 78 | + ApifyTools( |
| 79 | + actors=[ |
| 80 | + "apify/rag-web-browser", # For general web research |
| 81 | + "compass/crawler-google-places" # For location-based data |
| 82 | + ], |
| 83 | + apify_api_token="YOUR_APIFY_API_TOKEN" |
| 84 | + ) |
| 85 | + ], |
| 86 | + show_tool_calls=True, |
| 87 | + markdown=True |
| 88 | +) |
| 89 | + |
| 90 | +# Plan a trip to Tokyo |
| 91 | +agent.print_response( |
| 92 | + """ |
| 93 | + I'm traveling to Tokyo next month. |
| 94 | + 1. Research the best time to visit and top attractions. |
| 95 | + 2. Find a highly rated sushi restaurant near Shinjuku. |
| 96 | + Compile a travel guide with this information. |
| 97 | + """, |
| 98 | + markdown=True |
| 99 | +) |
| 100 | +``` |
| 101 | + |
| 102 | +This agent will fetch travel-related data and restaurant recommendations, providing a comprehensive travel guide: |
| 103 | + |
| 104 | +1. Use the RAG Web Browser to research Tokyo travel details. |
| 105 | +2. Use the Google Places Crawler to find a top sushi restaurant. |
| 106 | +3. Combine the results into a comprehensive guide. |
| 107 | + |
| 108 | +> [!TIP] |
| 109 | +> Browse the [Apify Store](https://apify.com/store) to find additional Actors for tasks like social media scraping, e-commerce data extraction, or news aggregation. |
| 110 | +
|
| 111 | +### Available Apify Tools |
| 112 | + |
| 113 | +Agno supports any Apify Actor via the ApifyTools class. You can specify a single Actor ID or a list of Actor IDs to register multiple tools for your agent at once. |
| 114 | + |
| 115 | +## Configuration Options |
| 116 | + |
| 117 | +| Parameter | Type | Default | Description | |
| 118 | +| ---------------------------- | ------------------- | ------- | ------------------------------------------------------------------ | |
| 119 | +| `apify_api_token` | `str` | `None` | Apify API token (or set via APIFY_API_TOKEN environment variable) | |
| 120 | +| `actors` | `str` or `List[str]`| `None` | Single Actor ID or list of Actor IDs to register | |
| 121 | + |
| 122 | +## Resources |
| 123 | + |
| 124 | +- [How to build an AI Agent](https://blog.apify.com/how-to-build-an-ai-agent/) |
| 125 | +- [Agno Framework Documentation](https://docs.agno.com) |
| 126 | +- [Apify Platform Documentation](https://docs.apify.com) |
| 127 | +- [Apify Actor Documentation](https://docs.apify.com/actors) |
| 128 | +- [Apify Store - Browse available Actors](https://apify.com/store) |
0 commit comments