Skip to content

Add Stellar Styles system prompt and wire into agent#3

Merged
WebCraftPhil merged 1 commit into
mainfrom
codex/update-stellarstylesagent-configuration
Jan 28, 2026
Merged

Add Stellar Styles system prompt and wire into agent#3
WebCraftPhil merged 1 commit into
mainfrom
codex/update-stellarstylesagent-configuration

Conversation

@WebCraftPhil

@WebCraftPhil WebCraftPhil commented Jan 28, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Introduce a deeper “Stellar Styles and More” persona and behavior spec so the voice agent responds with a clear brand backstory and concise, non-pushy guidance.
  • Ensure the new system prompt is actually used at runtime when a session starts without changing any runtime APIs or dependencies.

Description

  • Add a new prompt file src/prompts/stellar_styles_system_prompt.txt containing the full Stellar system/developer prompt (voice, allowed/not allowed rules, default opening/closing, etc.).
  • Load the prompt at startup in src/agent.py as STELLAR_SYSTEM_PROMPT and pass it into the agent constructor so the agent uses the Stellar persona for instructions.
  • Add DEFAULT_OPENING in src/agent.py and use it in session.generate_reply(...) to ensure the default greeting matches the spec.
  • Add a small unit test tests/test_agent.py::test_stellar_prompt_loaded that asserts the Stellar prompt is present in STELLAR_SYSTEM_PROMPT and on the Assistant instance.

Testing

  • Ran linter/format checks with uv run ruff format and uv run ruff check, but both failed in this environment due to a lockfile platform mismatch error.
  • Ran tests with uv run pytest, but it failed in this environment for the same lockfile platform mismatch error so the new test could not be executed here.
  • The new unit test test_stellar_prompt_loaded was added to tests/test_agent.py and will pass in a compatible environment where uv and the lockfile conditions are met.

Codex Task

Summary by Sourcery

Integrate a new Stellar Styles and More system prompt into the voice agent and ensure it is used for greetings and instructions at runtime.

New Features:

  • Load a dedicated Stellar Styles and More system prompt from a text file and use it as the agent's instructions.
  • Introduce a default opening greeting aligned with the Stellar Styles and More persona for initial replies.

Tests:

  • Add a unit test to verify the Stellar Styles and More prompt is loaded and applied to the Assistant instance.

Copilot AI review requested due to automatic review settings January 28, 2026 15:13
@sourcery-ai

sourcery-ai Bot commented Jan 28, 2026

Copy link
Copy Markdown

Reviewer's Guide

Wires a new, file-based Stellar Styles system prompt into the voice agent, updates the default greeting to match the new persona, and adds a unit test to verify the prompt is loaded and applied to the Assistant.

Sequence diagram for agent session using Stellar prompt and default opening

sequenceDiagram
  actor Caller
  participant AgentSession as agent_session
  participant Assistant
  participant Session

  Caller->>AgentSession: start_call()
  AgentSession->>Assistant: create Assistant()
  Assistant->>Assistant: use STELLAR_SYSTEM_PROMPT as instructions

  AgentSession->>Session: create Session(Assistant)
  AgentSession->>Session: generate_reply(DEFAULT_OPENING)
  Session-->>Caller: spoken Stellar greeting
Loading

Class diagram for Assistant using Stellar system prompt

classDiagram
  class Agent {
    +__init__(instructions)
  }

  class Assistant {
    +__init__()
  }

  class Prompts {
    <<module>>
    +STELLAR_SYSTEM_PROMPT: str
    +DEFAULT_OPENING: str
  }

  Assistant --|> Agent
  Assistant ..> Prompts: uses
Loading

File-Level Changes

Change Details Files
Load Stellar Styles system prompt from a text file and use it as the Assistant instructions.
  • Define PROMPT_PATH pointing to the new stellar_styles_system_prompt.txt under src/prompts.
  • Read the prompt file at import time into STELLAR_SYSTEM_PROMPT with UTF-8 encoding and strip whitespace.
  • Update Assistant.init to pass STELLAR_SYSTEM_PROMPT as the instructions to the Agent base class instead of the previous hard-coded string.
