Skip to content

[bug] /v1/chat/completions returns 400 when stream=true, breaking Agent framework integration #503

Description

@tangxinyao

Prerequisites

  • I have searched the issue tracker and this bug has not been reported yet.
  • The bug is in AReno itself, not in my own code.
  • I can reproduce it with an official install (not a heavily modified environment).
  • I can consistently reproduce the bug across multiple trials or seeds.

Describe the bug

The /v1/chat/completions endpoint of areno serve does not support stream=true and directly returns a 400 error. As a result, any Agent framework that relies on the SSE streaming protocol (such as OpenAI SDK, LangChain, AutoGen, CrewAI, etc.) cannot use the areno service as a backend.

Currently, this limit is explicitly hardcoded in the codebase:

  • areno/cli/serve.py (line 433):
if request.stream:
    raise HTTPException(status_code=400, detail="stream=true is not supported")
  • areno/api/agentic.py (line 456):
if body.get("stream"):
    _write_json(handler, 400, {"error": {"message": "streaming chat completions are not supported yet"}})

Why it is needed:

  1. Evaluating Agent Model Performance: Mainstream Agent frameworks drive multi-turn conversations and tool usage via client.chat.completions.create(stream=True). Lack of streaming support prevents downstream evaluation of trained models.
  2. Agentic Training (Tool-Use RL): During the rollout phase, agentic training loops rely on SSE streaming to dynamically parse incremental tool_calls and delta payloads. Non-streaming responses freeze the whole execution loop.

Expected behavior

When receiving stream=true, the /v1/chat/completions endpoint of areno serve should return an SSE event stream (text/event-stream) compliant with the OpenAI streaming specification:

  • Begins with delta.role = "assistant"
  • Incrementally emits text or tool_calls deltas
  • Concludes with finish_reason, usage, and data: [DONE]

Note: Streaming support for /v1/chat/completions is target for the serve layer in this PR; areno/api/agentic.py is currently out of scope.

Full logs

HTTP/1.1 400 Bad Request
Content-Type: application/json

{
  "detail": "stream=true is not supported"
}

Reproduction

import openai

client = openai.OpenAI(
    base_url="http://localhost:8000/v1",
    api_key="empty",
)

# This call will fail with a 400 Bad Request error
response = client.chat.completions.create(
    model="my-model",
    messages=[{"role": "user", "content": "Hello"}],
    stream=True,
)

for chunk in response:
    print(chunk)

Exact command

areno serve --model-path ling_v3_tiny_f16 --tp-size 1 --world-size 1 --port 8000

Full traceback

Environment

  • OS: *
  • Python: *
  • CUDA: *
  • PyTorch: *
  • AReno: *
  • GPU model: *

Install mode

editable source / pip install -e .

Was ARENO_BUILD_EXT=0 used?

Not sure

areno env --json

areno check

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions