Skip to content

fix(ai): agent runs send no style request #5424

Description

@dan-petty

Problem Description

A pydantic-ai agent run does not get the style rules of src/devops_cli/ai/tasks/style_ste100.md. Only LLMClient adds them: with_style_request has two callers, src/devops_cli/ai/client/unified.py and src/devops_cli/ai/client/structured.py. These runs send their prompt with no style request:

  • devops ai chat: src/devops_cli/commands/ai.py builds the persona agent with build_agent from src/devops_cli/ai/client/factory.py.
  • investigate in src/devops_cli/roadmap/refine/refine_investigation.py, which the refine investigation, the stage toolbox planner (src/devops_cli/roadmap/stage/stage_toolbox.py) and the alternatives check (src/devops_cli/roadmap/alternatives.py) call.
  • The implement step agent of src/devops_cli/roadmap/implement/implement_step.py.

So these runs do not get the ASD-STE100 rules (#1866) or the rule to give the bottom line in the first line (#5419). The text that they write for a person, such as a plan, a refined issue or a chat reply, does not follow the rules that AGENTS.md rule 9 sets.

Reproduction Steps

  1. git grep -n with_style_request -- src
  2. git grep -n "build_agent(" -- src
  3. git grep -n "investigate(" -- src

Expected vs Actual Behavior

Expected: each model call that writes text for a person gets the style request, as the docstring of src/devops_cli/ai/client/style_request.py says ("every free-text model call carries").

Actual: only the calls of LLMClient get it. The agent runs above send their instructions with no style request.

Environment Diagnostics

origin/main at the release 0.129.0.

Logs, Traces, or Terminal Output

git grep -n with_style_request -- src shows the two callers in unified.py and structured.py and no other caller.

Pre-Submission Checklist

  • I searched the open issues for "build_agent", "style_request" and "ASD-STE100". No issue covers it.

Alternatives check of 2026-11-28: in-use.
The repository already uses this tool.
Tool: pydantic-ai (https://pypi.org/project/pydantic-ai), MIT, last activity 2026-11-28, maintained.
Reason: Searches found no external tool that supplies ASD-STE100 style rules, but pydantic-ai, the agent framework the project already uses, sends agent instructions on every run, so the style text only needs wiring into the builders.

Covers:

  • Instructions attached to an agent are sent on every run
  • Static and per-run dynamic instructions hooks
  • One shared builder can serve chat, investigate and implement agents

Lacks:

  • No ASD-STE100 rule text or loader
  • No styling of the separate implement-step builder
  • No check that every builder carries the style request

Proposed design

Problem statement

A pydantic-ai agent run sends its instructions without the ASD-STE100 style request. Only LLMClient adds the style request. Chat, investigate and implement-step agents write prose that ignores AGENTS.md rule 9. The fix adds the style request to the agent builders.

Acceptance criteria

Requirement: Factory agent carries the style request

The factory build_agent SHALL add the style request to the instructions of every agent it builds.

Scenario: Factory agent instructions

  • WHEN A test calls build_agent from src/devops_cli/ai/client/factory.py with a system prompt.
  • THEN The test asserts that the agent instructions contain the text from with_style_request for that prompt.

Requirement: Implement-step agent carries the style request

The implement-step agent builder SHALL add the style request to the instructions of its agent.

Scenario: Implement-step agent instructions

  • WHEN A test builds the implement-step agent from src/devops_cli/roadmap/implement/implement_step.py.
  • THEN The test asserts that the agent instructions contain the text of src/devops_cli/ai/tasks/style_ste100.md.

Requirement: Chat agent carries the style request

The chat persona agent SHALL use the styled builder when devops ai chat creates it.

Scenario: Chat agent instructions

  • WHEN A test builds the chat persona agent through src/devops_cli/commands/ai.py.
  • THEN The test asserts that the agent instructions contain the style text.

Requirement: Investigate agent carries the style request

The investigate path SHALL use the styled builder for every agent it creates.

Scenario: Investigate agent instructions

  • WHEN A test calls investigate in src/devops_cli/roadmap/refine/refine_investigation.py with a fake model.
  • THEN The test asserts that the agent instructions contain the style text.

Existing Tool Considered

The alternatives check in the issue body records verdict none and Tool: none found. It found no covering tool. No open, maintained tool or library covers this need. The plan changes the project's own agent builders. Written cost: about 2,000 tokens to build, 1,000 to keep and 1,000 to fix; under one hour.

Key questions

  • Where should the style request be added so that chat, investigate and implement-step agents all get it?: Add with_style_request in the shared build_agent in src/devops_cli/ai/client/factory.py, and make the implement-step builder call that factory or apply the same helper. A new caller then cannot bypass the style request. (best practice) [sources: src/devops_cli/ai/client/factory.py:252, src/devops_cli/roadmap/implement/implement_step.py:767, src/devops_cli/roadmap/refine/refine_investigation.py:571, src/devops_cli/commands/ai.py]
    • Chosen: Shared helper used by both builders. Chat and investigate already call it, and one edit covers both paths.
    • Rejected: Factory builder only. The implement-step builder is separate and would still bypass the style request.
    • Rejected: Each call site. A new caller can bypass the style request again.
  • Should the style request go into the agent instructions or into each user prompt?: Put it into the agent instructions. pydantic-ai sends the instructions on every run, so one edit covers all prompts and multi-turn runs. (best practice) [sources: src/devops_cli/ai/client/factory.py:252, src/devops_cli/ai/client/style_request.py:8, src/devops_cli/ai/tasks/style_ste100.md]
    • Chosen: Agent instructions. It applies to every run and every turn with no caller action.
    • Rejected: Each user prompt. A caller can forget it and it repeats in every turn.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/bug
    source/agent
    scope/ai
    status/new
    value/medium
    effort/low
    on Nov 13, 2026
  2. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor
  3. added
    priority/p2-medium
    on Nov 13, 2026
  4. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: The searches returned no open tool or library that adds a project's style rules (ASD-STE100, bottom line first) to pydantic-ai agent runs; they only returned unrelated pages. The need is an internal fix in this repository: pass the style request in build_agent and in the investigate and implement-step paths, so no external tool covers it.

    Tool: none found

    Lacks:

    • No tool was found that appends src/devops_cli/ai/tasks/style_ste100.md to every pydantic-ai agent run.
    • No tool was found that covers the chat, investigate and implement-step agent paths that bypass with_style_request.
    • The issue needs a change to this project's own code (build_agent and the investigate callers), which no external library provides.

    Searches run:

    • ASD-STE100 style rules python library checker, results: 5
    • pydantic-ai agent instructions system prompt every run, results: 5
    • pydantic-ai agent middleware hook add system prompt all agents, results: 5
    • pydantic-ai Agent instructions parameter documentation, results: 5
    • "pydantic-ai" agent instructions, results: 5
    • github pydantic pydantic-ai, results: 5
    • python library inject writing style guide into every LLM prompt, results: 5
    • ASD-STE100 simplified technical English linter open source, results: 5
    • ai.pydantic.dev agents instructions system prompt, results: 5

    Checked on 2026-11-17. A person decides what this means for the item. The check changes no label and closes no issue.

  5. added
    status/ready
    and removed
    status/new
    on Nov 17, 2026
  6. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 0581ec5 (see proposed design in issue body).

  7. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: none, no tool. A person decides what the new result means for the item.

    Searches (7)

    Tools considered:

    Searches run:

    • pydantic-ai dynamic instructions decorator, results: 5
    • pydantic-ai agent instructions applied to every run, results: 5
    • pydantic-ai Agent instructions parameter system prompt documentation, results: 5
    • ai.pydantic.dev agents instructions, results: 5
    • pydantic-ai shared instructions all agents system prompt template, results: 5
    • github pydantic pydantic-ai agent instructions, results: 5
    • pydantic-ai, results: 5

    Sources:

  8. added
    owner/agent
    status/in-progress
    and removed
    status/ready
    on Nov 29, 2026
  9. added
    status/in-review
    and removed
    status/in-progress
    on Nov 29, 2026
  10. removed
    status/in-review
    owner/agent
    on Nov 29, 2026
  11. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-29 16:50 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumscope/aisource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions