Skip to content

feat: integrate direct vLLM inference with the shared executor - #382

Merged
franciscojavierarceo merged 8 commits into
vllm-project:mainfrom
franciscojavierarceo:codex/shared-vllm-inference
Nov 27, 2026
Merged

franciscojavierarceo merged 8 commits into
vllm-project:mainfrom
franciscojavierarceo:codex/shared-vllm-inference

Conversation

@franciscojavierarceo

@franciscojavierarceo franciscojavierarceo commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds direct Responses inference against a managed headless vLLM engine, implementing the shared executor boundary in #360 and initial native integration from #359. agentic serve, agentic run codex, and the source Python CLI's agentic-api run select HTTP with --upstream; otherwise they use $AGENTIC_API_HOME/model.config.

Changes by API

API What changed
Responses (/v1/responses, continuation, compaction) No wire change. HTTP and direct inference share request preparation, history, tools, sessions, accumulation, delivery, usage aggregation, and persistence.
Models and readiness Direct mode serves local engine metadata/readiness and validates configured API keys when OIDC is absent. The Codex launcher preserves advertised reasoning-summary support.
Other inference APIs, including Messages HTTP behavior is preserved. Direct mode returns 501 for unsupported endpoints; Claude Code requires --upstream.

Model recipe

model.config is TOML under the Agentic API home (default ~/.agentic-api):

model = "Qwen/Qwen3-4B"
tool_call_parser = "auto"
reasoning_parser = "auto"
max_model_len = 32768
engine_args = ["--tensor-parallel-size", "1", "--dtype", "bfloat16"]

Parser settings accept auto (default), none, or a supported name. Direct mode configures vLLM's Rust frontend and forwards the resolved reasoning parser to the engine; HTTP mode uses the upstream server's parsers. Tokenizer/revisions, template, generation defaults, served name, and Python executable are also configurable.

--model overrides the recipe's model. An inherited LLM_API_BASE or saved upstream URL does not change the launcher's mode selection. Engine-specific flags go in engine_args; frontend/transport overrides there are rejected.

Flow

flowchart TD
    CLI[Launcher] -->|upstream URL| HTTP[HTTP gateway]
    CLI -->|no upstream| Recipe[model.config]
    Recipe --> Native[Native composition: managed headless engine]
    HTTP --> Request[Shared request preparation and model projection]
    Native --> Request
    Request --> H[inference/http]
    Request --> D[inference/direct and agentic-vllm]
    H --> E[Existing EventFrame normalization and ingestion]
    D --> E
    E --> Loop[Shared delivery, tool loop, compaction and persistence]
Loading

Model preparation loads tokenizer/template resources and configures parsers once; shared request preparation handles history and tools. Native events reuse SSE types and existing accumulators. vLLM classifies request errors as 400 and unavailable engines as 503; internal diagnostics remain private. Supervision covers startup, cancellation, health failures, and cleanup; /ready follows pause/resume and storage health.

New modules

  • executor/inference/http/ and direct/: existing HTTP transport and injected native boundary with cancellation and event limits.
  • agentic-vllm: unpublished model recipe, runtime, request conversion, and native event conversion; uses vLLM's existing frontend and managed-engine libraries.
  • agentic-server-native: unpublished composition binary supervising the engine process group, including workers surviving launcher exit, and injecting its backend into the shared gateway.
  • Server startup/, server/direct.rs, and launcher agentic_process/server.rs: shared configuration, native gateway startup, and graceful child supervision. Published core/server crates remain independent of vLLM.
Type relationships
classDiagram
    ModelConfig --> ManagedEngineConfig
    ModelConfig --> VllmBackend
    Engine --> ManagedEngineConfig
    VllmBackend --> EngineCoreClient
    ExecutionContext o-- DirectInferenceBackend
    DirectInferenceBackend <|.. VllmBackend
    VllmBackend o-- ChatLlm
    ChatLlm --> EngineCoreClient
    DirectInferenceBackend --> EventFrame
    AgentPipeline *-- RoundIngestion
    RoundIngestion *-- ResponseAccumulator
    AgentPipeline *-- StreamRelay
    StreamRelay *-- GatewayStreamAccumulator
Loading

Test Plan

  • cargo test --workspace --no-fail-fast --locked --offline -- --test-threads=4: 3,283 passed, 25 ignored, no failures; all eight server lifecycle tests passed.
  • Focused agentic-server-native/agentic-vllm tests: 12 passed. Regression coverage checks Codex capability preservation, surviving worker cleanup, and native validation/unavailability error responses.
  • cargo clippy --workspace --all-targets --locked --offline -- -D warnings, formatting, pre-commit hooks, and mkdocs build --strict: passed.
  • Python tests: 131 passed, 3 wheel-specific tests skipped. Source-install CLI end-to-end test: passed for Codex and Claude HTTP sessions.
  • Coverage includes shared ingestion/continuation/compaction, native conversion, recipe/parser validation, backend selection, readiness/authentication, and process cleanup.

No provider recordings were changed: HTTP contracts are unchanged. Native startup tests use a local tokenizer and fake engine process; they do not establish GPU/model conformance.

Current limits

Direct mode supports one replica, text/plain reasoning, and function tools including core-lowered custom/shell tools; unsupported options fail before submission. Native binaries require a source build and matching pinned Python vLLM engine. Live GPU/model qualification remains outstanding. The engine client's internal unbounded queue prevents an end-to-end memory-bound claim.

franciscojavierarceo and others added 5 commits November 24, 2026 18:16
Split HTTP transport and injected direct inference beneath shared request
preparation, orchestration, sessions, compaction, and persistence. Reuse the
existing event types, response accumulator, tool translation, and usage handling.

Add an unpublished agentic-vllm adapter for model preparation and direct
EngineCore calls, with cancellation, limits, and focused integration coverage.
Document the supported profile and pending live-engine qualification.

Refs vllm-project#359, vllm-project#360.

Signed-off-by: maral <[email protected]>
Preserve the shared relay, steering, file resolution, and request normalization
while retaining the HTTP/direct inference split. Adapt native responses and
usage to current core types and cover steering at a completed native item.

Signed-off-by: maral <[email protected]>
Preserve gateway reasoning-summary capabilities in the Codex catalog so direct requests omit unsupported reasoning controls. Keep the native process group after its launcher exits and stop surviving workers during cleanup. Classify native admission failures using vLLM validation and availability checks while retaining error sources.

Signed-off-by: maral <[email protected]>
@maralbahari
maralbahari force-pushed the codex/shared-vllm-inference branch from b8dd6f8 to 17f2202 Compare November 24, 2026 10:17
@maralbahari
maralbahari marked this pull request as ready for review November 24, 2026 11:24
franciscojavierarceo and others added 3 commits November 25, 2026 21:26
Preserve the remote native streaming lifecycle fixes while integrating the request-path ownership refactor from main. Share typed round preparation across HTTP and direct inference, keep upstream headers on the pipeline, and remove superseded accumulator convenience APIs.

Signed-off-by: maral <[email protected]>
@franciscojavierarceo
franciscojavierarceo merged commit d4fcf64 into vllm-project:main Nov 27, 2026
17 checks passed
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.

2 participants