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

# Tutorial: Edit agent behavior

> PolyAcademy Level 1 – Configure personality, role, and behavioral rules for your agent.

export const LessonMeta = ({level, difficulty, time}) => {
  const levelConfig = {
    1: {
      badge: 'bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200',
      label: 'Level 1'
    },
    2: {
      badge: 'bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-200',
      label: 'Level 2'
    },
    3: {
      badge: 'bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200',
      label: 'Level 3'
    }
  };
  const difficultyConfig = {
    Beginner: 'bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200',
    Intermediate: 'bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-200',
    Advanced: 'bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200'
  };
  const lvl = levelConfig[level] || levelConfig[1];
  const diffColor = difficultyConfig[difficulty] || difficultyConfig['Beginner'];
  return <div className="flex flex-wrap items-center gap-2 my-4 not-prose">
      <span className={`inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold ${lvl.badge}`}>
        {lvl.label}
      </span>
      <span className={`inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold ${diffColor}`}>
        {difficulty}
      </span>
      {time && <span className="inline-flex items-center gap-1 text-xs text-gray-500 dark:text-gray-400">
          <svg className="w-3.5 h-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
            <path strokeLinecap="round" strokeLinejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z" />
          </svg>
          {time}
        </span>}
    </div>;
};

export const FillBlank = ({prompt, answer, hint, explanation}) => {
  const [value, setValue] = useState('');
  const [submitted, setSubmitted] = useState(false);
  const normalize = s => s.trim().toLowerCase().replace(/[^a-z0-9_]/g, '');
  const answers = Array.isArray(answer) ? answer : [answer];
  const isCorrect = answers.some(a => normalize(value) === normalize(a));
  const handleSubmit = e => {
    e.preventDefault();
    if (value.trim()) setSubmitted(true);
  };
  const handleReset = () => {
    setValue('');
    setSubmitted(false);
  };
  return <div className="my-6">
      <p className="mt-0 mb-3 text-sm font-semibold leading-relaxed text-gray-900 dark:text-gray-100">
        {prompt}
      </p>
      <form onSubmit={handleSubmit} className="flex flex-col gap-2.5">
        <div className="flex gap-2">
          <input type="text" value={value} onChange={e => {
    setValue(e.target.value);
    setSubmitted(false);
  }} placeholder={hint || "Type your answer…"} className="flex-1 rounded-xl border py-2.5 px-4 text-sm font-mono border-gray-200 bg-white text-gray-900 placeholder-gray-400 outline-none focus:border-gray-400 focus:ring-2 focus:ring-gray-200 transition-all duration-150 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100 dark:placeholder-gray-600 dark:focus:border-gray-500 dark:focus:ring-gray-700" />
          <button type="submit" className="rounded-xl border py-2.5 px-5 text-sm font-medium transition-all duration-150 border-gray-800 bg-gray-800 text-white hover:bg-gray-700 hover:border-gray-700 dark:border-gray-200 dark:bg-gray-200 dark:text-gray-900 dark:hover:bg-white">
            Check
          </button>
        </div>
        {submitted ? <div className={`py-3 pl-4 pr-3.5 rounded-r-xl text-sm leading-relaxed border-l-4 ${isCorrect ? 'border-green-500 bg-green-50 dark:bg-green-900 dark:border-green-500' : 'border-red-500 bg-red-50 dark:bg-red-900 dark:border-red-500'}`}>
            {isCorrect ? <>
                <span className={`font-semibold !text-green-800 dark:!text-green-200`}>Correct.</span>{' '}
                <span className="!text-gray-700 dark:!text-gray-300">{explanation}</span>
              </> : <>
                <span className="font-semibold !text-red-800 dark:!text-red-200">Not quite.</span>{' '}
                <span className="!text-gray-700 dark:!text-gray-300">The answer is <code className="!text-gray-800 dark:!text-gray-200">{answers[0]}</code>. {explanation}</span>
              </>}
          </div> : null}
      </form>
      {submitted ? <button type="button" onClick={handleReset} className="mt-2 text-xs text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 underline underline-offset-2 cursor-pointer transition-colors duration-150">
          Try again
        </button> : null}
    </div>;
};

