Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def build_reception_instructions() -> str:
"but do not overuse fillers. "
"\n\n"
"Call flow rules:\n"
f"1) First turn must be exactly: 'This is {business_name}, {ASSISTANT_NAME} speaking. How can I help?'\n"
"1) First turn must be exactly: 'Downtown Demo Barbershop, this is Jess— I can help you get booked or check what we have open. What are you looking to come in for today?'\n"

Copilot AI Apr 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prompt now hardcodes a first-turn greeting with “Downtown Demo Barbershop” and “Jess”, but elsewhere in the same instructions the agent identity still uses the configurable BUSINESS_PROFILE business_name and ASSISTANT_NAME (defaulting to “Downtown Demo Barber Shop” / “Jessica”). This inconsistency can confuse the model and makes the “must be exactly” rule more fragile. Consider either (a) aligning BUSINESS_PROFILE/defaults + ASSISTANT_NAME to match this exact script, or (b) generating the greeting from those configured values so the identity is consistent end-to-end.

Suggested change
"1) First turn must be exactly: 'Downtown Demo Barbershop, this is Jess— I can help you get booked or check what we have open. What are you looking to come in for today?'\n"
f"1) First turn must be exactly: '{business_name}, this is {ASSISTANT_NAME}— I can help you get booked or check what we have open. What are you looking to come in for today?'\n"

Copilot uses AI. Check for mistakes.
"2) Be helpful first: answer the caller's question directly before suggesting any next step.\n"
"3) Do not pressure, upsell, or repeatedly circle back to appointments. Only mention booking when the caller asks to book or when it genuinely helps answer their question.\n"
"4) If the caller interrupts, changes the subject, or asks a new question, stop the current response immediately in your next turn, answer the new request, and drop any unfinished booking script.\n"
Expand Down Expand Up @@ -300,11 +300,10 @@ async def agent_session(ctx: JobContext) -> None:
),
)

business_name = str(
BUSINESS_PROFILE.get("business_name", "Downtown Demo Barber Shop")
)
await session.say(
Comment on lines -303 to 306

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Duplicated, hard-coded greeting string in agent_session can drift from the instruction text

The first-turn utterance is defined both in build_reception_instructions and here in agent_session. That duplication makes it easy for the spoken greeting to drift from the instructions over time. Consider pulling this text from a shared constant or helper so the model’s instructions and the actual opening line always stay in sync.

Suggested implementation:

        "\n\n"
        "Call flow rules:\n"
        f"1) First turn must be exactly: '{FIRST_TURN_GREETING}'\n"
        "2) Be helpful first: answer the caller's question directly before suggesting any next step.\n"
        "3) Do not pressure, upsell, or repeatedly circle back to appointments. Only mention booking when the caller asks to book or when it genuinely helps answer their question.\n"
        "4) If the caller interrupts, changes the subject, or asks a new question, stop the current response immediately in your next turn, answer the new request, and drop any unfinished booking script.\n"
        ),
    )


    await session.say(FIRST_TURN_GREETING)

To complete the refactor and avoid duplication, you should also:

  1. Define a shared constant at module level (near other configuration/constants), for example:
    FIRST_TURN_GREETING = "Downtown Demo Barbershop, this is Jess— I can help you get booked or check what we have open. What are you looking to come in for today?"
  2. Ensure there are no other hard-coded copies of this greeting elsewhere; update them to use FIRST_TURN_GREETING as well if they exist.

f"This is {business_name}, {ASSISTANT_NAME} speaking. How can I help?"
"Downtown Demo Barbershop, this is Jess— "
"I can help you get booked or check what we have open. "
"What are you looking to come in for today?"
Comment on lines 303 to +306

Copilot AI Apr 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The opening greeting string is duplicated (here and in build_reception_instructions). Keeping two copies increases the risk that runtime behavior and prompt/tests drift over time. Recommend defining a single constant (e.g., OPENING_GREETING) and reusing it for both the prompt and session.say (and optionally for the test intent text as well).

Copilot uses AI. Check for mistakes.
)


Expand Down
8 changes: 4 additions & 4 deletions tests/test_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,11 @@ async def test_uses_caller_led_opening_line() -> None:
.judge(
llm,
intent="""
Uses a natural phone greeting like:
- "This is Downtown Demo Barber Shop, Jessica speaking."
- Asks "How can I help?"
Uses this caller-led opening greeting:
- "Downtown Demo Barbershop, this is Jess—"
- "I can help you get booked or check what we have open. What are you looking to come in for today?"
Comment on lines +160 to +162

Copilot AI Apr 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This intent description doesn’t explicitly require the greeting verbatim (including punctuation/spacing), and splitting the quote across two bullet lines (ending the first with an em dash) makes the requirement a bit ambiguous for the LLM judge. To better enforce the PR’s “exact wording” goal, consider stating the full greeting as a single quoted line and explicitly calling out “verbatim / exact text”.

Suggested change
Uses this caller-led opening greeting:
- "Downtown Demo Barbershop, this is Jess—"
- "I can help you get booked or check what we have open. What are you looking to come in for today?"
The assistant must use this exact opening greeting verbatim, including punctuation and spacing:
"Downtown Demo Barbershop, this is Jess—I can help you get booked or check what we have open. What are you looking to come in for today?"

Copilot uses AI. Check for mistakes.

The message should sound conversational, not scripted or robotic.
The message should stay natural and conversational.
""",
)
)
Expand Down
Loading