langchain-ai/social-media-agent
📲 An agent for sourcing, curating, and scheduling social media posts with human-in-the-loop.
Social Media Agent – What It Does
Purpose: An end‑to‑end “agent” that takes a web URL, extracts the page’s content, and automatically drafts a Twitter and LinkedIn post for you. The flow is human‑in‑the‑loop: after the LLM generates a draft you can edit, approve, or reject it before it is actually published.
Key Components
- LLM backend – Uses Anthropic’s Claude (or any Anthropic model) via the Anthropic API to write the posts.
- Web scraping – FireCrawl fetches the article, blog, GitHub repo, YouTube transcript, etc.
- Auth & posting – The Arcade service (or your own Twitter/LinkedIn developer credentials) handles OAuth, token storage and the actual API calls to publish.
- State & orchestration – A LangGraph graph runs the whole pipeline (scrape → summarize → draft → human review → post). The graph is served locally with the
langgraph-cliand can be deployed on LangGraph Cloud. - Optional integrations – Supabase for image storage, Slack for ingesting URLs via a channel, and GitHub for repo‑specific content.
How to Run (quick‑start)
- Clone the repo and install dependencies (
yarn install). - Copy
.env.quickstart.example→.envand fill in the required keys (Anthropic, FireCrawl, Arcade, LangSmith optional). - Install the LangGraph CLI (
pip install langgraph-cli). - Start the in‑memory LangGraph server:
yarn langgraph:in_mem:up. - Run
yarn generate_post– the script calls thegenerate_postgraph on a sample LangChain blog URL. Results appear in LangSmith or in the Agent Inbox UI.
Full‑feature setup adds:
- YouTube video handling via Google Vertex AI.
- Image selection/upload via Supabase.
- Slack‑driven cron jobs that pull URLs from a channel and automatically invoke the graph.
- Direct Twitter/LinkedIn OAuth (instead of Arcade) for full media upload support.
- GitHub URL parsing and organization‑level LinkedIn posting.
Customization
- Prompt files under
src/agents/generate-post/prompts/let you change business context, example posts, structure instructions, and style guidelines. - Post‑style prompts control tone and formatting without touching the code.
Typical Use‑Case A marketing team drops a link into a designated Slack channel. A daily cron runs, the agent scrapes the link, drafts a concise, brand‑aligned tweet and LinkedIn update, shows the draft in the Agent Inbox for a quick edit, and then publishes it automatically.
Who Might Want This
- Content marketers looking to automate social‑media copy generation.
- Developers who want a ready‑made LangGraph example of a HITL workflow.
- Teams that already use LangChain/LangGraph and want to extend it to social platforms.
Bottom Line: The Social Media Agent is a genuine, runnable project that demonstrates how to combine LLM generation, web scraping, OAuth authentication, and a human‑in‑the‑loop UI to automate posting on Twitter and LinkedIn.
Related
- Project
- Project
- Project
- Project
- Project