This project is a LangGraph-based template designed to audit Meta ads and webpage content to provide insights on ad performance and compliance.
- Meta Ads auditing
- Webpage content analysis
- Data analysis of collected information
- Automated report generation
- Multi-agent collaboration with specialized experts
The application is built using LangGraph, a framework for building stateful, multi-agent workflows. It includes:
- Multiple specialized agents (Workshop Supervisor, Ads Expert, Web Expert, Data Analyzer)
- Tool nodes for data collection and processing
- A configurable workflow graph that coordinates the agents
- Python 3.11+
- LangGraph
- LangChain
- OpenAI API key
- Clone the repository:
git clone https://github.com/AIHackersLabs/ads-adquisition-agent-template
cd ads-adquisition-agent-template
- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Create a
.env
file with your API keys:
OPENAI_API_KEY=your-openai-api-key
LANGSMITH_API_KEY=your-langsmith-api-key # Optional, for tracing
LANGCHAIN_TRACING_V2=true # Optional, for tracing
LANGSMITH_PROJECT=your-project-name # Optional, for tracing
To run the application locally with LangGraph dev server:
langgraph dev
This will start the LangGraph server.
You can interact with the application using the LangGraph SDK:
from langgraph_sdk import get_client
client = get_client(url="http://localhost:2024")
async for chunk in client.runs.stream(
None, # Threadless run
"agent", # Name of assistant. Defined in langgraph.json
input={
"messages": [{
"role": "human",
"content": "Audit this Meta ad: <URL>",
}],
},
stream_mode="updates",
):
print(f"Receiving new event of type: {chunk.event}...")
print(chunk.data)
print("\n\n")
To customize the workflow:
- Modify
graph.py
to add new agents or tools - Update the graph structure by modifying the edges between nodes
- Implement your own custom tools by updating the tool node functions
This project is licensed under the MIT License. See the LICENSE file for more details.