minimal.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/usr/bin/env python3
  2. """Run one minimal-agent turn through the bundled Python SDK runtime."""
  3. from __future__ import annotations
  4. import argparse
  5. import os
  6. from pathlib import Path
  7. from deepseek_harness import DeepSeekHarness
  8. PATCH = Path(__file__).with_name("minimal.patch.yml")
  9. def main() -> None:
  10. """Parse one task and print the agent's final response."""
  11. parser = argparse.ArgumentParser()
  12. configured_home = os.environ.get("DSH_HOME", "")
  13. parser.add_argument("prompt", help="Task for the minimal agent")
  14. parser.add_argument("--workspace", type=Path, default=Path.cwd())
  15. parser.add_argument(
  16. "--dsh-home",
  17. type=Path,
  18. default=Path(configured_home) if configured_home.strip() else None,
  19. )
  20. parser.add_argument("--profile", default="sdk")
  21. parser.add_argument("--session-id")
  22. parser.add_argument("--provider", default="deepseek-official")
  23. parser.add_argument("--model", default=os.environ.get("DSH_MODEL", "deepseek-v4-flash"))
  24. parser.add_argument("--max-tokens", type=int)
  25. args = parser.parse_args()
  26. if args.dsh_home is None:
  27. parser.error("--dsh-home or a non-empty DSH_HOME is required")
  28. workspace = args.workspace.resolve()
  29. dsh_home = args.dsh_home.resolve()
  30. with DeepSeekHarness(
  31. provider=args.provider,
  32. model=args.model,
  33. max_tokens=args.max_tokens,
  34. cwd=str(workspace),
  35. dsh_home=str(dsh_home),
  36. profile=args.profile,
  37. patches=(str(PATCH.resolve()),),
  38. ) as harness:
  39. result = harness.run(args.prompt, session_id=args.session_id)
  40. print(result.final_response)
  41. if __name__ == "__main__":
  42. main()