Add draft endpoint prototyping loop#4012
Draft
peterschmidt85 wants to merge 21 commits into
Draft
Conversation
added 17 commits
July 4, 2026 16:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What This PR Does
Adds a draft
endpointconfiguration type for model inference endpoints and an agent-driven prototyping loop.This is a draft PR for reviewing endpoint UX and the efficiency of the prototyping loop. The code is intentionally still subject to review and rewrite; the goal now is to validate whether the workflow, CLI surface, agent behavior, logs, model variant selection, and preset reuse model feel right before polishing internals.
Main pieces:
type: endpointwithmodel,preset_policy, and normal profile constraints such asfleets,backends,spot_policy, andmax_price.model_baseandmodel_reposo clients can call the base/API model while the service may load a selected repo/path.preset_policy: create/reuse-or-createwhen no usable preset is available.Preset mechanics and model variant selection are implemented and validated on initial e2e scenarios, but recipe quality, placement semantics, and optimization behavior still need broader testing.
How To Use
Start the server with the endpoint agent enabled:
export DSTACK_AGENT_ANTHROPIC_API_KEY=... uv run dstack server --port 3000For local development only, the server can use the existing Claude CLI login instead of
DSTACK_AGENT_ANTHROPIC_API_KEY:export DSTACK_AGENT_CLAUDE_USE_EXISTING_AUTH=1 uv run dstack server --port 3000Production servers must use
DSTACK_AGENT_ANTHROPIC_API_KEY. Do not setDSTACK_AGENT_CLAUDE_USE_EXISTING_AUTHtogether withDSTACK_AGENT_ANTHROPIC_API_KEY; the endpoint agent treats that as a configuration error.Optionally pass Claude CLI effort for endpoint agent sessions:
export DSTACK_AGENT_CLAUDE_EFFORT=highSupported values are
low,medium,high,xhigh, andmax. If unset, dstack does not pass--effortand Claude CLI uses its default.Create or select a project with at least one active fleet. Endpoint creation does not create fleets.
Exact model repo:
Exact model repo with a client-facing model name:
Base model request, where the agent may choose a compatible repo/path variant:
Apply it:
Watch endpoint progress:
Inspect the endpoint:
List learned presets:
Reuse a learned preset without running the agent:
Stop the endpoint:
Example
Representative e2e: deploy
Qwen/Qwen3.5-27Bon cheaper 48GB hardware instead of using A100-class capacity.Fleet used for the test:
Endpoint config:
Observed endpoint progress:
The same saved preset was then reused with
preset_policy: reuseand deployed directly without running the agent/prototyping task again.Backlog for v0 (WIP)
# Final Serviceand# Final Report.# Final Servicemust describe only the actual service YAML that the agent submits and verifies. It must not tell the agent to loosen resources before verification. Any broader resource envelope inferred from the tested run belongs tofinal_report.json/ preset-building logic, not to the service YAML that is being tested.HF_TOKEN; API/CLI JSON must not expose resolved secret values.message.reasoningwithmessage.content: null; this may be surprising for a generic model inference endpoint.Out Of Scope For V1
resourcesoverrides.Notes On Implementation
DSTACK_AGENT_ANTHROPIC_API_KEYand keeps Claude in--baremode.DSTACK_AGENT_CLAUDE_USE_EXISTING_AUTH=1is a local-development-only fallback. It is mutually exclusive withDSTACK_AGENT_ANTHROPIC_API_KEY; setting both is an endpoint agent configuration error.DSTACK_AGENT_CLAUDE_EFFORTpasses Claude CLI--effortfor endpoint agent sessions. If unset, Claude CLI uses its default.--bareso it can read the server user's existing Claude CLI auth and settings; the server logs a warning when this mode is used.HOME, and the agent installs workspace-localdstackandsshwrappers so dstack CLI config and SSH aliases still use the endpoint workspace home.os.killpg; this keeps the Windows pyright matrix clean without changing POSIX behavior.model: <string>is parsed as an exact repo/path request.model: {repo, name}deploysrepobut exposesnameto clients.model: {base}lets the agent choose a compatible deployed repo/path and stores that selected repo/path in the saved preset recipe.DSTACK_AGENT_ANTHROPIC_API_KEY.AI Assistance
This PR was developed with AI assistance from Codex.