A technical blueprint for an autonomous AI social media agent that scrapes a user's historical posts, learns their writing style, stores that voice profile persistently, and publishes new posts in it via API. Uses ScrapeGraph for structured web scraping, Nebius AI for language analysis and generation, Memori for persistent style memory across sessions, and Composio to handle OAuth and posting. Covers the three-phase workflow, environment configuration, dependencies, and a modular file structure.
Generic AI writing tools produce copy in nobody’s voice, so every draft needs heavy editing before it can go out. A social media agent closes that gap by learning your voice first: it scrapes your best-performing historical posts, analyzes the style, stores that profile permanently, and drafts and publishes in it — so the output stays on-brand without a rewrite each time.
The stack
Four tools, one per phase of the workflow.
| Component | Tool | Role | Why it’s here |
|---|---|---|---|
| Language model | Nebius AI | Analyzes and generates text. | Access to several high-performance models at efficient compute cost. |
| Data ingestion | ScrapeGraph (SGAI) | AI-powered web scraping. | Extracts post history dynamically, avoiding brittle CSS-selector scraping. |
| Execution | Composio | API integration and posting. | Handles OAuth and rate limits for platforms like Twitter/X. |
| Memory | Memori | Stores the style profile. | Retains tone and voice across sessions without re-analyzing every time. |
The workflow
1. Ingest. The user supplies a target handle. ScrapeGraph navigates to the profile and extracts the text of the most popular posts — around the top ten viral posts is usually enough of a baseline to replicate a style reliably.
2. Analyze and store. Nebius AI examines the posts across tone, formatting, vocabulary, and cadence, producing a voice profile. Memori persists that profile so the agent carries the same voice into every future session.
3. Generate and post. When the operator gives a new topic, the agent pulls the stored profile from Memori, Nebius AI drafts a post matching that voice, and — once approved — Composio publishes it live via API.
Implementation
Keep API keys in a .env file; never hardcode them.
# Nebius AI Configuration
NEBIUS_API_KEY=your_nebius_api_key
# ScrapeGraph Configuration
SGAI_API_KEY=your_scrapegraph_api_key
# Composio Twitter Integration
COMPOSIO_API_KEY=your_composio_api_key
TWITTER_AUTH_CONFIG_ID=your_twitter_auth_config_id
USER_ID=your_unique_user_identifier
Install dependencies via requirements.txt or a modern manager like uv:
streamlit— user interfacecomposio— API executionlangchain-scrapegraph— data ingestionmemorisdk— persistent memorylangchain-nebius— LLM orchestration
Split the logic into three modules:
app.py— the Streamlit dashboard the operator drives.twitter_agents.py— core logic: ScrapeGraph ingestion, Nebius analysis, Memori storage.create_tweet.py— the execution script that connects Composio to the account and posts.
Why it matters
Delegating the drafting and posting turns the operator’s job from tactical to strategic — you set topics and approve, the agent handles the rest. And because the voice profile lives in Memori, the same profile and Composio integration can be pointed at other text-heavy channels — LinkedIn, Instagram — once the core pipeline is stable, without re-learning the voice from scratch.
- Persistent Memory
- Agentic Workflow
- API Execution
- Style Replication


More Guides
Run disciplined SEO A/B tests in seven steps — one metric, two variations, randomized segments, run to significance, track, analyze the winner, and iterate.
Build a topic cluster in seven steps — select and score a pillar, validate it, map subtopics, align to intent, architect internal links, publish, and measure.
Prepare your site for AI search in five steps — content architecture, entity consistency, E-E-A-T, structured data, and machine-readable structure.
Get your content cited by AI in seven steps — answer capsules, link-free extraction, original data, digital PR, community presence, consistent messaging, and tracking.
A seven-step walkthrough for setting up Google Search Console on a new site — property type, DNS verification, sitemap, GA4 link, users, URL checks, and a monitoring routine.