Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available:
6.9.0
metadata
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 that helps you retrieve information about your Meta advertising campaigns using the Facebook 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:
- Get Ad Accounts: Retrieve all accessible Meta ad accounts
- Get Campaigns: Get campaigns for a specific ad account
- Get Ad Sets: Get ad sets for a specific campaign
- Get Ads: Get ads for a specific ad set
- 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
- LLM: OpenAI gpt-4o via LiteLLM
- Meta Ads SDK: Facebook Business SDK
- UI: Gradio
How It Works
- User submits a natural language query through the Gradio chat interface
- The smolagents Code Agent processes the query
- The agent selects and executes the appropriate Meta Ads tools
- Results are returned in a human-readable format
Setup
- Get your Meta access token from Meta for Developers
- Get your OpenAI API key from OpenAI Platform
- Add the secrets to your Hugging Face Space settings
- Start chatting with the agent!