WyseOS
首页Python SDK用户手册
WyseOS

Introduction

📖 文档📜 核心概念

Users

📋 用户手册

Developers

🚀 Python SDK
📋 安装指南✨ 快速开始🔑 身份验证🐍 示例⚙️ 发布说明🔌 API 参考🔧 故障排除

Changelogs

Others

联系我们
🚀 Python SDK

🔌 API 参考

本页记录 v0.3.1 当前 Python SDK 的实际 API 结构。

Client

Client 是主入口。

from wyseos.mate import Client, ClientOptions
from wyseos.mate.config import load_config

client = Client(load_config("mate.yaml"))
# 或
client = Client(ClientOptions(api_key="YOUR_API_KEY"))

ClientOptions

字段类型必填默认值
api_keyOptional[str]否None
jwt_tokenOptional[str]否None
base_urlstr否https://api.wyseos.com
timeoutint否30

说明:

  • base_url 必须以 http:// 或 https:// 开头。
  • timeout 范围是 1-300。
  • api_key 和 jwt_token 任选其一配置。

Client 上的服务

  • client.user
  • client.team
  • client.agent
  • client.session
  • client.browser
  • client.file_upload
  • client.marketing
  • client.product

Session API

通过 client.session 访问。

方法

  • create(request: CreateSessionRequest) -> CreateSessionResponse
  • get_info(session_id: str) -> SessionInfo
  • get_messages(session_id: str, page_num: int = 1, page_size: int = 20, filter: Optional[MessageFilter] = None) -> GetMessagesResponse
  • get_between_messages(session_id: str, from_message_id: str, to_message_id: str) -> GetMessagesResponse
  • get_marketing_data(session_id: str, type: Optional[str] = None) -> Dict[str, Any]
  • update_session_name(request: UpdateSessionNameRequest) -> None

CreateSessionRequest

from wyseos.mate.models import CreateSessionRequest

req = CreateSessionRequest(
    task="Draft a Twitter launch campaign for my product",
    mode="marketing",      # optional
    platform="api",        # optional
    extra={                 # optional
        "marketing_product": {"product_id": "prod_123"}
    },
)

字段:

  • task: str(必填)
  • intent_id: Optional[str]
  • mode: Optional[str]
  • platform: Optional[str]
  • extra: Optional[Dict[str, Any]]

TaskRunner API

通过包级工厂函数创建 TaskRunner:

from wyseos.mate import create_task_runner
from wyseos.mate.websocket import WebSocketClient

ws_client = WebSocketClient(
    base_url=client.base_url,
    api_key=client.api_key or "",
    jwt_token=client.jwt_token or "",
    session_id=session_info.session_id,
)

task_runner = create_task_runner(ws_client, client, session_info)

TaskMode

  • TaskMode.Default
  • TaskMode.DeepSearch
  • TaskMode.Marketing

TaskExecutionOptions

字段类型默认值
verboseboolFalse
auto_accept_planboolTrue
capture_screenshotsboolFalse
enable_browser_loggingboolTrue
enable_event_loggingOptional[bool]None
completion_timeoutint300
max_user_input_timeoutint0
stop_on_x_confirmboolFalse

TaskRunner 方法

run_task(
    task: str,
    attachments: List[Dict] = None,
    task_mode: TaskMode = TaskMode.Default,
    extra: Optional[Dict[str, Any]] = None,
    options: TaskExecutionOptions = None,
) -> TaskResult
run_interactive_session(
    initial_task: str,
    attachments: List[Dict] = None,
    task_mode: TaskMode = TaskMode.Default,
    extra: Optional[Dict[str, Any]] = None,
    options: TaskExecutionOptions = None,
) -> None

TaskResult

  • success: bool
  • final_answer: str
  • error: Optional[str]
  • screenshots: List[Dict[str, Any]]
  • execution_logs: List[Dict[str, Any]]
  • plan_history: List[Dict[str, Any]]
  • session_duration: float
  • message_count: int

Product API

通过 client.product 访问。

方法

  • create(req: CreateProductRequest) -> CreateProductResponse
  • get_info(product_id: str) -> ProductInfo
  • get_report(report_id: str) -> ProductReport
  • get_categories() -> List[Industry]
  • create_and_wait(product: str, attachments: Optional[List[Dict[str, str]]] = None, poll_interval: int = 20, max_attempts: int = 30, on_poll: Optional[Callable[[int, str], None]] = None) -> ProductReport

CreateProductRequest

  • product: str
  • attachments: List[ProductAttachment]

ProductAttachment:

  • file_name: str
  • file_url: str

Marketing API

通过 client.marketing 访问。

  • update_report(report_id: str, data: Dict[str, Any]) -> Dict[str, Any]
  • get_research_tweets(query_id: str) -> Any

会话级营销内容查询:

  • client.session.get_marketing_data(session_id, type="reply"|"like"|"retweet"|"tweet")

文件上传 API

通过 client.file_upload 访问。

  • upload_file(file_path: str, session_id: Optional[str] = None) -> Dict[str, Any]

支持扩展名:

  • .txt, .pdf, .png, .jpg, .jpeg, .md, .csv, .html, .htm, .rss, .xml, .gif, .py, .json

最大文件大小:10MB。

分页模型

  • ListOptions(page_num: int = 1, page_size: int = 20)
  • PaginatedResponse[T] 字段:page_num、page_size、total、total_page、data

⚙️ 发布说明

上一页

🔧 故障排除

下一页

目录

Client
ClientOptions
Client 上的服务
Session API
方法
CreateSessionRequest
TaskRunner API
TaskMode
TaskExecutionOptions
TaskRunner 方法
TaskResult
Product API
方法
CreateProductRequest
Marketing API
文件上传 API
分页模型