β¨ Getting Started
This guide provides a comprehensive walkthrough for configuring and using the WyseOS Python SDK.
By following these steps, you'll be ready to integrate with the WyseOS platform quickly.
π¦ New to the SDK? Start with our Installation Guide to set up your development environment.
βοΈ Initial Configuration
After installing the SDK, the next crucial step is to configure your API credentials to enable communication with the WyseOS platform. For detailed instructions on obtaining and managing your API key, please refer to the Authentication guide.
Preferred Method: mate.yaml Configuration File
Storing your API key in a configuration file is the most secure and recommended approach, keeping sensitive information out of your codebase. Create a file named mate.yaml in your project's root directory with the following structure:
api_key: "your-api-key-here"
base_url: "https://api.wyseos.com"
timeout: 30| Field | Type | Description | Default Value |
|---|---|---|---|
api_key | string | Your unique API key obtained from the WyseOS dashboard. Required. | (None) |
base_url | string | The base URL for the WyseOS API. | https://api.wyseos.com |
timeout | integer | The maximum time in seconds for API requests to respond. | 30 |
To load this configuration in your Python application:
from wyseos.mate import Client
from wyseos.mate.config import load_config
config = load_config()
if config:
client = Client(config)
else:
print("Warning: mate.yaml not found. Consider creating one for production.")
# Fallback to manual configuration (replace with your actual API key)
from wyseos.mate import ClientOptions
client = Client(ClientOptions(api_key="YOUR_API_KEY"))Alternative: In-Code Configuration
While less ideal for production due to embedding credentials in code, you can also configure the client directly within your Python script using ClientOptions.
from wyseos.mate import Client, ClientOptions
client = Client(ClientOptions(
api_key="YOUR_API_KEY", # Replace with your actual API key
base_url="https://api.wyseos.com",
timeout=30,
))Loading from a Custom Configuration Path
If your mate.yaml file is located at a non-standard path, specify its location directly:
from wyseos.mate import Client
from wyseos.mate.config import load_config
# Replace with the actual path to your custom config file
custom_config_path = "path/to/your/custom-mate.yaml"
config = load_config(custom_config_path)
client = Client(config)β‘ 30-Second Quick Start
Experience the power of v0.2.1's TaskRunner interface with this minimal example:
from wyseos.mate import Client
from wyseos.mate.config import load_config
from wyseos.mate.models import CreateSessionRequest
from wyseos.mate.websocket import WebSocketClient, TaskExecutionOptions
# Initialize client and create session
config = load_config()
client = Client(config)
session = client.session.create(CreateSessionRequest(team_id="wyse_mate", task="Quick test"))
# π― TaskRunner magic - just 3 lines!
ws_client = WebSocketClient(base_url=client.base_url, api_key=client.api_key, session_id=session.session_id)
task_runner = ws_client.create_task_runner(client, session)
result = task_runner.run_task("Analyze current market trends", "wyse_mate")
if result.success:
print(f"β
Task completed in {result.session_duration:.1f}s: {result.final_answer}")
else:
print(f"β Task failed: {result.error}")π Next Steps
With the SDK installed and configured, you're ready to start building! Head over to the Examples section for practical code snippets, or dive deeper into the API functionalities in the References.