export const Quiz = ({questions = []}) => {
  const [selected, setSelected] = useState({});
  const [resetCount, setResetCount] = useState(0);
  const letters = ['A', 'B', 'C', 'D'];
  const handleSelect = (qIdx, optIdx) => {
    if (selected[qIdx] !== undefined) return;
    setSelected(prev => ({
      ...prev,
      [qIdx]: optIdx
    }));
  };
  const handleReset = () => {
    setSelected({});
    setResetCount(c => c + 1);
  };
  if (!questions?.length) return null;
  const getOptionClasses = ({hasAnswered, isThisCorrect, isThisSelected}) => {
    if (!hasAnswered) {
      return {
        btn: 'flex w-full items-center gap-3 py-2.5 px-4 rounded-xl text-sm leading-normal transition-all duration-150 text-left border cursor-pointer border-gray-200 bg-white text-gray-700 hover:border-gray-300 hover:bg-gray-50 hover:shadow-sm dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:border-gray-500 dark:hover:bg-gray-700',
        badge: 'w-6 h-6 rounded-full text-xs font-bold flex items-center justify-center shrink-0 leading-none transition-all duration-150 bg-gray-100 text-gray-500 dark:bg-gray-700 dark:text-gray-300',
        icon: null
      };
    }
    if (isThisCorrect) {
      return {
        btn: 'flex w-full items-center gap-3 py-2.5 px-4 rounded-xl text-sm leading-normal transition-all duration-150 text-left border cursor-default border-green-400 bg-green-50 text-green-900 font-medium dark:border-green-500 dark:bg-green-950 dark:text-green-100',
        badge: 'w-6 h-6 rounded-full text-xs font-bold flex items-center justify-center shrink-0 leading-none transition-all duration-150 bg-green-500 text-white dark:bg-green-500',
        icon: <svg className="shrink-0 w-4 h-4 text-green-500 dark:text-green-400 ml-auto" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2.5}>
            <path strokeLinecap="round" strokeLinejoin="round" d="M4.5 12.75l6 6 9-13.5" />
          </svg>
      };
    }
    if (isThisSelected) {
      return {
        btn: 'flex w-full items-center gap-3 py-2.5 px-4 rounded-xl text-sm leading-normal transition-all duration-150 text-left border cursor-default border-red-400 bg-red-50 text-red-900 dark:border-red-500 dark:bg-red-950 dark:text-red-100',
        badge: 'w-6 h-6 rounded-full text-xs font-bold flex items-center justify-center shrink-0 leading-none transition-all duration-150 bg-red-500 text-white dark:bg-red-500',
        icon: <svg className="shrink-0 w-4 h-4 text-red-400 dark:text-red-400 ml-auto" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2.5}>
            <path strokeLinecap="round" strokeLinejoin="round" d="M6 18L18 6M6 6l12 12" />
          </svg>
      };
    }
    return {
      btn: 'flex w-full items-center gap-3 py-2.5 px-4 rounded-xl text-sm leading-normal transition-all duration-150 text-left border cursor-default border-gray-100 bg-white text-gray-400 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-500',
      badge: 'w-6 h-6 rounded-full text-xs font-bold flex items-center justify-center shrink-0 leading-none transition-all duration-150 bg-gray-100 text-gray-500 dark:bg-gray-700 dark:text-gray-500',
      icon: null
    };
  };
  return <div key={resetCount} className="my-6">
      {questions.map((q, qIdx) => {
    const answer = selected[qIdx];
    const hasAnswered = answer !== undefined;
    const isCorrect = answer === q.correct;
    return <div key={String(qIdx)} className="mb-8">
            <p className="flex items-start gap-2.5 font-semibold text-sm mb-3 mt-0 leading-relaxed text-gray-900 dark:text-gray-100">
              <span className="inline-flex items-center justify-center w-5 h-5 rounded-full bg-gray-800 dark:bg-gray-200 text-white dark:text-gray-900 text-xs font-bold shrink-0 mt-px leading-none">
                {qIdx + 1}
              </span>
              {q.q}
            </p>

            <div className="flex flex-col gap-2">
              {q.options.map((opt, i) => {
      const isThisCorrect = i === q.correct;
      const isThisSelected = i === answer;
      const {btn, badge, icon} = getOptionClasses({
        hasAnswered,
        isThisCorrect,
        isThisSelected
      });
      return <button key={String(i)} type="button" onClick={() => handleSelect(qIdx, i)} className={btn}>
                    <span className={badge}>{letters[i]}</span>
                    <span className="flex-1">{opt}</span>
                    {icon}
                  </button>;
    })}
            </div>

            {hasAnswered ? <div className={`mt-3 py-3 pl-4 pr-3.5 rounded-r-xl text-sm leading-relaxed border-l-4 ${isCorrect ? 'border-green-500 bg-green-50 dark:bg-green-950 dark:border-green-500' : 'border-red-500 bg-red-50 dark:bg-red-950 dark:border-red-500'}`}>
                <span className={`font-semibold ${isCorrect ? '!text-green-800 dark:!text-green-200' : '!text-red-800 dark:!text-red-200'}`}>
                  {isCorrect ? 'Correct.' : 'Not quite.'}
                </span>{' '}
                <span className="!text-gray-700 dark:!text-gray-300">{q.explanation}</span>
              </div> : null}
          </div>;
  })}

      <button type="button" onClick={handleReset} className="mt-1 text-xs text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 underline underline-offset-2 cursor-pointer transition-colors duration-150">
        Reset quiz
      </button>
    </div>;
};

