Skip to content

Fix missing imports in sync-openai-agents template#278

Open
muhammad-rifky-scale wants to merge 1 commit intomainfrom
mr/fix-sync-openai-agents-template-imports
Open

Fix missing imports in sync-openai-agents template#278
muhammad-rifky-scale wants to merge 1 commit intomainfrom
mr/fix-sync-openai-agents-template-imports

Conversation

@muhammad-rifky-scale
Copy link
Collaborator

@muhammad-rifky-scale muhammad-rifky-scale commented Feb 27, 2026

Summary

  • Add StreamTaskMessageFull to the TaskMessageUpdate import in acp.py.j2
  • Add missing TextContent import from agentex.types.text_content

Context

The issue was discovered when running agentex init and selecting the Sync ACP + OpenAI Agents SDK template. The generated acp.py was missing two imports, causing runtime errors immediately after project initialization when OPENAI_API_KEY is not present.

Test plan

  • Ran agentex init, selected Sync ACPSync ACP + OpenAI Agents SDK, and verified the generated project contains the correct imports without errors

Greptile Summary

Fixes two missing imports in the sync-openai-agents Jinja2 template that caused immediate NameError at runtime when using agentex init with the Sync ACP + OpenAI Agents SDK option.

  • Adds StreamTaskMessageFull to the import from agentex.types.task_message_update (used on line 79 for the missing-API-key guard)
  • Adds TextContent import from agentex.types.text_content (used on line 82 to construct the error message content)
  • Both symbols are verified exports from their respective modules; no other templates are affected

Confidence Score: 5/5

  • This PR is safe to merge — it only adds two missing imports that fix a runtime NameError.
  • The change is minimal (2 lines added), purely additive (import statements only), fixes a clear runtime bug, and both imported symbols are verified exports from their source modules. No logic changes, no risk of regression.
  • No files require special attention.

Important Files Changed

Filename Overview
src/agentex/lib/cli/templates/sync-openai-agents/project/acp.py.j2 Adds two missing imports (StreamTaskMessageFull, TextContent) that are used on lines 79 and 82 respectively. Both symbols are verified exports from their source modules. No issues found.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["agentex init (Sync ACP + OpenAI Agents)"] --> B["Generates acp.py from acp.py.j2"]
    B --> C{"OPENAI_API_KEY set?"}
    C -- No --> D["yield StreamTaskMessageFull\nwith TextContent error message"]
    C -- Yes --> E["Run OpenAI Agent via Runner.run_streamed"]
    E --> F["convert_openai_to_agentex_events"]
    F --> G["yield agentex streaming events"]
    G --> H["Update task state via adk.state.update"]

    style D fill:#f9d71c,stroke:#333
Loading

Last reviewed commit: 0d2c5f0

Add StreamTaskMessageFull and TextContent imports to acp.py.j2
so the no-API-key error response compiles correctly.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@muhammad-rifky-scale muhammad-rifky-scale marked this pull request as draft February 27, 2026 17:49
@muhammad-rifky-scale muhammad-rifky-scale marked this pull request as ready for review February 27, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant