Files
liqiang b119135836
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
ai-agent-book 精选快照(<2MB 代码与文档,来自 github.com/bojieli/ai-agent-book)
2026-08-20 13:12:50 +00:00

66 lines
1.6 KiB
Python

import uuid
from dataclasses import dataclass
from enum import Enum
from pydantic import BaseModel
from typing_extensions import Optional, Dict,Any
class SandboxStatus(Enum):
"""Sandbox status enumeration."""
INIT = 'Pending' # Initialization state
RUNNING = 'Running' # Running
STOPPED = 'Stopped' # Stopped
ERROR = 'Failed' # Error state
REMOVED = 'Removed' # Removed
UNKNOWN = 'Unknown' # Removed
class SandboxEnvType(Enum):
"""Sandbox env type enumeration."""
LOCAL = 1
K8S = 2
SUPERCOMPUTER = 3
@dataclass
class SandboxCreateResponse:
sandbox_id: str = str(uuid.uuid4())
env_type: int = SandboxEnvType.LOCAL
status: Optional[str] = None
mcp_config: Optional[Any] = None
@dataclass
class SandboxK8sResponse(SandboxCreateResponse):
pod_name: Optional[str] = None
service_name: Optional[str] = None
cluster_ip: Optional[str] = None
host: Optional[str] = None
@dataclass
class SandboxLocalResponse(SandboxCreateResponse):
host: Optional[str] = None
@dataclass
class SandboxSuperResponse(SandboxCreateResponse):
host: Optional[str] = None
@dataclass
class SandboxInfo:
"""Information about a sandbox."""
sandbox_id: str
"""Sandbox ID."""
status: str
"""sandbox status"""
metadata: Dict[str, str]
"""Saved sandbox metadata."""
class EnvConfig(BaseModel):
"""Data structure contained in the environment"""
name: str = "default"
version: str = "1.0.0"
dockerfile: Optional[str] = None #Dockerfile of the image required when creating the environment