Skip to content

Architecture

The recommended approach combines multiple specialized tools for complete platform coverage.

Social Media Automation Workflow

Content Paths

PathFlowUse Case
Chinese PlatformsContent → blog-auto-publishing-tools → Juejin, CSDN, Zhihu, CNBlogsTech blog cross-posting
InternationalContent → Postiz → Twitter, LinkedIn, Reddit, InstagramSocial media management
Release AutomationGitHub Release → Actions → Twitter + DiscordAutomated notifications

Tech Stack Architecture

The promotion-agent reference implementation uses a three-layer architecture:

Tech Stack Architecture

LayerComponentsPurpose
CLI LayerTyper, Rich, Jinja2User interface, formatting, templates
Core EngineOrchestrator Agent, Plugin Registry, Content Adapter, Pydantic SettingsCoordination, discovery, transformation, config
Platform Agents11 specialized agents (httpx, praw, tweepy)Platform-specific execution

Agent Execution Flow — ReAct Pattern

Each platform agent follows a ReAct (Reason + Act) loop:

Agent Execution Flow — ReAct Pattern

The Four Phases

PhaseActionExample
ObserveValidate config, check platform healthvalidate_config() verifies API keys exist
ThinkAdapt content to platform-specific formatadapt_content() truncates Twitter to 280 chars
ActExecute API callPOST to platform API, handle OAuth, submit forms
ReflectCheck result, handle errorsParse response, capture URL/error in PostResult

Complex Agent Workflows

MoltBook — Challenge-Response (ReAct with reasoning):

Submit content → Receive 202 + math challenge → Solve (X + Y) → Verify with answer

Hacker News — Stateful Web Agent:

Login (session cookie) → GET /submit (extract CSRF token) → POST /r (form submit)

Both demonstrate multi-step reasoning where the agent must observe intermediate states, make decisions, and adapt its actions accordingly.


Design Patterns

The codebase implements six key patterns:

Design Patterns & Agent Architecture

Plugin Registry

python
@register_platform
class RedditPlatform(BasePlatform):
    PLATFORM_NAME = "reddit"
    # Auto-registered, zero config

New platforms are added by creating a single file with the @register_platform decorator. No modifications to existing code required.

Strategy Pattern

Each platform implements adapt_content() differently — Reddit truncates titles to 300 chars, Twitter limits to 280, Dev.to lowercases tags. The orchestrator doesn't know the details.

Template Method

BasePlatform defines the contract (validate_config, adapt_content, post, health_check). Each platform fills in the implementation.

Error Isolation

python
for platform in targets:
    try:
        result = platform.post(content)
    except Exception as e:
        result = PostResult(success=False, error=str(e))
    results.append(result)

One platform failure never blocks others.


Content Adaptation Pipeline

Generic content flows through platform-specific adapters:

Content Adaptation Pipeline

PlatformTitle LimitBody LimitSpecial Handling
Reddit300 charsFull markdownSubreddit routing, URL footer
Twitter/X280 chars totalHashtags from tags, URL appended
Dev.toFull markdownMax 4 lowercase tags, draft support
Hacker News80 chars— (link post)"Show HN:" prefix
Product HuntTagline: 60 charsGraphQL mutation
Chinese PlatformsFull contentCookie auth, platform-specific JSON

The adapter pattern ensures the orchestrator works with a single PromotionContent interface while each platform receives exactly the payload format it expects.

Released under the MIT License.