Spaces:
Runtime error
Runtime error
| from typing import Dict, Optional | |
| from pydantic import BaseModel | |
| class AgentInfo(BaseModel): | |
| """ | |
| 表示一个 Agent 实例的信息。 | |
| """ | |
| id: str | |
| agent_type: str | |
| mcp_endpoint: str # MCP 服务的访问地址 (e.g., "http://localhost:8001") | |
| status: str = "running" # Agent 的状态 (e.g., "running", "stopped", "error") | |
| created_at: str | |
| last_heartbeat: str | |
| metadata: Dict = {} # 存储其他元数据,如资源使用情况、版本等 | |
| class CreateAgentRequest(BaseModel): | |
| """ | |
| 创建 Agent 实例的请求模型。 | |
| """ | |
| agent_type: str | |
| image_name: str # Docker 镜像名称 (e.g., "my-echo-agent:latest") | |
| env_vars: Dict[str, str] = {} # 环境变量字典 | |
| resource_limits: Dict = {} # 资源限制 (e.g., {"cpu": "0.5", "memory": "512m"}) | |
| config: Dict = {} # Agent 自身的配置信息 | |
| class AgentUpdateRequest(BaseModel): | |
| """ | |
| 更新 Agent 实例信息的请求模型。 | |
| """ | |
| status: Optional[str] = None | |
| mcp_endpoint: Optional[str] = None | |
| last_heartbeat: Optional[str] = None | |
| metadata: Optional[Dict] = None | |