Skip to content

feat(agent): Responses API transport for Responses-only models - #267

Open
darylfung96 wants to merge 3 commits into
VectifyAI:mainfrom
darylfung96:feat/responses-api
Open

darylfung96 wants to merge 3 commits into
VectifyAI:mainfrom
darylfung96:feat/responses-api

Conversation

@darylfung96

@darylfung96 darylfung96 commented Sep 21, 2026

Copy link
Copy Markdown

native OpenAI Responses API transport via openai-responses/ model prefix

Problem

Some gateways serve certain models exclusively on /v1/responses and answer /v1/chat/completions with 503 Endpoint is unavailable.
OpenKB talks to LLMs only through LiteLLM Chat Completions, so those models are completely unusable — compile, query, chat, lint, and
skills all fail.

Solution

Opt-in native Responses API transport. Prefixing the model id routes every agent call through the Responses API instead:

  model: openai-responses/<model-id>                                                                                                   

The prefix is OpenKB-only (stripped before anything reaches LiteLLM). Responses are adapted back to the Chat Completions shape, so all
existing call sites work unchanged — including tool calls and run_streamed sessions.

What's changed

  • New openkb/responses.py — message/tool/response_format translation, Chat-Completions-shaped response adapter, Agents-SDK
    OpenAIResponsesModel builder (per-KB creds, env fallback for CLI)
  • agent/compiler.py — _llm_call / _llm_call_async route through litellm.responses / aresponses when prefixed (2-line branches)
  • agent/query.py, agent/linter.py, skill/creator.py, skill/evaluator.py — Agent constructors + run-config builder use the Responses
    model; Chat Completions behavior untouched
  • indexer.py — long-PDF PageIndex path fails fast with a clear error (it requires a Chat Completions model)
  • Docs — config.yaml.example + examples/configuration/ section
  • Tests — tests/test_responses.py, 13 unit tests (translation, adapter, SDK wiring; no network)

Usage

  # .openkb/config.yaml                                                                                                                
  model: openai-responses/<model-id>                                                                                                   

Credentials work as usual (LLM_API_KEY + OPENAI_API_BASE, plus litellm.extra_headers if the gateway needs routing headers).

Limitations

  • Long-PDF PageIndex indexing still requires a Chat Completions model (explicit error, not a silent 503)
  • Verified end-to-end against an OpenAI-compatible gateway (compile + tool-using query); other Responses endpoints should work but are
    untested

Testing

  • pytest tests/test_responses.py — 13 passed
  • Full suite — 1261 passed, ruff check + ruff format clean
  • Live: full add compile and query against a Responses-only model

…efix)

Some gateways serve models exclusively on /v1/responses and 503
/v1/chat/completions. A KB can now opt in with e.g.
model: openai-responses/muse-spark-1.3-contributor.

- New openkb/responses.py: message/tool/response_format translation,
  Chat-Completions-shaped adapter, Agents-SDK OpenAIResponsesModel builder
- compiler: route _llm_call/_llm_call_async through litellm.responses
- query/chat/lint/skills/decks: Agent constructors + run-config builder
  use the Responses model (creds from bundle, else env)
- indexer: clear error for long-PDF PageIndex path (needs completions)
- Docs + 12 unit tests
…through

- Trim module/function docstrings to the why; fix stale blocks claim
- Extract _translate_content shared by both message paths (also fixes
  untranslated blocks on assistant+tool_calls messages)
- _to_dict: explicit continue on failed coercion
- Top-level third-party imports (no cycle); SDK wiring test
The openai-responses/ prefix works with any model id on any
OpenAI-compatible Responses endpoint; examples now use neutral
placeholders instead of a specific model.
@darylfung96 darylfung96 changed the title Add native OpenAI Responses API transport (openai-responses/ model) feat(agent): Responses API transport for Responses-only models Sep 21, 2026
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