export const ProgressTracker = ({lessonNum, totalLessons, level}) => {
  const [checked, setChecked] = useState(false);
  return <div onClick={() => setChecked(prev => !prev)} className={checked ? 'flex items-center gap-3 p-4 rounded-lg border-2 border-green-600 bg-green-50 dark:bg-green-950 cursor-pointer select-none transition-all' : 'flex items-center gap-3 p-4 rounded-lg border-2 border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 cursor-pointer select-none transition-all'}>
      <div className={checked ? 'w-5 h-5 rounded border-2 border-green-600 bg-green-600 flex items-center justify-center shrink-0 transition-all' : 'w-5 h-5 rounded border-2 border-gray-400 dark:border-gray-500 bg-white dark:bg-gray-800 flex items-center justify-center shrink-0 transition-all'}>
        {checked ? <svg width="10" height="8" viewBox="0 0 10 8" fill="none">
            <path d="M1 4L3.5 6.5L9 1" stroke="white" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
          </svg> : null}
      </div>
      <div>
        <div className={checked ? 'font-semibold text-sm text-green-700 dark:text-green-300' : 'font-semibold text-sm text-gray-700 dark:text-gray-200'}>
          {checked ? 'Lesson complete' : 'Mark lesson complete'}
        </div>
        {lessonNum && totalLessons ? <div className="text-xs text-gray-500 dark:text-gray-400 mt-0.5">
            {level ? level + ' - ' : ''}Lesson {lessonNum} of {totalLessons}
          </div> : null}
      </div>
    </div>;
};

**Lesson 2 of 6** – This is where your agent gets its personality. You'll decide who it is, how it talks, and what it should never do.

<LessonMeta level={1} difficulty="Beginner" time="10 min" />

Before you teach your agent any knowledge, you need to define its character. Think of this as writing a job description – role, tone, and boundaries.

## What agent behavior controls

The **Behavior** screen has three sections that together make up the agent's behavior:

<CardGroup cols={3}>
  <Card title="Personality" icon="face-smile">
    Tone, style, and how the agent communicates
  </Card>

  <Card title="Role" icon="user-tie">
    What the agent represents and what it can help with
  </Card>

  <Card title="Behavior" icon="shield-halved">
    Hard constraints, rules, and boundaries that apply to every conversation
  </Card>
