Skip to content

OpenAIChatServer bypasses step() and ignores platform.enabled #231

Description

@rdwj

Summary

When platform.enabled=true in agent.yaml, OpenAIChatServer's HTTP handler still uses the chat completions streaming path (astep_stream -> call_model_stream_raw), which calls /v1/chat/completions directly. It never calls step() or call_model_responses(), so platform mode has no effect on the HTTP serving path.

This means agents using OpenAIChatServer with platform mode get:

  • 404 errors (OGX doesn't serve the same chat completions endpoint shape)
  • No MCP tool routing (tools configured in platform.mcp are never passed)
  • No guardrail enforcement

Reproduction

# agent.yaml
platform:
  enabled: true
  endpoint: http://ogx-server:8321/v1
  mcp:
    - name: memoryhub
      connector_id: memoryhub
# src/agent.py (step() is never called by the server)
class MyAgent(BaseAgent):
    async def step(self) -> StepResult:
        response = await self.call_model_responses(input=...)
        return StepResult.done(result=response.content)

Start with OpenAIChatServer and send a POST to /v1/chat/completions. The server calls astep_stream -> call_model_stream_raw -> chat completions, ignoring platform mode entirely.

Workaround

Replace OpenAIChatServer with a thin FastAPI server that calls call_model_responses() directly and translates the result to chat completions format. Working example in memory-hub demos/ogx-memory.

Expected behavior

When platform.enabled=true, OpenAIChatServer should route through the Responses API path instead of chat completions. The instructions parameter should carry the assembled system prompt, and platform.mcp tools should be passed on every request.

Additional context

Also found that platform.endpoint needs to include /v1 because _require_platform() passes it directly to AsyncOpenAI(base_url=...). Without the suffix, the SDK hits /responses instead of /v1/responses. This should be documented or auto-appended.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions