> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mavera.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Market Entry Research

> Use Mave Agent to research competitive landscapes, regulatory environments, buyer personas, and go-to-market strategies for a new market

## Mavera Surfaces Used

| Surface                                               | Role                                                                               |
| ----------------------------------------------------- | ---------------------------------------------------------------------------------- |
| **Mave Agent** (`POST /mave/chat`)                    | Deep research — competitive landscape, regulations, buyer profiles, GTM strategies |
| **Mave Threads** (`POST /mave/chat` with `thread_id`) | Multi-turn follow-up to drill into specific findings                               |
| **Chat + `response_format`**                          | Structure raw research into a standardized market entry brief                      |

<Info>
  Mave Agent has access to web search, knowledge bases, and real-time news. Every claim is sourced, so you can verify before acting.
</Info>

***

## What Value Does Mavera Add?

| Value                 | How                                                                                                                              |
| --------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| **Insurance**         | Research is sourced and verifiable — no hallucinated market data. Multi-turn threads let you challenge claims before committing. |
| **Opening new doors** | A full market entry brief in hours instead of weeks. Run multiple markets in parallel to compare opportunities.                  |
| **Saving time**       | One API call kicks off research that would take an analyst days. Structured output feeds directly into planning documents.       |

***

## When to Use This

* You're evaluating whether to enter a new market, vertical, or geography.
* You need a structured brief covering competition, regulation, buyers, and GTM — not a generic summary.
* You want to compare multiple markets side-by-side using the same research framework.
* You're preparing a board deck or investment memo and need sourced market intelligence.

***

## What You Need

