How auxin-io/agentic-marketing-agency works
Marketing Agency Demo is an agentic lead-prospecting system with a streamed web workflow and a separate MCP interface for invoking agents. The main workflow finds companies, researches and enriches them, scores and ranks leads, exports a CSV, and optionally emails it after policy checks and human approval. It also includes a free-form assistant and standalone generation and qualification workflows. The graph follows README-documented stages and SOURCE INDEX references; some UI-to-route and unsampled subsystem wiring is not shown, so those relationships are omitted.
Main entry points: integrated-lead-pipeline.ts Integrated pipeline · index.ts Mastra registry · lead-research-agent.ts Research agent · lead-generation-tool.ts Lead generation
Components 27
User channels
- Web UI
src/app/page.tsx - Streaming API
src/app/api/run-pipeline-stream/route.ts - Approval API
src/app/api/approve/route.ts - MCP server
mcp-server.ts
Lead workflow
- Mastra registry
src/mastra/index.ts - Integrated pipeline
src/mastra/workflows/integrated-lead-pipeline.ts - Lead schemas
src/mastra/workflows/schemas.ts - Generation workflow
src/mastra/workflows/lead-generation-workflow.ts - Qualification workflow
src/mastra/workflows/lead-qualification-workflow.ts
Agents and tools
- Lead generation
src/mastra/tools/lead-generation-tool.ts - Lead research
src/mastra/tools/lead-research-tool.ts - Research agent
src/mastra/agents/lead-research-agent.ts - Company enrichment
src/mastra/tools/company-enrichment-tool.ts - Lead scoring
src/mastra/workflows/score-lead.ts - Scoring agent
src/mastra/agents/lead-scoring-agent.ts - CSV export
src/mastra/tools/csv-export-tool.ts - Email delivery
src/mastra/tools/email-tool.ts - Simple assistant
src/mastra/agents/simple-assistant-agent.ts - HTTP helpers
src/mastra/tools/http.ts - Model configuration
src/mastra/agents/model.ts
Security and delivery
- Injection defense
src/mastra/security/prompt-injection.ts - Egress policy
src/mastra/security/egress-policy.ts - Approval gate
src/mastra/security/approval.ts - Security events
src/mastra/security/events.ts
Other components
- Prospecting user
- Exa search
- SMTP service
Connections 30
- Prospecting user → Web UI: submits brief
README.md - Web UI → Streaming API: streams progress
- Streaming API → Mastra registry: uses registry
src/app/api/run-pipeline-stream/route.ts - MCP server → Mastra registry: uses registry
mcp-server.ts - Mastra registry → Integrated pipeline: registers workflow
src/mastra/index.ts - Mastra registry → Simple assistant: registers agent
src/mastra/index.ts - Integrated pipeline → Lead generation: searches leads
src/mastra/workflows/integrated-lead-pipeline.ts - Lead generation → Exa search: searches companies
README.md - Integrated pipeline → Lead research: gets context
src/mastra/workflows/integrated-lead-pipeline.ts - Research agent → Lead research: uses tool
src/mastra/agents/lead-research-agent.ts - Integrated pipeline → Research agent: classifies leads
src/mastra/workflows/integrated-lead-pipeline.ts - Integrated pipeline → Injection defense: scans context
src/mastra/workflows/integrated-lead-pipeline.ts - Integrated pipeline → Company enrichment: enriches leads
src/mastra/workflows/integrated-lead-pipeline.ts - Lead research → HTTP helpers: fetches sources
src/mastra/tools/lead-research-tool.ts - Company enrichment → HTTP helpers: fetches websites
src/mastra/tools/company-enrichment-tool.ts - Integrated pipeline → Lead scoring: scores leads
src/mastra/workflows/integrated-lead-pipeline.ts - Lead scoring → Scoring agent: requests score
src/mastra/workflows/score-lead.ts - Integrated pipeline → CSV export: exports results
src/mastra/workflows/integrated-lead-pipeline.ts - Integrated pipeline → Email delivery: sends report
src/mastra/workflows/integrated-lead-pipeline.ts - Email delivery → SMTP service: delivers email
README.md - Integrated pipeline → Egress policy: checks recipient
src/mastra/workflows/integrated-lead-pipeline.ts - Integrated pipeline → Approval gate: requests approval
src/mastra/workflows/integrated-lead-pipeline.ts - Approval API → Approval gate: resolves decision
src/app/api/approve/route.ts - Integrated pipeline → Security events: records controls
src/mastra/workflows/integrated-lead-pipeline.ts - Generation workflow → Lead generation: runs search
src/mastra/workflows/lead-generation-workflow.ts - Qualification workflow → Company enrichment: enriches leads
src/mastra/workflows/lead-qualification-workflow.ts - Qualification workflow → Lead scoring: scores leads
src/mastra/workflows/lead-qualification-workflow.ts - Integrated pipeline → Lead schemas: builds summary
src/mastra/workflows/integrated-lead-pipeline.ts - Research agent → Model configuration: uses model
src/mastra/agents/lead-research-agent.ts - Scoring agent → Model configuration: uses model
src/mastra/agents/lead-scoring-agent.ts