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

# Build from Scratch

> Start with a blank canvas to design custom, multi-branch conversational workflows and strict compliance rules

Building from scratch provides complete control over every parameter of your voice agent. This approach is designed for teams with existing prompt engineering specifications, intricate conditional logic, strict regulatory compliance requirements, or bespoke multi-step API integrations.

<Frame>
  <img src="https://mintcdn.com/vaaniai/1z97x591P_yo5Lyb/images/screenshots/from-scratch.png?fit=max&auto=format&n=1z97x591P_yo5Lyb&q=85&s=3bf870e53f607bfa3ecb0e8445114b46" alt="Vaani Create Agent Menu showing Build from Scratch" width="1919" height="893" data-path="images/screenshots/from-scratch.png" />
</Frame>

## When to Build from Scratch

* **Multi-Branch Dialog Flows**: Workflows requiring strict step-by-step state machines (e.g., identity verification before payment processing).
* **Compliance & Legal Disclaimers**: Exact mandatory phrases that must be spoken verbatim before continuing the call.
* **Complex API Orchestration**: Calls where the agent triggers multiple custom tools or database operations mid-conversation.
* **Custom Dynamic Variables**: Advanced prompts requiring several dynamic caller attributes injected at runtime.

***

## Step-by-Step Walkthrough

<Steps>
  <Step title="Initialize a Blank Canvas">
    Click **+ New Agent** in the Vaani dashboard and select **Build from Scratch**.
  </Step>

  <Step title="Name Your Agent">
    Assign an internal slug or identifier (e.g. `loan-kyc-agent-v2`). This name is only visible to your internal team.
  </Step>

  <Step title="Structure Your System Prompt">
    In the prompt editor, compose your agent's instructions using structured markdown sections:

    ```markdown theme={null}
    ### 1. IDENTITY & GOAL
    You are Maya, an account specialist at FinCorp. Your objective is to verify customer details and schedule loan verification visits.

    ### 2. CONVERSATIONAL RULES
    - Always verify the caller's identity by asking for the last 4 digits of their SSN/Aadhaar.
    - If the user interrupts, stop speaking immediately and address their statement.
    - Never guess interest rates; always refer to the rate chart in the knowledge base.

    ### 3. CONVERSATION PHASES
    - Phase 1: Greeting & Identity Verification
    - Phase 2: Loan Purpose & Desired Amount
    - Phase 3: Appointment Booking via Tool
    - Phase 4: Confirmation & Warm Farewell
    ```
  </Step>

  <Step title="Define Metadata Variables">
    Specify dynamic runtime placeholders in curly braces `{}`:

    ```json theme={null}
    {
      "customer_name": "string (required)",
      "application_id": "string (required)",
      "outstanding_balance": "number (optional)"
    }
    ```

    These variables are populated automatically when you initiate a call via the API or campaign dialer.
  </Step>

  <Step title="Configure the Language Pipeline">
    Manually select providers for each stage of the voice loop:

    * **Ears (STT)**: Deepgram Nova-2 with customized vocabulary boosting.
    * **Brain (LLM)**: Model choice (e.g., Claude 3.5 Sonnet or GPT-4o) and temperature settings (`0.2` for strict compliance, `0.7` for open conversation).
    * **Mouth (TTS)**: Voice engine, accent, speaking speed, and pitch.
  </Step>

  <Step title="Configure Opening Greeting">
    Draft the greeting message and choose whether the agent speaks first or listens for the caller's initial greeting.
  </Step>

  <Step title="Save and Retrieve Agent ID">
    Click **Save Agent**. Your agent is stored, and a UUID `agent_id` is created for production use.
  </Step>
</Steps>

***

## Best Practices for Scratch Building

<CardGroup cols={2}>
  <Card title="Keep Turns Concise" icon="comment-dots">
    Phone conversations feel natural when sentences are short (1-2 sentences per turn). Avoid long monologue blocks.
  </Card>

  <Card title="Define Fallback Behavior" icon="shield-halved">
    Explicitly instruct the agent on what to do when background noise is high or the caller's answer is ambiguous.
  </Card>

  <Card title="Use Number Formats" icon="hashtag">
    Instruct the model to pronounce numbers phonetically when reading back OTPs, card numbers, or dates.
  </Card>

  <Card title="Test Corner Cases" icon="flask">
    Use the in-browser simulator to test interruptions, non-sequiturs, and rapid topic switching.
  </Card>
</CardGroup>

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Agent Overview" icon="sliders" href="/getting-started/agent-config/overview">
    Review your newly configured agent's dashboard
  </Card>

  <Card title="Add Tools & Knowledge Base" icon="brain" href="/getting-started/agent-config/training">
    Equip your agent with custom API tools and training documents
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.