</CardGroup>

## How the fields fit together

```mermaid theme={"theme":{"light":"github-light","dark":"github-dark"}}
flowchart LR
    A[Behavior] --> B["Personality"]
    A --> C["Role"]
    A --> E["Behavior"]
    B --> F[Tone & communication style]
    C --> G[What the agent can help with]
    E --> H[Rules and boundaries the agent must follow]
```

## Where to configure behavior

Navigate to **Behavior** in the left sidebar.

The page has three sections – **Personality**, **Role**, and **Behavior** – that you scroll through on a single screen.

<Tabs>
  <Tab title="Personality and Role">
    The [Agent](/behavior/general/agent) page contains the **Personality** and **Role** fields:

    * **Personality** – Sets the tone and communication style. Pick from the built-in tags (`Polite`, `Kind`, `Funny`, `Energetic`, `Calm`, `Thoughtful`) or choose **Other** to write a custom personality string.
    * **Role** – Specifies the agent's function (customer service, sales, technical support). This is a single field – define one primary role.

    **Custom personality example (with "Other" selected):**

    ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
    Be friendly, professional, and concise.
    Use natural language and avoid jargon.
    ```

    <Note>
      The **Greeting** is configured per-channel – under **Voice > [Voice configuration](/voice-channel/advanced/call-settings)** for voice and **Messaging > Advanced > Chat configuration** for webchat – not on the Agent page. The greeting goes directly to TTS without LLM processing. Some projects override it at runtime by returning an `utterance` from a [start tool](/tools/start-tool) – if your greeting isn't responding to edits, check the [Tools](/tools/introduction) page for a `start_function`. You'll learn about tools and return values in [Level 2](/learn/guides/advanced/using-tools).
    </Note>
  </Tab>

  <Tab title="Behavior">
    The [Behavior](/behavior/general/rules) section defines the rules and hard constraints that must always be followed. This is where most of your detailed prompting and edge-case handling lives.

    **Example:**

    ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
    - Never share guest personal information
    - Always offer to transfer for billing questions
    - Do not make promises about refunds
    ```
  </Tab>
</Tabs>

## Writing effective behavior configuration

### Role