src/agent.py
src/prompts/stellar_styles_system_prompt.txt
Align the default opening greeting with the Stellar Styles persona and use it when starting a session.
  • Introduce DEFAULT_OPENING constant with the new Stellar Styles greeting text.
  • Change agent_session to call session.generate_reply with instructions set to DEFAULT_OPENING instead of the previous generic greeting instruction.
src/agent.py
Add a unit test to ensure the Stellar prompt is loaded and applied to Assistant instances.
  • Import STELLAR_SYSTEM_PROMPT alongside Assistant for testing.
  • Add test_stellar_prompt_loaded to assert the Stellar brand phrase appears in STELLAR_SYSTEM_PROMPT and in assistant.instructions.
  • Keep existing async behavioral test test_offers_assistance unchanged aside from import adjustments.
tests/test_agent.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 2 issues, and left some high level feedback:

  • Reading the prompt file at import time with PROMPT_PATH.read_text(...) will raise at module import if the file is missing or the path changes; consider adding error handling or using importlib.resources so the module can still import cleanly in misconfigured environments.
  • Using DEFAULT_OPENING as the instructions argument in session.generate_reply may override or conflict with the system persona for that turn; consider sending the opening as the content of the first assistant message (or as a separate parameter) while keeping STELLAR_SYSTEM_PROMPT as the persistent system instructions.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Reading the prompt file at import time with `PROMPT_PATH.read_text(...)` will raise at module import if the file is missing or the path changes; consider adding error handling or using `importlib.resources` so the module can still import cleanly in misconfigured environments.
- Using `DEFAULT_OPENING` as the `instructions` argument in `session.generate_reply` may override or conflict with the system persona for that turn; consider sending the opening as the content of the first assistant message (or as a separate parameter) while keeping `STELLAR_SYSTEM_PROMPT` as the persistent system instructions.

## Individual Comments

### Comment 1
<location> `tests/test_agent.py:18-23` </location>
<code_context>
     return inference.LLM(model="openai/gpt-4.1-mini")


+def test_stellar_prompt_loaded() -> None:
+    assistant = Assistant()
+
+    assert "Stellar Styles and More" in STELLAR_SYSTEM_PROMPT
+    assert hasattr(assistant, "instructions")
+    assert "Stellar Styles and More" in assistant.instructions
+
+
</code_context>

<issue_to_address>
**suggestion (testing):** Strengthen the test by asserting the Assistant’s `instructions` exactly matches `STELLAR_SYSTEM_PROMPT`.

The current checks only verify that both `STELLAR_SYSTEM_PROMPT` and `assistant.instructions` contain the substring "Stellar Styles and More", so the test would still pass if a different or truncated prompt included that phrase. To better verify the wiring, assert direct equality instead:

```python
def test_stellar_prompt_loaded() -> None:
    assistant = Assistant()

    assert "Stellar Styles and More" in STELLAR_SYSTEM_PROMPT  # still validates the brand anchor
    assert hasattr(assistant, "instructions")
    assert assistant.instructions == STELLAR_SYSTEM_PROMPT
```

This ensures the assistant uses the full prompt loaded from disk.
</issue_to_address>

### Comment 2
<location> `tests/test_agent.py:26-27` </location>
<code_context>
+    assert "Stellar Styles and More" in assistant.instructions
+
+
 @pytest.mark.asyncio
 async def test_offers_assistance() -> None:
     """Evaluation of the agent's friendly nature."""
</code_context>

<issue_to_address>
**suggestion (testing):** Add a test that explicitly verifies the `DEFAULT_OPENING` greeting is used when a session starts.

The current tests still only validate that the assistant is generally friendly/helpful and that `DEFAULT_OPENING` exists, but not that it’s actually used when a session starts.

Please add (or extend) a test that:

1. Starts an `agent_session` (or your intended public entry point) with a test `JobContext` and stubbed LLM, and
2. Asserts that the first call to `generate_reply` receives `DEFAULT_OPENING` (or that the assistant’s first reply contains the expected greeting text).

This will confirm the new runtime behavior described in the PR, not just the constant definition.

