Skip to content

openai_research_agent: missing spaces in Agent instructions produce fused words in the prompt #949

Description

@thejesh23

Where

starter_ai_agents/openai_research_agent/research_agent.py, lines 82–87.

What

The research_agent's instructions argument uses Python's implicit string-literal concatenation across six lines, but each line is missing the trailing space. Python joins adjacent string literals verbatim, so the string actually shipped to the model contains fused words:

instructions="You are a research assistant. Given a search term, you search the web for that term and"
"produce a concise summary of the results. The summary must 2-3 paragraphs and less than 300"
"words. Capture the main points. Write succintly, no need to have complete sentences or good"
"grammar. This will be consumed by someone synthesizing a report, so its vital you capture the"
"essence and ignore any fluff. Do not include any additional commentary other than the summary"
"itself.",

After Python's concatenation, the string the LLM actually receives contains:

  • "…for that term andproduce a concise summary…"
  • "…must 2-3 paragraphs and less than 300words…"
  • "…complete sentences or goodgrammar…"
  • "…so its vital you capture theessence and ignore any fluff…"
  • "…other than the summaryitself."

Every line boundary loses the space. It's not a crash, but it degrades the system prompt on a template used to teach the OpenAI Agents SDK.

Two related minor typos live in the same block (succintlysuccinctly, must 2-3 paragraphsmust be 2-3 paragraphs, its vitalit's vital).

Fix

Add the missing trailing spaces (and fix the typos while touching those lines). PR incoming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions