{
  "name": "AI Content Generation Pipeline",
  "version": "1.0.0",
  "description": "Multi-stage AI content generation: Research -> Outline -> Draft -> Review -> Final - demonstrates AI node chaining",
  "input_schema": {
    "type": "object",
    "properties": {
      "topic": {
        "type": "string",
        "description": "Topic to write about"
      },
      "content_type": {
        "type": "string",
        "enum": ["blog_post", "technical_doc", "marketing_copy", "tutorial"],
        "default": "blog_post"
      },
      "target_audience": {
        "type": "string",
        "description": "Who is this content for?",
        "default": "general audience"
      },
      "word_count": {
        "type": "integer",
        "default": 500,
        "minimum": 100,
        "maximum": 2000
      },
      "tone": {
        "type": "string",
        "enum": ["professional", "casual", "technical", "friendly"],
        "default": "professional"
      }
    },
    "required": ["topic"]
  },
  "output_schema": {
    "type": "object",
    "properties": {
      "title": { "type": "string" },
      "content": { "type": "string" },
      "meta_description": { "type": "string" },
      "keywords": { "type": "array" },
      "review_notes": { "type": "string" }
    }
  },
  "stages": [
    {
      "id": "log-start",
      "name": "Log Content Request",
      "component_type": "logger",
      "config": {
        "message": "Starting content generation",
        "level": "info",
        "data": {
          "topic": "{{input.topic}}",
          "type": "{{input.content_type}}",
          "audience": "{{input.target_audience}}"
        }
      },
      "depends_on": [],
      "position": { "x": 100, "y": 200 }
    },
    {
      "id": "research-topic",
      "name": "Research & Key Points",
      "component_type": "generator",
      "config": {
        "system_prompt": "You are a research assistant. Analyze topics and identify key points, angles, and facts to cover. Output structured research notes.",
        "prompt": "Research this topic for a {{input.content_type}}:\n\nTopic: {{input.topic}}\nTarget Audience: {{input.target_audience}}\n\nProvide:\n1. Key points to cover (5-7 bullet points)\n2. Interesting angles or hooks\n3. Potential examples or case studies\n4. Keywords for SEO\n\nBe thorough but concise.",
        "max_tokens": 800,
        "temperature": 0.7
      },
      "depends_on": ["log-start"],
      "position": { "x": 300, "y": 200 }
    },
    {
      "id": "create-outline",
      "name": "Create Content Outline",
      "component_type": "generator",
      "config": {
        "system_prompt": "You are a content strategist. Create detailed outlines for content pieces that are engaging and well-structured.",
        "prompt": "Create an outline for a {{input.content_type}} about:\n\nTopic: {{input.topic}}\nTarget Word Count: {{input.word_count}} words\nTone: {{input.tone}}\n\nResearch Notes:\n{{upstream.research-topic.content}}\n\nCreate a detailed outline with:\n- Compelling title options (3)\n- Introduction hook\n- Main sections with bullet points\n- Conclusion approach\n- Call to action",
        "max_tokens": 600,
        "temperature": 0.6
      },
      "depends_on": ["research-topic"],
      "position": { "x": 500, "y": 200 }
    },
    {
      "id": "write-draft",
      "name": "Write First Draft",
      "component_type": "generator",
      "config": {
        "system_prompt": "You are an expert content writer. Write engaging, well-researched content that connects with readers. Match the requested tone perfectly.",
        "prompt": "Write a {{input.content_type}} based on this outline:\n\n{{upstream.create-outline.content}}\n\nRequirements:\n- Topic: {{input.topic}}\n- Target Length: {{input.word_count}} words\n- Tone: {{input.tone}}\n- Audience: {{input.target_audience}}\n\nWrite the complete content now. Make it engaging and valuable.",
        "max_tokens": 2000,
        "temperature": 0.8
      },
      "depends_on": ["create-outline"],
      "position": { "x": 700, "y": 200 }
    },
    {
      "id": "review-content",
      "name": "AI Content Review",
      "component_type": "generator",
      "config": {
        "system_prompt": "You are an editor reviewing content. Provide constructive feedback on clarity, engagement, accuracy, and tone. Be specific and actionable.",
        "prompt": "Review this {{input.content_type}}:\n\n{{upstream.write-draft.content}}\n\nTarget Audience: {{input.target_audience}}\nIntended Tone: {{input.tone}}\n\nProvide:\n1. Overall assessment (1-2 sentences)\n2. Strengths (3 points)\n3. Areas for improvement (3 points)\n4. Specific suggestions\n5. SEO recommendations",
        "max_tokens": 500,
        "temperature": 0.3
      },
      "depends_on": ["write-draft"],
      "position": { "x": 900, "y": 200 }
    },
    {
      "id": "generate-meta",
      "name": "Generate Meta Content",
      "component_type": "generator",
      "config": {
        "system_prompt": "You are an SEO specialist. Generate meta descriptions and keywords. Output ONLY valid JSON.",
        "prompt": "Generate SEO metadata for this content:\n\nTitle area from outline:\n{{upstream.create-outline.content}}\n\nContent preview:\n{{upstream.write-draft.content}}\n\nOutput JSON only:\n{\"meta_description\": \"150 char max description\", \"keywords\": [\"keyword1\", \"keyword2\", ...], \"suggested_title\": \"optimized title\"}",
        "max_tokens": 200,
        "temperature": 0.2
      },
      "depends_on": ["write-draft"],
      "position": { "x": 900, "y": 350 }
    },
    {
      "id": "parse-meta",
      "name": "Parse Meta JSON",
      "component_type": "json_transform",
      "config": {
        "data": "{{upstream.generate-meta.content}}",
        "jmespath_expression": "@"
      },
      "depends_on": ["generate-meta"],
      "position": { "x": 1100, "y": 350 }
    },
    {
      "id": "format-output",
      "name": "Format Final Output",
      "component_type": "json_transform",
      "config": {
        "data": {
          "draft": "{{upstream.write-draft.content}}",
          "review": "{{upstream.review-content.content}}",
          "meta": "{{upstream.parse-meta.result}}",
          "topic": "{{input.topic}}",
          "type": "{{input.content_type}}"
        },
        "jmespath_expression": "{ title: meta.suggested_title || topic, content: draft, meta_description: meta.meta_description, keywords: meta.keywords, review_notes: review, content_type: type, word_count: length(draft) }"
      },
      "depends_on": ["review-content", "parse-meta"],
      "position": { "x": 1100, "y": 200 }
    }
  ],
  "output_stage_id": "format-output"
}