Suggested implementation:

```python
@pytest.mark.asyncio
async def test_offers_assistance(agent_session, job_context, stub_llm) -> None:
    """Evaluation of the agent's friendly nature and opening greeting behavior."""

    # Start a new assistant session with a test JobContext and stubbed LLM
    session = agent_session(job_context=job_context, llm=stub_llm)

    # The first reply in a fresh session should use the DEFAULT_OPENING greeting
    first_reply = await session.generate_reply()
    # Depending on your agent API, `first_reply` may be a string or an object with `.content`
    content = getattr(first_reply, "content", first_reply)

    assert DEFAULT_OPENING in content

```

To fully integrate this change, you may need to:
1. Ensure `agent_session`, `job_context`, and `stub_llm` fixtures exist and are imported/defined consistently with the rest of your test suite. If your existing public entry point is named differently (e.g. `create_agent_session` or `AgentSession(...)`), update the call site and parameters accordingly.
2. Import `DEFAULT_OPENING` at the top of `tests/test_agent.py` if it is not already imported, e.g.:
   `from your_agent_module import DEFAULT_OPENING`
3. If your agent's first reply is returned via a different method (e.g. `await session.next()` or `await session.step()`), or the reply object exposes text under a different attribute (e.g. `.text` instead of `.content`), adjust the `generate_reply()` call and the `content` extraction line to match the actual API.
4. If you prefer to keep `test_offers_assistance` focused only on friendliness, you can instead:
   - Restore its original signature/body, and
   - Add a separate test `test_session_uses_default_opening_greeting(...)` immediately below it with the same body as in the replacement block above.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread tests/test_agent.py
Comment on lines +18 to +23
def test_stellar_prompt_loaded() -> None:
assistant = Assistant()

assert "Stellar Styles and More" in STELLAR_SYSTEM_PROMPT
assert hasattr(assistant, "instructions")
assert "Stellar Styles and More" in assistant.instructions

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 (testing): Strengthen the test by asserting the Assistant’s instructions exactly matches STELLAR_SYSTEM_PROMPT.

The current checks only verify that both STELLAR_SYSTEM_PROMPT and assistant.instructions contain the substring "Stellar Styles and More", so the test would still pass if a different or truncated prompt included that phrase. To better verify the wiring, assert direct equality instead:

def test_stellar_prompt_loaded() -> None:
    assistant = Assistant()

    assert "Stellar Styles and More" in STELLAR_SYSTEM_PROMPT  # still validates the brand anchor
    assert hasattr(assistant, "instructions")
    assert assistant.instructions == STELLAR_SYSTEM_PROMPT

This ensures the assistant uses the full prompt loaded from disk.

Comment thread tests/test_agent.py
Comment on lines 26 to 27
@pytest.mark.asyncio
async def test_offers_assistance() -> None:

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 (testing): Add a test that explicitly verifies the DEFAULT_OPENING greeting is used when a session starts.

The current tests still only validate that the assistant is generally friendly/helpful and that DEFAULT_OPENING exists, but not that it’s actually used when a session starts.

Please add (or extend) a test that:

  1. Starts an agent_session (or your intended public entry point) with a test JobContext and stubbed LLM, and
  2. Asserts that the first call to generate_reply receives DEFAULT_OPENING (or that the assistant’s first reply contains the expected greeting text).

This will confirm the new runtime behavior described in the PR, not just the constant definition.

Suggested implementation:

@pytest.mark.asyncio
async def test_offers_assistance(agent_session, job_context, stub_llm) -> None:
    """Evaluation of the agent's friendly nature and opening greeting behavior."""

    # Start a new assistant session with a test JobContext and stubbed LLM
    session = agent_session(job_context=job_context, llm=stub_llm)

    # The first reply in a fresh session should use the DEFAULT_OPENING greeting
    first_reply = await session.generate_reply()
    # Depending on your agent API, `first_reply` may be a string or an object with `.content`
    content = getattr(first_reply, "content", first_reply)

    assert DEFAULT_OPENING in content