| Requirement                        | Details                                                                                                         |
| ---------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| **Mavera API key**                 | Starts with `mvra_live_`. Get one at [Developer Settings](https://app.mavera.io/settings/developer).            |
| **Workspace ID**                   | From your dashboard URL (`ws_...`).                                                                             |
| **Market definition**              | The market, vertical, or geography you're evaluating (e.g. "B2B cybersecurity compliance for mid-market SaaS"). |
| **Credits**                        | \~100–300 total. See [Credits Estimate](#credits-estimate).                                                     |
| **Python 3.8+** or **Node.js 18+** | `requests` / `openai` for Python; native `fetch` for Node.                                                      |

```
MAVERA_API_KEY=mvra_live_your_key_here
MAVERA_WORKSPACE_ID=ws_your_workspace_id
TARGET_MARKET=B2B cybersecurity compliance for mid-market SaaS
```

***

## The Research Framework

Every market entry brief covers five pillars. Mave researches each in a dedicated turn within the same thread, building context as it goes.

```mermaid theme={"dark"}
flowchart TD
    marketQuery[("Market Query")] --> maveAgent["Mave Agent: POST /mave/chat"]

    subgraph pillars["Research Pillars"]
        maveAgent --> compLandscape["Turn 1: Competitive Landscape"]
        maveAgent --> regEnv["Turn 2: Regulatory Environment"]
        maveAgent --> buyerPersonas["Turn 3: Buyer Personas"]
        maveAgent --> gtmStrategies["Turn 4: GTM Strategies"]
        maveAgent --> marketSize["Turn 5: Market Size"]
        compLandscape --> compFindings[("Players, share, pricing, gaps")]
        regEnv --> regFindings[("Compliance, licensing, legislation")]
        buyerPersonas --> buyerFindings[("Titles, budgets, pain points")]
        gtmStrategies --> gtmFindings[("Channels, pricing, launch plan")]
        marketSize --> sizeFindings[("TAM, SAM, SOM estimates")]
    end

    subgraph synthesis["Synthesis"]
        compFindings --> threadFollowUp["Thread Follow-up: Chat + response_format"]
        regFindings --> threadFollowUp
        buyerFindings --> threadFollowUp
        gtmFindings --> threadFollowUp
        sizeFindings --> threadFollowUp
        threadFollowUp --> entryBrief(("Market Entry Brief with Citations"))
    end
```

***

## The Flow

<Steps>
  <Step title="Define the market">
    Set your target market, geography, and any constraints (budget, timeline, team size). This becomes the context for all research turns.
  </Step>

  <Step title="Research competitive landscape (Turn 1)">
    Ask Mave to identify key players, market share estimates, positioning, pricing models, and recent funding or M\&A activity.
  </Step>

  <Step title="Research regulatory environment (Turn 2)">
    Within the same thread, ask Mave about compliance requirements, licensing, data privacy regulations, and any pending legislation.
  </Step>

  <Step title="Research buyer personas (Turn 3)">
    Ask Mave to profile the typical buyer — title, budget authority, pain points, decision criteria, and buying process.
  </Step>

  <Step title="Research go-to-market strategies (Turn 4)">
    Ask Mave to recommend GTM approaches based on the competitive and regulatory context it already has — channels, partnerships, pricing strategy, launch sequence.
  </Step>

  <Step title="Research risks and barriers (Turn 5)">
    Ask Mave to identify the top risks: switching costs, incumbent lock-in, regulatory barriers, and timing risks.
  </Step>

  <Step title="Structure the brief">
    Use Chat with `response_format` to transform the raw research into a standardized JSON brief you can feed into slide decks, memos, or planning tools.
  </Step>
</Steps>

***

## Code: Full Market Entry Research Pipeline

### Setup

<CodeGroup>
  ```python Python theme={"dark"}
  import os
  import json
  import time
  import requests
  from openai import OpenAI

  MAVERA_API_KEY = os.environ["MAVERA_API_KEY"]
  WORKSPACE_ID = os.environ["MAVERA_WORKSPACE_ID"]
  TARGET_MARKET = os.environ.get(
      "TARGET_MARKET",
      "B2B cybersecurity compliance for mid-market SaaS",
  )

  BASE = "https://app.mavera.io/api/v1"
  HEADERS = {
      "Authorization": f"Bearer {MAVERA_API_KEY}",
      "Content-Type": "application/json",
  }

  mavera = OpenAI(
      api_key=MAVERA_API_KEY,
      base_url=BASE,
  )
  ```

  ```javascript JavaScript theme={"dark"}
  import OpenAI from "openai";

  const MAVERA_API_KEY = process.env.MAVERA_API_KEY;
  const WORKSPACE_ID = process.env.MAVERA_WORKSPACE_ID;
  const TARGET_MARKET =
    process.env.TARGET_MARKET ||
    "B2B cybersecurity compliance for mid-market SaaS";

  const BASE = "https://app.mavera.io/api/v1";
  const HEADERS = {
    Authorization: `Bearer ${MAVERA_API_KEY}`,
    "Content-Type": "application/json",
  };

  const mavera = new OpenAI({
    apiKey: MAVERA_API_KEY,
    baseURL: BASE,
  });
  ```
</CodeGroup>

***

### Stage 1 — Mave Research Thread (5 Turns)

Each turn builds on prior context. The thread ID links them so Mave remembers previous findings.

<CodeGroup>
  ```python Python theme={"dark"}
  RESEARCH_PROMPTS = [
      {
          "pillar": "competitive_landscape",
          "prompt": (
              f"We're considering entering the {TARGET_MARKET} space. "
              "Research the competitive landscape:\n"
              "- Who are the top 5-10 players? (name, estimated market share, funding stage)\n"
              "- What positioning does each competitor use?\n"
              "- What are their pricing models?\n"
              "- Any recent M&A, funding rounds, or pivots?\n"
              "- Where are the gaps in the market that no one is addressing well?\n\n"
              "Cite your sources."
          ),
      },
      {
          "pillar": "regulatory_environment",
          "prompt": (
              "Now research the regulatory environment for this market:\n"
              "- What compliance frameworks apply (SOC 2, ISO 27001, GDPR, HIPAA, etc.)?\n"
              "- Are there licensing or certification requirements?\n"
              "- What pending legislation could impact this market in the next 12-24 months?\n"
              "- Are there geographic variations (US vs EU vs APAC)?\n"
              "- What are the compliance costs and timelines for a new entrant?\n\n"
              "Cite your sources."
          ),
      },
      {
          "pillar": "buyer_personas",
          "prompt": (
              "Based on what you've found about the competitive and regulatory landscape, "
              "research the typical buyers in this market:\n"
              "- What are the primary buyer titles and roles?\n"
              "- What budget range and authority do they have?\n"
              "- What are their top 3-5 pain points?\n"
              "- What decision criteria do they use when evaluating solutions?\n"
              "- What does their buying process look like (stages, timeline, stakeholders)?\n"
              "- Are there distinct buyer segments (enterprise vs mid-market vs SMB)?\n\n"
              "Cite your sources."
          ),
      },
      {
          "pillar": "gtm_strategies",
          "prompt": (
              "Given the competitive landscape, regulatory environment, and buyer profiles "
              "you've researched, recommend go-to-market strategies:\n"
              "- What channels are most effective for reaching these buyers?\n"
              "- Are there partnership or integration opportunities?\n"
              "- What pricing strategy would work (freemium, usage-based, seat-based, etc.)?\n"
              "- What should the launch sequence look like (beta → GA → expansion)?\n"
              "- What content and thought leadership topics would establish credibility?\n"
              "- How long until first revenue, and what's a realistic first-year target?\n\n"
              "Base your recommendations on the specific market context, not generic advice."
          ),
      },
      {
          "pillar": "risks_and_barriers",
          "prompt": (
              "Finally, identify the top risks and barriers to entry:\n"
              "- What switching costs exist for buyers using incumbent solutions?\n"
              "- Are there network effects or lock-in that favor incumbents?\n"
              "- What regulatory barriers could slow or block entry?\n"
              "- What timing risks exist (market maturity, economic conditions)?\n"
              "- What technical moats do incumbents have (data, integrations, patents)?\n"
              "- What would cause this market entry to fail?\n\n"
              "Rank risks by severity (high/medium/low) and likelihood."
          ),
      },
  ]


  def run_research_thread() -> dict:
      """Run all 5 research turns in a single Mave thread."""
      thread_id = None
      research = {}

      for turn in RESEARCH_PROMPTS:
          payload = {"message": turn["prompt"]}
          if thread_id:
              payload["thread_id"] = thread_id

          resp = requests.post(
              f"{BASE}/mave/chat",
              headers=HEADERS,
              json=payload,
              timeout=120,
          ).json()

          if "error" in resp:
              raise Exception(f"Mave error on {turn['pillar']}: {resp['error']['message']}")

          if not thread_id:
              thread_id = resp.get("thread_id")

          research[turn["pillar"]] = {
              "content": resp.get("content", ""),
              "sources": resp.get("sources", []),
          }

          print(f"✓ {turn['pillar']} — {len(resp.get('content', ''))} chars, "
                f"{len(resp.get('sources', []))} sources")

          time.sleep(2)

      return {"thread_id": thread_id, "pillars": research}
  ```

  ```javascript JavaScript theme={"dark"}
  const RESEARCH_PROMPTS = [
    {
      pillar: "competitive_landscape",
      prompt:
        `We're considering entering the ${TARGET_MARKET} space. ` +
        "Research the competitive landscape:\n" +
        "- Who are the top 5-10 players? (name, estimated market share, funding stage)\n" +
        "- What positioning does each competitor use?\n" +
        "- What are their pricing models?\n" +
        "- Any recent M&A, funding rounds, or pivots?\n" +
        "- Where are the gaps in the market that no one is addressing well?\n\n" +
        "Cite your sources.",
    },
    {
      pillar: "regulatory_environment",
      prompt:
        "Now research the regulatory environment for this market:\n" +
        "- What compliance frameworks apply (SOC 2, ISO 27001, GDPR, HIPAA, etc.)?\n" +
        "- Are there licensing or certification requirements?\n" +
        "- What pending legislation could impact this market in the next 12-24 months?\n" +
        "- Are there geographic variations (US vs EU vs APAC)?\n" +
        "- What are the compliance costs and timelines for a new entrant?\n\n" +
        "Cite your sources.",
    },
    {
      pillar: "buyer_personas",
      prompt:
        "Based on what you've found about the competitive and regulatory landscape, " +
        "research the typical buyers in this market:\n" +
        "- What are the primary buyer titles and roles?\n" +
        "- What budget range and authority do they have?\n" +
        "- What are their top 3-5 pain points?\n" +
        "- What decision criteria do they use when evaluating solutions?\n" +
        "- What does their buying process look like (stages, timeline, stakeholders)?\n" +
        "- Are there distinct buyer segments (enterprise vs mid-market vs SMB)?\n\n" +
        "Cite your sources.",
    },
    {
      pillar: "gtm_strategies",
      prompt:
        "Given the competitive landscape, regulatory environment, and buyer profiles " +
        "you've researched, recommend go-to-market strategies:\n" +
        "- What channels are most effective for reaching these buyers?\n" +
        "- Are there partnership or integration opportunities?\n" +
        "- What pricing strategy would work (freemium, usage-based, seat-based, etc.)?\n" +
        "- What should the launch sequence look like (beta → GA → expansion)?\n" +
        "- What content and thought leadership topics would establish credibility?\n" +
        "- How long until first revenue, and what's a realistic first-year target?\n\n" +
        "Base your recommendations on the specific market context, not generic advice.",
    },
    {
      pillar: "risks_and_barriers",
      prompt:
        "Finally, identify the top risks and barriers to entry:\n" +
        "- What switching costs exist for buyers using incumbent solutions?\n" +
        "- Are there network effects or lock-in that favor incumbents?\n" +
        "- What regulatory barriers could slow or block entry?\n" +
        "- What timing risks exist (market maturity, economic conditions)?\n" +
        "- What technical moats do incumbents have (data, integrations, patents)?\n" +
        "- What would cause this market entry to fail?\n\n" +
        "Rank risks by severity (high/medium/low) and likelihood.",
    },
  ];

  async function runResearchThread() {
    let threadId = null;
    const research = {};

    for (const turn of RESEARCH_PROMPTS) {
      const payload = { message: turn.prompt };
      if (threadId) payload.thread_id = threadId;

      const resp = await fetch(`${BASE}/mave/chat`, {
        method: "POST",
        headers: HEADERS,
        body: JSON.stringify(payload),
        signal: AbortSignal.timeout(120000),
      }).then((r) => r.json());

      if (resp.error) throw new Error(`Mave error on ${turn.pillar}: ${resp.error.message}`);

      if (!threadId) threadId = resp.thread_id;

      research[turn.pillar] = {
        content: resp.content || "",
        sources: resp.sources || [],
      };

      console.log(
        `✓ ${turn.pillar} — ${(resp.content || "").length} chars, ` +
          `${(resp.sources || []).length} sources`
      );

      await new Promise((r) => setTimeout(r, 2000));
    }

    return { thread_id: threadId, pillars: research };
  }
  ```
</CodeGroup>

<Tip>
  Each turn in the Mave thread builds on prior context. The competitive landscape informs buyer personas, which inform GTM strategy. This cascading context produces more coherent recommendations than isolated queries.
</Tip>

***

### Stage 2 — Structure into a Market Entry Brief

Transform the raw research into a standardized JSON schema using Chat with `response_format`.

<CodeGroup>
  ```python Python theme={"dark"}
  BRIEF_SCHEMA = {"type": "json_schema", "json_schema": {
      "name": "market_entry_brief", "strict": True,
      "schema": {
          "type": "object",
          "properties": {
              "market": {"type": "string", "description": "Target market name"},
              "executive_summary": {"type": "string", "description": "3-5 sentence executive summary"},
              "market_size_estimate": {"type": "string", "description": "TAM/SAM/SOM if available"},
              "top_competitors": {
                  "type": "array",
                  "items": {
                      "type": "object",
                      "properties": {
                          "name": {"type": "string"},
                          "positioning": {"type": "string"},
                          "estimated_share": {"type": "string"},
                          "weakness": {"type": "string"},
                      },
                      "required": ["name", "positioning", "estimated_share", "weakness"],
                  },
                  "description": "Top 5 competitors",
              },
              "regulatory_requirements": {
                  "type": "array",
                  "items": {"type": "string"},
                  "description": "Key compliance frameworks and requirements",
              },
              "primary_buyer": {
                  "type": "object",
                  "properties": {
                      "title": {"type": "string"},
                      "budget_range": {"type": "string"},
                      "top_pain_points": {"type": "array", "items": {"type": "string"}},
                      "decision_criteria": {"type": "array", "items": {"type": "string"}},
                  },
                  "required": ["title", "budget_range", "top_pain_points", "decision_criteria"],
              },
              "recommended_gtm": {
                  "type": "object",
                  "properties": {
                      "pricing_model": {"type": "string"},
                      "primary_channel": {"type": "string"},
                      "launch_sequence": {"type": "string"},
                      "time_to_revenue": {"type": "string"},
                  },
                  "required": ["pricing_model", "primary_channel", "launch_sequence", "time_to_revenue"],
              },
              "top_risks": {
                  "type": "array",
                  "items": {
                      "type": "object",
                      "properties": {
                          "risk": {"type": "string"},
                          "severity": {"type": "string"},
                          "mitigation": {"type": "string"},
                      },
                      "required": ["risk", "severity", "mitigation"],
                  },
              },
              "go_no_go_recommendation": {"type": "string", "description": "Go, No-Go, or Conditional Go with reasoning"},
          },
          "required": [
              "market", "executive_summary", "market_size_estimate",
              "top_competitors", "regulatory_requirements", "primary_buyer",
              "recommended_gtm", "top_risks", "go_no_go_recommendation",
          ],
      },
  }}


  def structure_brief(research: dict) -> dict:
      """Convert raw Mave research into a structured market entry brief."""
      combined = "\n\n".join(
          f"## {pillar.replace('_', ' ').title()}\n{data['content']}"
          for pillar, data in research["pillars"].items()
      )

      resp = mavera.responses.create(
          model="mavera-1",
          input=[{
              "role": "user",
              "content": (
                  f"Synthesize this market research into a structured market entry brief "
                  f"for the {TARGET_MARKET} market.\n\n"
                  f"Include a Go / No-Go / Conditional Go recommendation with reasoning.\n\n"
                  f"{combined}"
              ),
          }],
          extra_body={"response_format": BRIEF_SCHEMA},
      )

      return json.loads(resp.output[0].content[0].text)
  ```

  ```javascript JavaScript theme={"dark"}
  const BRIEF_SCHEMA = { type: "json_schema", json_schema: {
    name: "market_entry_brief", strict: true,
    schema: {
      type: "object",
      properties: {
        market: { type: "string", description: "Target market name" },
        executive_summary: { type: "string", description: "3-5 sentence executive summary" },
        market_size_estimate: { type: "string", description: "TAM/SAM/SOM if available" },
        top_competitors: {
          type: "array",
          items: {
            type: "object",
            properties: {
              name: { type: "string" },
              positioning: { type: "string" },
              estimated_share: { type: "string" },
              weakness: { type: "string" },
            },
            required: ["name", "positioning", "estimated_share", "weakness"],
          },
          description: "Top 5 competitors",
        },
        regulatory_requirements: {
          type: "array", items: { type: "string" },
          description: "Key compliance frameworks and requirements",
        },
        primary_buyer: {
          type: "object",
          properties: {
            title: { type: "string" },
            budget_range: { type: "string" },
            top_pain_points: { type: "array", items: { type: "string" } },
            decision_criteria: { type: "array", items: { type: "string" } },
          },
          required: ["title", "budget_range", "top_pain_points", "decision_criteria"],
        },
        recommended_gtm: {
          type: "object",
          properties: {
            pricing_model: { type: "string" },
            primary_channel: { type: "string" },
            launch_sequence: { type: "string" },
            time_to_revenue: { type: "string" },
          },
          required: ["pricing_model", "primary_channel", "launch_sequence", "time_to_revenue"],
        },
        top_risks: {
          type: "array",
          items: {
            type: "object",
            properties: {
              risk: { type: "string" },
              severity: { type: "string" },
              mitigation: { type: "string" },
            },
            required: ["risk", "severity", "mitigation"],
          },
        },
        go_no_go_recommendation: { type: "string", description: "Go, No-Go, or Conditional Go with reasoning" },
      },
      required: [
        "market", "executive_summary", "market_size_estimate",
        "top_competitors", "regulatory_requirements", "primary_buyer",
        "recommended_gtm", "top_risks", "go_no_go_recommendation",
      ],
    },
  }};

  async function structureBrief(research) {
    const combined = Object.entries(research.pillars)
      .map(([pillar, data]) =>
        `## ${pillar.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())}\n${data.content}`
      )
      .join("\n\n");

    const resp = await mavera.responses.create({
      model: "mavera-1",
      input: [{
        role: "user",
        content:
          `Synthesize this market research into a structured market entry brief ` +
          `for the ${TARGET_MARKET} market.\n\n` +
          `Include a Go / No-Go / Conditional Go recommendation with reasoning.\n\n` +
          combined,
      }],
      response_format: BRIEF_SCHEMA,
    });

    return JSON.parse(resp.output[0].content[0].text);
  }
  ```
</CodeGroup>

***

### Stage 3 — Drill-Down Follow-Up (Optional)

If any pillar needs deeper investigation, send follow-up questions in the same thread.

<CodeGroup>
  ```python Python theme={"dark"}
  def drill_down(thread_id: str, question: str) -> dict:
      """Ask a follow-up question within the existing research thread."""
      resp = requests.post(
          f"{BASE}/mave/chat",
          headers=HEADERS,
          json={
              "thread_id": thread_id,
              "message": question,
          },
          timeout=120,
      ).json()

      if "error" in resp:
          raise Exception(resp["error"]["message"])
      return resp


  DRILL_DOWN_QUESTIONS = [
      "What specific integrations do the top 3 competitors offer? Which ecosystem partnerships give them the strongest moat?",
      "For the mid-market segment specifically, what's the typical evaluation timeline and who else is involved in the buying committee?",
      "Are there any open-source or low-cost alternatives gaining traction that could disrupt the market from below?",
  ]
  ```

  ```javascript JavaScript theme={"dark"}
  async function drillDown(threadId, question) {
    const resp = await fetch(`${BASE}/mave/chat`, {
      method: "POST",
      headers: HEADERS,
      body: JSON.stringify({ thread_id: threadId, message: question }),
      signal: AbortSignal.timeout(120000),
    }).then((r) => r.json());

    if (resp.error) throw new Error(resp.error.message);
    return resp;
  }

  const DRILL_DOWN_QUESTIONS = [
    "What specific integrations do the top 3 competitors offer? Which ecosystem partnerships give them the strongest moat?",
    "For the mid-market segment specifically, what's the typical evaluation timeline and who else is involved in the buying committee?",
    "Are there any open-source or low-cost alternatives gaining traction that could disrupt the market from below?",
  ];
  ```
</CodeGroup>

***

### Running the Full Pipeline

<CodeGroup>
  ```python Python theme={"dark"}
  def run_pipeline():
      print(f"Researching: {TARGET_MARKET}")
      print("=" * 60)

      # Stage 1: Research
      print("\n--- Stage 1: Mave Research Thread ---")
      research = run_research_thread()
      print(f"\nThread ID: {research['thread_id']}")
      print(f"Pillars researched: {len(research['pillars'])}")

      total_sources = sum(
          len(p["sources"]) for p in research["pillars"].values()
      )
      print(f"Total sources cited: {total_sources}")

      # Stage 2: Structure
      print("\n--- Stage 2: Structuring Brief ---")
      brief = structure_brief(research)
      print(f"Market: {brief['market']}")
      print(f"Competitors identified: {len(brief['top_competitors'])}")
      print(f"Risks identified: {len(brief['top_risks'])}")
      print(f"Recommendation: {brief['go_no_go_recommendation'][:100]}...")

      # Stage 3: Drill-down (optional)
      print("\n--- Stage 3: Drill-Down Questions ---")
      drill_downs = {}
      for q in DRILL_DOWN_QUESTIONS:
          result = drill_down(research["thread_id"], q)
          drill_downs[q[:50]] = result.get("content", "")
          print(f"✓ {q[:60]}...")
          time.sleep(2)

      # Save outputs
      with open("market_entry_brief.json", "w") as f:
          json.dump(brief, f, indent=2)

      raw_report = f"# Market Entry Brief: {TARGET_MARKET}\n\n"
      raw_report += f"## Executive Summary\n{brief['executive_summary']}\n\n"
      raw_report += f"## Market Size\n{brief['market_size_estimate']}\n\n"
      raw_report += "## Competitive Landscape\n"
      for comp in brief["top_competitors"]:
          raw_report += f"- **{comp['name']}**: {comp['positioning']} (share: {comp['estimated_share']}, weakness: {comp['weakness']})\n"
      raw_report += f"\n## Recommendation\n{brief['go_no_go_recommendation']}\n"

      with open("market_entry_report.md", "w") as f:
          f.write(raw_report)

      print("\n✓ Saved market_entry_brief.json")
      print("✓ Saved market_entry_report.md")
      return brief


  if __name__ == "__main__":
      run_pipeline()
  ```

  ```javascript JavaScript theme={"dark"}
  import fs from "fs";

  async function runPipeline() {
    console.log(`Researching: ${TARGET_MARKET}`);

    // Stage 1: Research
    console.log("\n--- Stage 1: Mave Research Thread ---");
    const research = await runResearchThread();
    console.log(`Thread ID: ${research.thread_id}`);

    const totalSources = Object.values(research.pillars).reduce(
      (sum, p) => sum + p.sources.length, 0
    );
    console.log(`Total sources cited: ${totalSources}`);

    // Stage 2: Structure
    console.log("\n--- Stage 2: Structuring Brief ---");
    const brief = await structureBrief(research);
    console.log(`Competitors identified: ${brief.top_competitors.length}`);
    console.log(`Risks identified: ${brief.top_risks.length}`);
    console.log(`Recommendation: ${brief.go_no_go_recommendation.slice(0, 100)}...`);

    // Stage 3: Drill-down (optional)
    console.log("\n--- Stage 3: Drill-Down Questions ---");
    for (const q of DRILL_DOWN_QUESTIONS) {
      await drillDown(research.thread_id, q);
      console.log(`✓ ${q.slice(0, 60)}...`);
      await new Promise((r) => setTimeout(r, 2000));
    }

    // Save outputs
    fs.writeFileSync("market_entry_brief.json", JSON.stringify(brief, null, 2));

    let report = `# Market Entry Brief: ${TARGET_MARKET}\n\n`;
    report += `## Executive Summary\n${brief.executive_summary}\n\n`;
    report += `## Market Size\n${brief.market_size_estimate}\n\n`;
    report += "## Competitive Landscape\n";
    for (const comp of brief.top_competitors) {
      report += `- **${comp.name}**: ${comp.positioning} (share: ${comp.estimated_share})\n`;
    }
    report += `\n## Recommendation\n${brief.go_no_go_recommendation}\n`;

    fs.writeFileSync("market_entry_report.md", report);
    console.log("\n✓ Saved market_entry_brief.json and market_entry_report.md");
    return brief;
  }

  runPipeline();
  ```
</CodeGroup>

***

## Example Output

The structured brief produces machine-readable JSON:

```json theme={"dark"}
{
  "market": "B2B cybersecurity compliance for mid-market SaaS",
  "executive_summary": "The B2B cybersecurity compliance market for mid-market SaaS is a $4.2B segment growing at 18% CAGR. Dominated by Vanta, Drata, and Secureframe, the market has significant gaps in automated remediation and developer-native workflows. Regulatory tailwinds (SEC cyber disclosure rules, EU NIS2) are expanding the addressable market. A developer-first positioning with usage-based pricing could capture 2-3% share within 18 months.",
  "market_size_estimate": "TAM: $12B (full GRC market), SAM: $4.2B (mid-market SaaS compliance), SOM: $120M (developer-native segment)",
  "top_competitors": [
    {
      "name": "Vanta",
      "positioning": "Continuous compliance automation",
      "estimated_share": "28%",
      "weakness": "Complex onboarding, enterprise-focused pricing"
    },
    {
      "name": "Drata",
      "positioning": "Trust management platform",
      "estimated_share": "22%",
      "weakness": "Limited customization for non-standard frameworks"
    }
  ],
  "regulatory_requirements": [
    "SOC 2 Type II (baseline for SaaS)",
    "ISO 27001 (required for enterprise and EU customers)",
    "GDPR (EU data processing)",
    "SEC Cyber Disclosure (public companies, 2024+)"
  ],
  "primary_buyer": {
    "title": "VP Engineering or Head of Security",
    "budget_range": "$30K-$150K annually",
    "top_pain_points": [
      "Audit prep takes 200+ engineering hours per year",
      "Compliance tools don't integrate with CI/CD",
      "Evidence collection is manual and error-prone"
    ],
    "decision_criteria": [
      "Integration depth with existing stack",
      "Time to first audit",
      "Ongoing maintenance burden"
    ]
  },
  "recommended_gtm": {
    "pricing_model": "Usage-based (per integration + per framework)",
    "primary_channel": "Developer communities, DevSecOps conferences, content marketing",
    "launch_sequence": "Private beta (10 design partners) → Public beta → GA with SOC 2 only → Framework expansion",
    "time_to_revenue": "4-6 months to first paying customer, 12-18 months to $1M ARR"
  },
  "top_risks": [
    {
      "risk": "Incumbents have 18-24 month head start on integrations",
      "severity": "High",
      "mitigation": "Focus on 5 high-value integrations rather than breadth"
    },
    {
      "risk": "Enterprise consolidation could squeeze mid-market tools",
      "severity": "Medium",
      "mitigation": "Build strong mid-market brand before enterprise players move down"
    }
  ],
  "go_no_go_recommendation": "Conditional Go. The market has strong tailwinds and clear gaps in developer experience. However, success requires shipping a differentiated product within 6 months — the window is narrowing as incumbents expand."
}
```

***

## Variations

<AccordionGroup>
  <Accordion title="Multi-market comparison">
    Run the pipeline for 3-5 markets in parallel, then compare structured briefs side-by-side:

    ```python theme={"dark"}
    markets = [
        "B2B cybersecurity compliance for mid-market SaaS",
        "AI-powered contract review for legal teams",
        "Developer experience platforms for platform engineering",
    ]

    briefs = {}
    for market in markets:
        TARGET_MARKET = market
        briefs[market] = run_pipeline()

    # Compare by go_no_go, time_to_revenue, risk count
    for market, brief in briefs.items():
        print(f"{market}: {brief['go_no_go_recommendation'][:50]}")
    ```
  </Accordion>

  <Accordion title="Geographic expansion research">
    Modify the prompts to focus on a specific geography:

    ```python theme={"dark"}
    RESEARCH_PROMPTS[0]["prompt"] = (
        f"We're considering expanding {TARGET_MARKET} into the Japanese market. "
        "Research the competitive landscape specific to Japan..."
    )
    ```

    Add a regulatory turn specific to local requirements (e.g., APPI for Japan, PIPL for China).
  </Accordion>

  <Accordion title="Combine with Focus Group validation">
    After generating buyer personas from Mave research, create those personas in Mavera and run a Focus Group to validate your positioning:

    ```python theme={"dark"}
    # After run_pipeline() produces buyer persona profiles
    fg_payload = {
        "name": f"Market Entry Validation: {TARGET_MARKET}",
        "sample_size": 25,
        "persona_ids": [vp_eng_id, head_security_id, cto_id],
        "questions": [
            {"question": "Would you evaluate a new compliance tool in the next 12 months?", "type": "NPS", "order": 1},
            {"question": "What would make you switch from your current compliance solution?", "type": "OPEN_ENDED", "order": 2},
        ],
    }
    ```

    See the [Positioning Workshop](/playbooks/positioning-workshop) playbook for the full Focus Group flow.
  </Accordion>

  <Accordion title="Scheduled re-research">
    Markets change. Run the same pipeline quarterly and diff the structured briefs to catch shifts:

    ```python theme={"dark"}
    import deepdiff

    q1_brief = json.load(open("briefs/q1_brief.json"))
    q2_brief = json.load(open("briefs/q2_brief.json"))

    changes = deepdiff.DeepDiff(q1_brief, q2_brief, verbose_level=2)
    print("New competitors:", changes.get("iterable_item_added", {}))
    print("Changed risks:", changes.get("values_changed", {}))
    ```
  </Accordion>

  <Accordion title="Export to slide deck format">
    Structure the brief for a 10-slide board deck:

    ```python theme={"dark"}
    SLIDE_SCHEMA = {"type": "json_schema", "json_schema": {
        "name": "slides", "strict": True,
        "schema": {
            "type": "object",
            "properties": {
                "slides": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "title": {"type": "string"},
                            "bullets": {"type": "array", "items": {"type": "string"}},
                            "speaker_notes": {"type": "string"},
                        },
                        "required": ["title", "bullets", "speaker_notes"],
                    },
                },
            },
            "required": ["slides"],
        },
    }}
    ```
  </Accordion>
</AccordionGroup>

***

## Credits Estimate

| Stage                                 | Typical Cost         | Notes                                 |
| ------------------------------------- | -------------------- | ------------------------------------- |
| Mave research (5 turns)               | 50–150 credits       | Depends on research depth and sources |
| Structure brief (1 chat call)         | 5–15 credits         | Single structured output              |
| Drill-down questions (3 turns)        | 30–90 credits        | Optional depth                        |
| **Total (full pipeline)**             | **\~85–255 credits** |                                       |
| **Total (research + structure only)** | **\~55–165 credits** | Skip drill-downs for a quick pass     |

<Tip>
  Start with 1 market to calibrate credit cost. Multi-market runs multiply linearly — 3 markets ≈ 3× credits. Use drill-downs selectively on the highest-uncertainty pillars.
</Tip>

***

## See Also

<CardGroup cols={2}>
  <Card title="Mave Agent" icon="brain" href="/features/mave-agent">
    Threads, sources, and research capabilities
  </Card>

  <Card title="Positioning Workshop" icon="bullseye" href="/playbooks/positioning-workshop">
    Validate positioning with personas after market research
  </Card>

  <Card title="News-Triggered Research" icon="bolt" href="/playbooks/news-triggered-research">
    Automate re-research when market conditions change
  </Card>

  <Card title="Responses API" icon="comments" href="/features/responses">
    response\_format and structured output
  </Card>

  <Card title="Credits & Budget" icon="coins" href="/cookbooks/credits-budget-alerts">
    Track and manage credit usage
  </Card>

  <Card title="Annual Planning Kickoff" icon="calendar" href="/playbooks/annual-planning-kickoff">
    Chain market research into full annual planning
  </Card>
</CardGroup>
