Agent Connector

Connect your agents to Facebook Marketing

Production-ready access to your Facebook Marketing data with managed auth, parametric control, and the reliability your agents need to actually work.

Installation & Usage

Get started with the Facebook Marketing connector in minutes.

[01]

Install Package

Using uv or pip

BASH

Copy
uv pip install airbyte-agent-facebook-marketing

[02]

Import

Initialize and use

PYTHON

Copy

from pydantic_ai import Agent

from airbyte_agent_sdk.connectors.facebook_marketing import (
   FacebookMarketingConnector,
)
from airbyte_agent_sdk.connectors.facebook_marketing.models import (
   FacebookMarketingServiceAccountKeyAuthenticationAuthConfig,
)


connector = FacebookMarketingConnector(
   auth_config=FacebookMarketingServiceAccountKeyAuthenticationAuthConfig(
       account_key=(
           "<Facebook long-lived access token for "
           "Service Account authentication>"
       )
   )
)

agent = Agent("openai:gpt-4o")

[03]

Tool

Add tools to your agent

python

Copy

@agent.tool_plain
@FacebookMarketingConnector.tool_utils
async def facebook_marketing_execute(
   entity: str,
   action: str,
   params: dict | None = None,
):
   return await connector.execute(entity, action, params or {})

Supported Entities & Actions

Access all your Facebook Marketing data through a unified API

Lorem ipsum

Lorem ipsum

| Entity | Actions |\n|--------|---------|\n| Current User | [Get](./REFERENCE.md#current-user-get) |\n| Ad Accounts | [List](./REFERENCE.md#ad-accounts-list), [Search](./REFERENCE.md#ad-accounts-search) |\n| Campaigns | [List](./REFERENCE.md#campaigns-list), [Create](./REFERENCE.md#campaigns-create), [Get](./REFERENCE.md#campaigns-get), [Update](./REFERENCE.md#campaigns-update), [Search](./REFERENCE.md#campaigns-search) |\n| Ad Sets | [List](./REFERENCE.md#ad-sets-list), [Create](./REFERENCE.md#ad-sets-create), [Get](./REFERENCE.md#ad-sets-get), [Update](./REFERENCE.md#ad-sets-update), [Search](./REFERENCE.md#ad-sets-search) |\n| Ads | [List](./REFERENCE.md#ads-list), [Create](./REFERENCE.md#ads-create), [Get](./REFERENCE.md#ads-get), [Update](./REFERENCE.md#ads-update), [Search](./REFERENCE.md#ads-search) |\n| Ad Creatives | [List](./REFERENCE.md#ad-creatives-list), [Search](./REFERENCE.md#ad-creatives-search) |\n| Ads Insights | [List](./REFERENCE.md#ads-insights-list), [Search](./REFERENCE.md#ads-insights-search) |\n| Ad Account | [Get](./REFERENCE.md#ad-account-get), [Search](./REFERENCE.md#ad-account-search) |\n| Custom Conversions | [List](./REFERENCE.md#custom-conversions-list), [Search](./REFERENCE.md#custom-conversions-search) |\n| Images | [List](./REFERENCE.md#images-list), [Search](./REFERENCE.md#images-search) |\n| Videos | [List](./REFERENCE.md#videos-list), [Search](./REFERENCE.md#videos-search) |\n| Pixels | [List](./REFERENCE.md#pixels-list), [Get](./REFERENCE.md#pixels-get) |\n| Pixel Stats | [List](./REFERENCE.md#pixel-stats-list) |\n| Ad Library | [List](./REFERENCE.md#ad-library-list) |

Example Prompts

The Facebook Marketing connector is optimized to handle prompts like these

Lorem ipsum

List all active campaigns in my ad account - What ads are currently running in a recent campaign? - List all ad creatives in my account - What is the status of my campaigns? - List all custom conversion events in my account - Show me all ad images in my account - What videos are available in my ad account? - Create a new campaign called 'Summer Sale 2026' with traffic objective - Pause my most recent campaign - Create a new ad set with a $50 daily budget in my latest campaign - Update the daily budget of my top performing ad set to $100 - Rename my most recent ad set to 'Holiday Promo' - Create a new ad in my latest ad set - Pause all ads in my most recent ad set - List all pixels in my ad account - Show me the event stats for my pixel - What events is my Facebook pixel tracking? - Search the Ad Library for political ads in the US - Find ads about climate change in the Ad Library - Show me Ad Library ads from a specific Facebook page - Show me the ad sets with the highest daily budget - Show me the performance insights for the last 7 days - Which campaigns have the most spend this month? - Show me ads with the highest click-through rate

Why Airbyte for AI Agents?

Built for production AI workloads with enterprise-grade reliability

Secure Authentication

Built-in OAuth 2.0 handling with automatic token refresh. No hard-coded credentials.

Agent-Native Design
Heading

Structured, LLM-friendly schemas optimized for AI agent consumption with natural language query support.

Production Ready

Battle-tested connectors with comprehensive error handling, logging, and retry logic.

Open Source

Fully open source under the MIT license. Contribute, customize, and extend freely.

Works with your favorite frameworks

Use our connectors with your favorite AI agent frameworks.

LangChain

CrewAI

LlamaIndex

AutoGen

OpenAI Agents SDK

Claude Agents SDK

Frequently Asked Questions

Didn't find your answer? Please don't hesitate to reach out.

How do I authenticate with Facebook Marketing?

The Facebook-Marketing connector supports Service Account Key authentication using a Facebook long-lived access token. In hosted mode, credentials are stored securely in Airbyte Cloud and you authenticate using your Airbyte client ID and client secret instead.

Can I use this connector with any AI agent framework?

The connector is compatible with any Python-based AI agent framework including LangChain, LlamaIndex, CrewAI, Pydantic AI, and custom implementations.

Does this connector support write operations?

The connector supports some write operations, including creating and updating campaigns, ad sets, and ads, as well as pausing them. However, delete operations (deleting campaigns, ad sets, ads, and ad creatives) are not currently supported.

How is this different from the Airbyte data connector?

Agent connectors are specifically designed for AI agents and LLM applications. They provide natural language interfaces, optimized response formats, and seamless integration with agent frameworks, unlike traditional ETL-focused connectors.

Ready to get the most out of your Facebook Marketing data?

Whether you're building Agents or Data Pipelines.