LangChain

Build a social media agent with Managed Deep Agents

Published 2026-08-12 · Duration 12:49

Summary

This tutorial demonstrates building an autonomous social media agent using LangChain's Managed Deep Agents (MDA). The resulting agent monitors Hacker News and X (Twitter) to generate daily drafts of post ideas, which are then delivered directly to the user via Slack. The process covers setting up the project structure, defining custom tools, implementing specialized skills, configuring persistent memory across sessions, scheduling autonomous execution, and deploying the system to a production channel.

Download summary

Key takeaways

  1. Agent Initialization and Setup 2:00

    The process begins by installing dependencies using `UV tool install managed deep agents` and initializing the project with `MDA init social post assistant`. The agent's entry point (`agent.py`) is configured, specifying model properties (e.g., changing to `GPT-5.6 Luna` for cost efficiency) and defining access tools.

  2. Tooling and Data Integration 3:50

    Custom tools are built to interact with external APIs: a tool to search Hacker News (using Algolia API) and two tools for X/Twitter (`get X user timeline` and `search X posts`). Authentication requires defining bearer tokens in the `.env` file.

  3. Advanced Agent Configuration 5:50

    The agent's behavior is governed by a core instruction file (`instructions.md`) and specialized, modular knowledge packages called 'Skills.' A skill (e.g., `draft posts`) provides dynamic instructions for specific tasks like drafting or revising content.

  4. Persistence and Automation 7:50

    To maintain context across different runs, a memory file (`memory.py`) is set with the scope to 'agent.' The agent's autonomy is established by creating a schedule (e.g., `morning drafts.py`) using cron expressions to run daily at 9:00 a.m. Pacific time.

  5. Deployment and Connectivity 9:40

    The agent is tested locally via `MDA dev` (which opens the agent in LangSmith Studio) before deployment using `MDA deploy`. Slack integration requires running `mda channel add slack`, generating a manifest, and setting up necessary environment variables (Slack signing secret and bot token).

Technical details

  • Project Setup & Dependencies 90s

    Managed Deep Agents requires specific commands: `UV tool install managed deep agents` and project initialization via `MDA init <agent-name>`. The LangSmith API key must be set in the `.env` file.

  • Agent Core Definition 140s

    The agent's properties are defined in `agent.py`, allowing customization of the model (e.g., `GPT-5.6 Luna`) and defining access to tools, sub-agents, and middleware.

  • Tool Implementation 230s

    Tools are implemented as Python functions decorated with the LangChain tool decorator. The function's docstring serves as the agent's description, while arguments define visible input parameters.

  • Memory and State Management 400s

    To ensure memory persists across multiple conversation threads, a `memory.py` file must be created in the project root and set with the scope to 'agent.'

  • Scheduling and Execution 470s

    Autonomous execution is configured using a schedule directory, defining a cron tab expression (e.g., running every weekday at 9:00 a.m.) and setting `auto_post = true` for unattended posting.

  • Deployment Workflow 580s

    The deployment process involves running `MDA deploy`, followed by manually linking the channel using `mda channel add slack`. The final step requires setting Slack credentials and redeploying to activate the connection.

Mentioned resources

Channel & topics

Watch on YouTube · Back to latest

This independent, AI-assisted summary is provided for commentary and informational purposes. It may contain errors or omit important context. Please watch the original video for the creator's complete presentation. Video, thumbnail, and related copyrights belong to their respective owners.