mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 13:53:15 +00:00
* feat: move github workflows to gh cli Use LangSmith proxy auth to support gh-driven GitHub workflows while removing custom GitHub wrapper tools. * docker ignore + snapshot and docker image updates * updated image and instructions * removing open_pr if needed after agent call
47 lines
1.4 KiB
Python
47 lines
1.4 KiB
Python
"""Create a LangSmith sandbox snapshot for open-swe."""
|
|
|
|
import argparse
|
|
import os
|
|
|
|
from langsmith.sandbox import SandboxClient
|
|
|
|
DEFAULT_IMAGE = "johanneslangchain/open-swe-sandbox:gh-cli-amd64"
|
|
DEFAULT_FS_CAPACITY = 32 * 1024**3 # 32 GiB
|
|
|
|
|
|
def main() -> None:
|
|
parser = argparse.ArgumentParser(description="Create a LangSmith sandbox snapshot")
|
|
parser.add_argument(
|
|
"--name", default="open-swe-gh-amd64", help="Snapshot name (default: open-swe-gh-amd64)"
|
|
)
|
|
parser.add_argument(
|
|
"--image", default=DEFAULT_IMAGE, help=f"Docker image (default: {DEFAULT_IMAGE})"
|
|
)
|
|
parser.add_argument(
|
|
"--fs-capacity",
|
|
type=int,
|
|
default=DEFAULT_FS_CAPACITY,
|
|
help="FS capacity in bytes (default: 32 GiB)",
|
|
)
|
|
parser.add_argument(
|
|
"--api-key",
|
|
default=os.environ.get("LANGSMITH_API_KEY") or os.environ.get("LANGSMITH_API_KEY_PROD"),
|
|
help="LangSmith API key",
|
|
)
|
|
args = parser.parse_args()
|
|
|
|
if not args.api_key:
|
|
raise SystemExit("Set LANGSMITH_API_KEY or pass --api-key")
|
|
|
|
client = SandboxClient(api_key=args.api_key)
|
|
snapshot = client.create_snapshot(
|
|
name=args.name,
|
|
docker_image=args.image,
|
|
fs_capacity_bytes=args.fs_capacity,
|
|
)
|
|
print(f"Snapshot created: {snapshot.id}")
|
|
print(f"\nAdd to your .env:\n DEFAULT_SANDBOX_SNAPSHOT_ID={snapshot.id}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|