Agents

LangChain Launches Open-Source Paid Media Agent

LangChain has open-sourced an autonomous Paid Media Agent that boosted its paid marketing pipeline from zero to 20 percent in six months while cutting lead costs by 30 percent.

LangChain Blog2 days agoAgents
Image: LangChain Blog

LangChain has designed and open-sourced its internal Paid Media Agent, an AI assistant built to manage, analyze, and optimize advertising campaigns across multiple platforms. Over a six-month period, the tool helped scale the company's paid advertising from zero to 20 percent of its total marketing pipeline. Between June and August, LangChain saw its cost per qualified lead drop by 30 percent even as monthly ad spend grew by approximately 60 percent. On LinkedIn, the company's largest social channel, the cost per lead fell 40 percent compared to January levels. Additionally, bringing reporting in-house saved the company roughly $5,000 per month.

The system runs on the LangChain Deep Agents harness, operating within Slack and scheduled cron jobs. To optimize performance, developers shifted deterministic calculations from the LLM to Python code. This adjustment made an early reporting workflow 40 times cheaper and 13 times faster, slashing execution times from 18 minutes down to just 85 seconds. Previously, a single report on a frozen test set consumed 3.9 million input tokens and cost more than $3. The agent now utilizes an isolated LangSmith Sandbox microVM with a 32 GB disk, pre-baked with libraries like pandas, DuckDB, and openpyxl, which cut startup times by 10 seconds.

To prevent context bloat, LangChain structured the agent's workspace into five layers, including six skill folders and a 19-page business wiki. Instead of loading all 200 available ad-platform tools from Pipeboard's Model Context Protocol catalog upfront, which originally required 38,000 tokens, the agent uses a search-and-read interface. This reduced the initial turn to 12,000 tokens, making it four times cheaper. The architecture relies on a parent agent that delegates tasks to platform-specific subagents to isolate data context.

For campaign operations, the agent proposes changes like keyword additions or targeting adjustments directly in Slack using Block Kit cards. To ensure security, the system verifies Slack user IDs, allowing only authorized team members to approve and execute the proposed actions.

This is our own summary of reporting by LangChain Blog

More in Agents