Spaces:
Sleeping
Sleeping
| title: Meta Ads Api | |
| emoji: π¬ | |
| colorFrom: yellow | |
| colorTo: purple | |
| sdk: gradio | |
| sdk_version: 5.42.0 | |
| app_file: app.py | |
| pinned: false | |
| license: apache-2.0 | |
| short_description: Use Meta Ads API to retrieve info about Meta ads | |
| # Meta Ads API Agent | |
| An AI agent powered by [smolagents](https://github.com/huggingface/smolagents) that helps you retrieve information about your Meta advertising campaigns using the [Facebook Business SDK](https://github.com/facebook/facebook-python-business-sdk). | |
| ## Features | |
| - π€ **AI-Powered Agent**: Uses OpenAI's gpt-4o model with smolagents framework | |
| - π οΈ **Custom Tools**: Built with Facebook Business SDK for Meta Ads operations | |
| - π¬ **Chat Interface**: User-friendly Gradio interface for natural language queries | |
| - π **Comprehensive Data**: Access ad accounts, campaigns, ad sets, ads, and performance insights | |
| ## Available Tools | |
| The agent has access to the following custom tools: | |
| 1. **Get Ad Accounts**: Retrieve all accessible Meta ad accounts | |
| 2. **Get Campaigns**: Get campaigns for a specific ad account | |
| 3. **Get Ad Sets**: Get ad sets for a specific campaign | |
| 4. **Get Ads**: Get ads for a specific ad set | |
| 5. **Get Ad Insights**: Retrieve performance metrics and insights | |
| ## Required Space Secrets | |
| To use this agent, you need to configure the following secrets in your Hugging Face Space: | |
| - `OPENAI_API_KEY`: Your OpenAI API key (required) | |
| - `META_ACCESS_TOKEN`: Your Meta access token (required) | |
| - `META_APP_ID`: Your Meta app ID (optional) | |
| - `META_APP_SECRET`: Your Meta app secret (optional) | |
| ## Example Queries | |
| - "Show me all my ad accounts" | |
| - "Get campaigns for account act_123456789" | |
| - "Get ad sets for campaign 123456789" | |
| - "What are the insights for my account in the last 30 days?" | |
| - "Show me the performance of campaign 123456789 last week" | |
| ## Technology Stack | |
| - **Agent Framework**: [smolagents](https://github.com/huggingface/smolagents) | |
| - **LLM**: OpenAI gpt-4o via LiteLLM | |
| - **Meta Ads SDK**: [Facebook Business SDK](https://github.com/facebook/facebook-python-business-sdk) | |
| - **UI**: [Gradio](https://gradio.app) | |
| ## How It Works | |
| 1. User submits a natural language query through the Gradio chat interface | |
| 2. The smolagents Code Agent processes the query | |
| 3. The agent selects and executes the appropriate Meta Ads tools | |
| 4. Results are returned in a human-readable format | |
| ## Setup | |
| 1. Get your Meta access token from [Meta for Developers](https://developers.facebook.com) | |
| 2. Get your OpenAI API key from [OpenAI Platform](https://platform.openai.com) | |
| 3. Add the secrets to your Hugging Face Space settings | |
| 4. Start chatting with the agent! | |