<AccordionGroup>
  <Accordion title="Be specific about scope" icon="bullseye">
    **Good:**

    ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
    You are a customer service agent for Acme Retail.
    You help with order status, returns, and product questions.
    ```

    **Avoid:**

    ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
    You are a helpful agent.
    ```
  </Accordion>

  <Accordion title="State what's out of scope" icon="ban">
    Be explicit about requests the agent should hand off rather than attempt. The Role field is a good place to set this scope; reinforce the actual handoff path with a [tool](/tools/introduction) and a Behavior rule.

    **Good:**

    ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
    You cannot process refunds or cancel orders.
    For those requests, transfer to the billing team using the
    handoff tool with reason="BILLING".
    ```

    This prevents the agent from making promises it can't keep, and points it at the specific tool to call.
  </Accordion>
</AccordionGroup>

### Personality

<AccordionGroup>
  <Accordion title="Use clear, actionable language" icon="comments">
    **Good:**

    ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
    Be warm and conversational.
    Keep responses under 3 sentences when possible.
    Use "we" when referring to the company.
    ```

    **Avoid:**

    ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
    Be nice and helpful.
    ```
  </Accordion>

  <Accordion title="Match your brand voice" icon="palette">
    If your brand is formal, say so:

    ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
    Maintain a professional, respectful tone.
    Avoid casual language or slang.
    ```

    If your brand is casual:

    ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
    Be friendly and approachable.
    It's okay to use casual language.
    ```
  </Accordion>
</AccordionGroup>

If tone is critical, reinforce it in **Behavior** as well as **Personality**. Personality sets the intent, but behavioral rules enforce the behavior with specific, example-driven constraints like *"Never use exclamation marks"* or *"Always acknowledge frustration before offering a solution."*

<Tip>
  In practice, most detailed prompting – your terminology, edge cases, examples, and compliance rules – goes in the **Behavior** section. Personality and Role stay short.
</Tip>

## Check your understanding

<Quiz
  questions={[
{
q: "What is the Personality field used for?",
options: [
  "Setting hard rules the agent must always follow, like 'Never discuss pricing'",
  "Describing the agent's tone and communication style – how it presents itself to users",
  "Listing the topics and questions the agent is allowed to respond to",
  "Configuring the voice model and speech settings used on calls",
],
correct: 1,
explanation: "Personality defines tone and style – 'warm and professional', 'friendly and concise', and so on. Hard constraints like 'Never discuss pricing' belong in Behavior. Topics and knowledge go in the Knowledge section.",
}
]}
/>

### Behavior

<AccordionGroup>
  <Accordion title="Write rules as constraints" icon="gavel">
    Rules should be clear boundaries, not suggestions.

    **Good:**

    ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
    - Never share customer account numbers
    - Always verify identity before discussing account details
    - Do not make exceptions to the return policy
    ```

    **Avoid:**

    ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
    - Try to be helpful
    - Consider the customer's needs
    ```
  </Accordion>

  <Accordion title="Include safety and compliance rules" icon="shield-check">
    **Examples:**

    ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
    - Do not provide medical advice
    - Never promise specific outcomes
    - Always disclose you are an AI agent if asked
    ```
  </Accordion>

  <Accordion title="Use channel-specific and language-specific rules" icon="code">
    You can scope rules to specific channels or languages using tag syntax. This is useful for multi-channel or multilingual projects.

    Each tag **requires a matching closing tag** (`</channel>` or `</language>`):

    ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
    <channel:voice>Always confirm the caller's name before proceeding.</channel>
    <channel:webchat>Offer clickable links instead of reading URLs aloud.</channel>
    <language:en>Use American English spelling conventions.</language>
    <language:es>Respond in formal Spanish (usted).</language>
    ```

    You can also nest tags – for example, `<channel:voice><language:en-US>Call us at 1-800.</language></channel>` shows that line only on voice calls in `en-US`.

    Behavioral rules without a tag apply to all channels and languages.
  </Accordion>
</AccordionGroup>

## Common patterns

<Tabs>
  <Tab title="Retail/E-commerce">
    **Agent:**

    ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
    You are a customer service agent for Bloom & Co.
    You help customers with order tracking, product questions, and returns.
    You cannot process refunds or cancel orders directly.
    ```

    **Personality:**

    ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
    Be friendly, helpful, and efficient.
    Keep responses concise.
    Use "we" when referring to the company.
    ```

    **Rules:**

    ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
    - Never share order details without verification
    - Always offer to transfer for refund requests
    - Do not make promises about shipping dates
    ```
  </Tab>

  <Tab title="Hospitality">
    **Agent:**

    ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
    You are the virtual concierge for The Linden Hotel.
    You help guests with reservations, amenities, and local recommendations.
    You cannot modify existing reservations or process payments.
    ```

    **Personality:**

    ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
    Be warm, welcoming, and attentive.
    Speak naturally and conversationally.
    Anticipate guest needs when appropriate.
    ```

    **Rules:**

    ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
    - Never share guest information
    - Always transfer billing questions to the front desk
    - Do not guarantee room availability without checking
    ```
  </Tab>

  <Tab title="Healthcare">
    **Agent:**

    ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
    You are a scheduling agent for Clearview Family Medicine.
    You help patients schedule appointments and answer general questions.
    You cannot provide medical advice or discuss test results.
    ```

    **Personality:**

    ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
    Be professional, empathetic, and clear.
    Use simple language and avoid medical jargon.
    Be patient with questions.
    ```

    **Rules:**

    ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
    - Never provide medical advice or diagnoses
    - Always protect patient privacy
    - Transfer immediately if asked about test results
    - Do not discuss medications or dosages
    ```
  </Tab>
