Files
OpenShell/python/openshell/__init__.py
Max Dubrinsky e07b4a2a7c feat(python-sdk): add provider/policy/upload helpers and demo notebook
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.
2026-05-11 20:50:34 -04:00

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",
]