Files
deepseek-harness/examples/python-sdk-agent/minimal.py
T
Tianyi Cui 79a8f667f7 refactor(python): launch the minimal example through sdk-minimal
Make minimal.py select the shipped sdk-minimal profile directly and pass its selected model into the profile-owned adapter catalog. The Python SDK still starts only the bundled dsh CLI with an explicit Harness home; it no longer supplies an invocation overlay for this mode.

Drive both the source keyless process test and installed-wheel smoke through the same named profile. The keyless test pins the generated profile manifest and exact two-tool model request, while the packaged smoke keeps the persistent-shell, editor, session-log, and model-visible snapshot evidence.

Delete minimal.patch.yml and the unused complete-config/replay fixtures. Their composition now has one owner in @deepseek-ai/dsh-sdk-minimal, so the example and tests cannot drift into separate launch trees.
2026-08-24 17:28:28 +08:00

50 lines
1.6 KiB
Python

#!/usr/bin/env python3
"""Run one minimal-agent turn through the bundled Python SDK runtime."""
from __future__ import annotations
import argparse
import os
from pathlib import Path
from deepseek_harness import DeepSeekHarness
def main() -> None:
"""Parse one task and print the agent's final response."""
parser = argparse.ArgumentParser()
configured_home = os.environ.get("DSH_HOME", "")
parser.add_argument("prompt", help="Task for the minimal agent")
parser.add_argument("--workspace", type=Path, default=Path.cwd())
parser.add_argument(
"--dsh-home",
type=Path,
default=Path(configured_home) if configured_home.strip() else None,
)
parser.add_argument("--profile", default="sdk-minimal")
parser.add_argument("--session-id")
parser.add_argument("--provider", default="deepseek-official")
parser.add_argument("--model", default=os.environ.get("DSH_MODEL", "deepseek-v4-flash"))
parser.add_argument("--max-tokens", type=int)
args = parser.parse_args()
if args.dsh_home is None:
parser.error("--dsh-home or a non-empty DSH_HOME is required")
workspace = args.workspace.resolve()
dsh_home = args.dsh_home.resolve()
with DeepSeekHarness(
provider=args.provider,
model=args.model,
max_tokens=args.max_tokens,
cwd=str(workspace),
dsh_home=str(dsh_home),
profile=args.profile,
env={"DSH_MODEL": args.model},
) as harness:
result = harness.run(args.prompt, session_id=args.session_id)
print(result.final_response)
if __name__ == "__main__":
main()