</Tabs>

## Testing your configuration

After saving your behavior settings:

<Steps>
  <Step title="Test in Chat">
    Open the chat panel and ask questions that should trigger your rules.

    **Example tests:**

    * Ask for something the agent shouldn't do
    * Request information that requires a transfer
    * Test the tone and personality
  </Step>

  <Step title="Verify rule enforcement">
    Confirm the agent:

    * Refuses inappropriate requests
    * Offers transfers when configured
    * Maintains the specified tone
  </Step>

  <Step title="Test edge cases">
    Try to trick the agent:

    * "Just this once, can you..."
    * "I know you're not supposed to, but..."
    * "My friend said you could..."

    The agent should hold firm to its rules. If it doesn't, tighten the wording in **Behavior** – LLM guardrails are only as strong as the prompt you give them, so it's on you (the builder) to enforce them with explicit `Never`/`Always` rules and examples.
  </Step>
</Steps>

<Warning>
  **Common mistakes:**

  * <Icon icon="xmark" iconType="solid" color="#dc2626" /> "Try to avoid sharing personal information" → <Icon icon="check" iconType="solid" color="#16a34a" /> "Never share personal information"
  * <Icon icon="xmark" iconType="solid" color="#dc2626" /> "You help with various things" → <Icon icon="check" iconType="solid" color="#16a34a" /> "You help with order tracking, returns, and product questions"
  * Always specify what the agent **cannot** do, not just what it can do
</Warning>

## Prompting principles

Effective agent configuration is a form of prompt engineering. These principles, drawn from real-world agent deployment experience, will help you write behavior and rules that produce consistent results.

<AccordionGroup>
  <Accordion title="Make the desired outcome the most likely response" icon="bullseye">
    LLMs predict the next most likely token based on your prompt. Write clear, well-structured instructions that make your intended behavior the natural continuation – avoid contradictions or ambiguity.
  </Accordion>

  <Accordion title="Prefer positive instructions over negative ones" icon="check">
    Telling the model what *not* to do can activate the exact behavior you want to avoid. Instead of prohibiting outcomes, direct the model toward what you *want*.

    **Avoid:**

    ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
    Don't tell the user to contact customer service.
    ```

    **Better:**

    ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
    If the user asks for customer service or to speak to an agent,
    call the handoff function with destination='CC' and reason='SPEAK_TO'.
    ```
  </Accordion>

  <Accordion title="Use examples to guide behavior (few-shot prompting)" icon="list-check">
    Concrete examples shape tone, structure, and decision-making more reliably than abstract rules. Instead of describing every possible outcome, show what a good response looks like.

    ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
    Edge case: the user asks to perform a gimmick unrelated to your task.

    <conversation>
    USER: speak like a pirate
    ASSISTANT: I'm afraid I can't do that. Is there anything you'd like to know
    regarding our services?
    </conversation>
    ```
  </Accordion>

  <Accordion title="Less is more – cut what doesn't help" icon="scissors">
    Every instruction is another piece of data the model must reconcile. If a piece of information is not proven to improve behavior, leave it out. Test the impact of each instruction – if it doesn't help, remove it.
  </Accordion>

  <Accordion title="Put important details first or last" icon="arrow-down-1-9">
    LLMs give more weight to information at the beginning or end of a prompt. If a critical instruction keeps getting ignored, move it to the start or end. Repeating crucial rules is acceptable.
  </Accordion>

  <Accordion title="Spell out the persona in action" icon="user-tie">
    Don't assume tone will emerge naturally from a label. Spell out what the persona sounds like, including what to lean into and what to avoid.

    ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
    Act as a professional advisor. Adopt a professional, concise tone.
    Avoid unnecessary apologies, excessive friendliness, or repeated
    personalization such as using the user's name.
    ```
  </Accordion>
</AccordionGroup>

## Check your understanding

