[Draft PR ] Agent harness MVP#3991
Closed
Bihan wants to merge 3 commits into
Closed
Conversation
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.
Endpoint harness
The endpoint harness powers
dstack endpoint create.It uses an LLM to generate a
type: serviceconfiguration,then deploys it through the same code path as
dstack apply.You describe what to deploy (model, GPU, backends, and other profile options). The harness:
commands)The harness does not pick cloud offers or provision instances. dstack's scheduler
does that after submission, the same way it does for a hand-written service config.
Quick start
DSTACK_HARNESS_MODELis optional. If unset, the harness defaults toclaude-sonnet-4-6for Anthropic.
!!! note "
--max-attempts"Controls how many times the harness tries to deploy the endpoint. If the container
fails to start, it stops the run, asks the LLM to fix the configuration from the
error logs, and redeploys. Default is
3. Set--max-attempts 1for a singleattempt with no retries.
The command accepts the same resource and profile flags as
dstack applyfor services (
--gpu,--cpu,--memory,--disk,--backend,--region,--fleet,--max-price,--spot-policy, and others). Rundstack endpoint create --helpfor the full list.How it works
flowchart TD A[dstack endpoint create] --> B[Build EndpointCreateParams from CLI] B --> C["LLM: generate service YAML"] C --> D[Validate with parse_apply_configuration] D --> E[Apply CLI overrides via ServiceConfigurator] E --> F["Save to .dstack-harness-configs/"] F --> I[ServiceConfigurator.apply_configuration] I --> M[Monitor container logs] M --> N{Ready?} N -->|yes| O[Print service URLs] N -->|failed| P[Stop run] P --> Q["LLM: fix YAML from error logs"] Q --> R{attempts left?} R -->|yes| I R -->|no| S[Give up]Orchestration is programmatic (Python via
ServiceConfigurator), not LLM-generateddstackshell commands. The LLM only authors the service configuration and containercommandsthat run on the GPU instance.Relationship to
skills/dstack/SKILL.mdOn every LLM call, the harness loads
skills/dstack/SKILL.mdand appends it to the systemprompt.
Prompts Sent to LLM
Call 1: Generate configuration
Fixed prefix:
CLI options:
Call 2: Fix configuration
Fixed prefix:
Error logs: