How vaishnavi-newalkar/contentmesh_content_generator works
Purpose and Entry Points
ContentMesh is an AI-driven enterprise content pipeline: it creates content from a brief, reviews it for compliance, localizes it, adapts it to delivery channels, and distributes or simulates distribution. It can run as a CrewAI CLI workflow or a FastAPI service with a static demo dashboard.
Primary entry points:
• API server and frontend serving: app.py
• CrewAI/CLI execution: src/contentmesh/main.py
• One-command container/service startup: scripts/start.sh
• Browser demo UI: frontend/index.html
HTTP API and User-Facing Execution Boundary
app.py is the service boundary. It exposes generation, demo-result, health, and server-sent progress endpoints, and serves the frontend. A client submits a structured brief containing topic, audience, tone, requested locales/channels, compliance rules, and optional recipient email.
The API path separates interactive clients from the agent runtime:
• Request/response schemas are centralized in src/contentmesh/schemas.py.
• Progress can be streamed independently of final pipeline output.
• The prebuilt demo result permits UI use without LLM or delivery credentials.
Sequential Multi-Agent Orchestration
src/contentmesh/crew.py defines the CrewAI @CrewBase orchestration layer. It constructs the five-agent pipeline with a sequential process, so each downstream task receives earlier task context rather than independently regenerating the brief.
Architecture-defining stages are configured rather than hard-coded:
1. Content creation
2. Compliance review
3. Localization
4. Per-channel formatting
5. Distribution
The runtime implementation is in src/contentmesh/crew.py; agent identities and task dependencies live in:
• src/contentmesh/config/agents.yaml
• src/contentmesh/config/tasks.yaml
Configuration-Driven Agent and Task Contracts
The YAML files are the pipeline’s primary behavioral contract. agents.yaml supplies each agent’s role, goal, and backstory; tasks.yaml supplies prompts, expected output, owning agent, and upstream context. This makes agent behavior and stage ordering editable without restructuring Python orchestration.
src/contentmesh/main.py invokes the crew for CLI execution, including the standard CrewAI-compatible path that produces workflow output. src/contentmesh/llm_config.py is the likely central boundary for selecting/configuring the LLM provider and credentials.
Validation, Guardrails, and Observability
Structured data contracts and safety controls are separate from agent prompts:
• src/contentmesh/schemas.py defines typed input/output shapes for API and pipeline payloads.
• src/contentmesh/guardrails.py contains policy or output-validation logic around generated enterprise content.
• src/contentmesh/token_tracker.py records model-token consumption; token_usage_log.json is the persisted usage artifact.
• src/contentmesh/analytics.py provides a distinct analytics layer for pipeline or distribution metrics.
• src/contentmesh/database.py is the persistence boundary if run-state, results, or analytics require storage.
Distribution and External Integrations
The final distribution stage is isolated behind tools in src/contentmesh/tools/distributor_tools.py. It supports email, Slack posting, and distribution logging, allowing the agent workflow to invoke delivery operations without embedding transport logic in orchestration.
Material external dependencies and runtimes:
• Anthropic-backed LLM access via ANTHROPIC_API_KEY.
• Optional SMTP server for email delivery.
• Optional Slack Incoming Webhook for Slack delivery.
• FastAPI/Uvicorn for HTTP serving and SSE.
• CrewAI for multi-agent execution.
• Docker deployment through Dockerfile and docker-compose.yml.
Absent SMTP or Slack credentials, distribution remains a demo/simulated operation rather than blocking the content-generation pipeline.
Main entry points: crew.py Sequential crew · app.py FastAPI service · distributor_tools.py Distribution tools · index.html Static dashboard
Components 19
Entry points
- Demo browser · Submits briefs and consumes progress/results.
- Static dashboard
frontend/index.html - FastAPI service · Serves the dashboard, API endpoints, demo results, and progress streams.
app.py - CrewAI CLI
src/contentmesh/main.py - Container startup
scripts/start.sh
Pipeline runtime
- Sequential crew · Runs five context-carrying stages in order.
src/contentmesh/crew.py - Agent contracts · Roles, goals, and backstories for pipeline agents.
src/contentmesh/config/agents.yaml - Task contracts · Prompts, owners, expected outputs, and upstream context.
src/contentmesh/config/tasks.yaml - Anthropic LLM · Selected and configured with provider credentials.
src/contentmesh/llm_config.py
Contracts and controls
- Payload schemas · Structured brief and pipeline input/output shapes.
src/contentmesh/schemas.py - Content guardrails
src/contentmesh/guardrails.py - Token tracking
src/contentmesh/token_tracker.py - Token usage log
token_usage_log.json
Distribution and operations
- Analytics layer
src/contentmesh/analytics.py - Persistence boundary · Stores run state, results, or analytics when enabled.
src/contentmesh/database.py - Distribution tools · Email, Slack, and simulated distribution logging.
src/contentmesh/tools/distributor_tools.py - SMTP and Slack · Optional credentials enable live delivery; otherwise distribution is simulated.
- Docker deployment
Dockerfile - Compose service
docker-compose.yml
Connections 19
- Demo browser → Static dashboard: loads
- Static dashboard → FastAPI service: briefs, results, SSE
- FastAPI service → Payload schemas: validates payloads
- FastAPI service → Sequential crew: starts generation
- CrewAI CLI → Sequential crew: runs workflow
- Container startup → FastAPI service: starts service
- Sequential crew → Agent contracts: loads identities
- Sequential crew → Task contracts: loads sequential stages
- Sequential crew → Anthropic LLM: generates content
- Sequential crew → Content guardrails: validates output
- Sequential crew → Distribution tools: final delivery stage
- Sequential crew → Token tracking: records usage
- Token tracking → Token usage log: persists tokens
- Distribution tools → SMTP and Slack: delivers when configured
- Distribution tools → Analytics layer: emits metrics
- Analytics layer → Persistence boundary: persists metrics
- FastAPI service → Persistence boundary: stores runs/results
- Compose service → Docker deployment: builds service
- Docker deployment → Container startup: runs