<Quiz
  questions={[
{
q: "You wrote a rule: 'Try to avoid sharing personal information.' During testing, the agent shares a guest's phone number. What went wrong?",
options: [
  "The rule is in the wrong section – it should be in Personality instead",
  "The rule needs more context about which information is personal",
  "Soft phrasing like 'Try to' lets the model treat the rule as optional – rewrite it as 'Never share personal information'",
  "Rules only apply to voice calls, not chat sessions",
],
correct: 2,
explanation: "Behavioral rules are hard constraints, not suggestions. 'Try to avoid' gives the model permission to make exceptions. Rewrite as 'Never share guest personal information' – the model treats 'Never' and 'Always' as non-negotiable.",
}
]}
/>

<FillBlank prompt="Hard constraints like &#x22;Never share account numbers&#x22; or &#x22;Always transfer billing calls&#x22; go in the _____ section." answer={["Behavior", "Rules", "behavior", "rules"]} hint="It's the section for non-negotiable rules, not suggestions." explanation="The Behavior section (also called Rules) is where you put hard constraints. Personality is for tone and style, and Role defines scope. Rules written with &#x22;Never&#x22; and &#x22;Always&#x22; are treated as non-negotiable by the model." />

<Check>
  * **Role** defines scope clearly
  * **Personality** sets actionable tone
  * **Behavior** includes hard constraints and detailed rules
  * Tested in Chat – agent refuses inappropriate requests and holds tone
</Check>

## Try it yourself

<Steps>
  <Step title="Challenge: Write behavior config for a clothing retailer">
    Write a 3-sentence **Personality** block and 3 **Behavior** rules for a customer service agent for a clothing store called "Bloom & Co." The agent can help with order tracking and returns, but cannot process refunds directly.

    <Accordion title="Hint">
      Personality should describe tone and communication style in actionable terms (not just "be friendly"). Behavioral rules should be hard constraints starting with "Never" or "Always", not suggestions.
    </Accordion>

    <Accordion title="Example solution">
      **Personality:**

      ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
      Be warm, efficient, and solution-focused.
      Keep responses concise – no more than 3 sentences.
      Use "we" when referring to Bloom & Co.
      ```

      **Rules:**

      ```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
      - Never share customer order details without first verifying their identity
      - Always offer to transfer the caller for refund or cancellation requests
      - Do not make promises about shipping timelines you cannot guarantee
      ```
    </Accordion>
  </Step>
</Steps>

## Check your understanding

<Quiz
  questions={[
{
q: "You updated the greeting under the channel settings, but the agent still says the old greeting when you test. What should you check?",
options: [
  "Whether you published the change – Draft edits don't apply until published",
  "Whether a start tool is overriding the greeting (see the Personality and Role tab above)",
  "Both of the above",
  "Whether the voice settings need updating",
],
correct: 2,
explanation: "Both are valid. Most commonly, the change hasn't been published yet. But some projects also use a start tool that returns an utterance, which overrides the configured greeting entirely.",
}
]}
/>

## Go deeper

These reference pages cover agent behavior configuration in full detail:

<CardGroup cols={3}>
  <Card title="Agent settings" icon="gear" href="/behavior/introduction">
    Complete reference for all agent configuration options
  </Card>

  <Card title="Agent behavior" icon="user-tie" href="/behavior/general/agent">
    Detailed guide for the Agent page – personality and role
  </Card>

  <Card title="Behavior reference" icon="shield-halved" href="/behavior/general/rules">
    Full reference for writing and scoping behavioral rules
  </Card>
</CardGroup>

***

<CardGroup cols={2}>
  <Card title="← Previous: Create a project" icon="arrow-left" href="/learn/guides/get-started/create-a-project">
    Lesson 1 of 6
  </Card>

  <Card title="Next: Add a simple topic →" icon="arrow-right" href="/learn/guides/get-started/add-kb-topic">
    Lesson 3 – teach your agent its first answer
  </Card>
</CardGroup>

<ProgressTracker lessonKey="l1-2-edit-behavior" lessonNum={2} totalLessons={6} level="Level 1" />