To fully integrate this change, you may need to:

  1. Ensure agent_session, job_context, and stub_llm fixtures exist and are imported/defined consistently with the rest of your test suite. If your existing public entry point is named differently (e.g. create_agent_session or AgentSession(...)), update the call site and parameters accordingly.
  2. Import DEFAULT_OPENING at the top of tests/test_agent.py if it is not already imported, e.g.:
    from your_agent_module import DEFAULT_OPENING
  3. If your agent's first reply is returned via a different method (e.g. await session.next() or await session.step()), or the reply object exposes text under a different attribute (e.g. .text instead of .content), adjust the generate_reply() call and the content extraction line to match the actual API.
  4. If you prefer to keep test_offers_assistance focused only on friendliness, you can instead:
    • Restore its original signature/body, and
    • Add a separate test test_session_uses_default_opening_greeting(...) immediately below it with the same body as in the replacement block above.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a comprehensive "Stellar Styles and More" brand persona to the voice agent by introducing a system prompt file and wiring it into the agent's initialization. The changes replace the generic assistant instructions with a detailed, brand-specific prompt that defines the agent's voice, behavior, and guidelines.

Changes:

  • Added a new system prompt file defining the Stellar Styles agent persona with voice guidelines, allowed/disallowed behaviors, and default responses
  • Modified agent initialization to load and use the Stellar system prompt instead of generic instructions
  • Added a DEFAULT_OPENING constant and applied it to the initial greeting generation
  • Added a unit test to verify the prompt is loaded correctly

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/prompts/stellar_styles_system_prompt.txt New system prompt file defining the Stellar Styles brand voice, behavior rules, and default opening/closing messages
src/agent.py Loads the Stellar system prompt at startup and uses it in the Assistant class; adds DEFAULT_OPENING constant for initial greeting
tests/test_agent.py Adds test to verify the Stellar prompt is loaded into both the module-level constant and the Assistant instance

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/agent.py
Comment on lines +22 to +25
PROMPT_PATH = (
Path(__file__).resolve().parent / "prompts" / "stellar_styles_system_prompt.txt"
)
STELLAR_SYSTEM_PROMPT = PROMPT_PATH.read_text(encoding="utf-8").strip()

Copilot AI Jan 28, 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 file loading lacks error handling. If the prompt file is missing, moved, or has read permission issues, the application will crash at module import time with an unclear error. Consider adding a try-except block that provides a clear error message or falls back to a default prompt, similar to how other configuration loading is typically handled.

Copilot uses AI. Check for mistakes.
Comment thread src/agent.py
Comment on lines 80 to 82
await session.generate_reply(
instructions="Greet the caller and offer your assistance."
instructions=DEFAULT_OPENING
)

Copilot AI Jan 28, 2026

Copy link

Choose a reason for hiding this comment

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

The DEFAULT_OPENING is passed as the instructions parameter to session.generate_reply(). Based on the parameter name "instructions" and the previous usage pattern ("Greet the caller and offer your assistance."), this parameter appears to expect a directive/instruction to the agent, not the actual text to say. The current implementation passes the literal greeting text which may not produce the intended behavior. Consider using a directive like "Greet the user with the default opening" or verify the API behavior to ensure this produces the expected output.

Copilot uses AI. Check for mistakes.
Comment thread tests/test_agent.py
Comment on lines +22 to +23
assert hasattr(assistant, "instructions")
assert "Stellar Styles and More" in assistant.instructions

Copilot AI Jan 28, 2026

Copy link

Choose a reason for hiding this comment

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

The test uses hasattr(assistant, "instructions") to check for the attribute's existence, but this doesn't verify that the attribute is actually set by the parent class constructor. If the Agent parent class doesn't have an instructions attribute, this test will fail even though the prompt was loaded correctly. Consider accessing the attribute directly (which will raise AttributeError if missing) or verify the Agent API to ensure instructions is the correct attribute name.

Copilot uses AI. Check for mistakes.
@WebCraftPhil
WebCraftPhil merged commit efd9ff8 into main Jan 28, 2026
7 of 10 checks passed
@WebCraftPhil
WebCraftPhil deleted the codex/update-stellarstylesagent-configuration branch January 28, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants