mirror of
https://github.com/NVIDIA/OpenShell.git
synced 2026-10-16 05:20:22 +08:00
Extend python/openshell/ with the verbs needed to express the multi-agent-notepad flow entirely in Python: - ProviderClient (create/get/list/delete); credentials_from_env resolves env var names to mirror the CLI's --credential flag. - policy_from_yaml() loads the CLI's YAML format into a SandboxPolicy proto. Lazy-imports PyYAML, added to runtime deps. - SandboxClient.upload() gzip-tars the source and pipes the tarball over ExecSandbox(stdin=...) to 'tar xzf -'. No paramiko dependency. - SandboxClient.create() gains friendly kwargs (name, image, providers, policy, environment, gpu, labels) alongside the existing spec= path. architecture/python-sdk.md documents the design principle (mirror CLI verbs, not raw protos), the public surface, and what's out of scope (image build, gateway bootstrap, draft policy, port-forward, RelayStream). examples/multi-agent-notepad/notebook.ipynb is a Python equivalent of demo.sh: env validation, policy render, provider creation, parallel worker sandboxes via ThreadPoolExecutor, synthesis sandbox, cleanup. 13 new unit tests; all 23 sandbox tests pass; ruff/ty/markdownlint clean.
47 lines
942 B
Python
47 lines
942 B
Python
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
"""OpenShell - Agent execution and management SDK."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from .sandbox import (
|
|
ClusterInferenceConfig,
|
|
ExecChunk,
|
|
ExecResult,
|
|
InferenceRouteClient,
|
|
ProviderClient,
|
|
ProviderRef,
|
|
Sandbox,
|
|
SandboxClient,
|
|
SandboxError,
|
|
SandboxRef,
|
|
SandboxSession,
|
|
TlsConfig,
|
|
policy_from_yaml,
|
|
)
|
|
|
|
try:
|
|
from importlib.metadata import version
|
|
|
|
__version__ = version("openshell")
|
|
except Exception:
|
|
__version__ = "0.0.0"
|
|
|
|
__all__ = [
|
|
"ClusterInferenceConfig",
|
|
"ExecChunk",
|
|
"ExecResult",
|
|
"InferenceRouteClient",
|
|
"ProviderClient",
|
|
"ProviderRef",
|
|
"Sandbox",
|
|
"SandboxClient",
|
|
"SandboxError",
|
|
"SandboxRef",
|
|
"SandboxSession",
|
|
"TlsConfig",
|
|
"__version__",
|
|
"policy_from_yaml",
|
|
]
|