Python SDK for OctoEvo
Project description
OctoEvo SDK for Python
Python SDK for OctoEvo agent sessions, marketing execution, and product analysis.
Features
- HTTP client for sessions, products, files, users, teams, agents, and marketing APIs
- WebSocket
TaskRunnerfor interactive and automated agent sessions - Marketing tasks default to
execution_mode="auto"so the backend chooses the correct execution channel - Structured handling for X authorization, X account selection, and browser extension requirements
- Product analysis workflow with create, poll, and report APIs
- API key and JWT authentication
Requirements
- Python 3.9+
- An OctoEvo
api_keyorjwt_token
Installation
pip install octoevo
For environment-specific setup, see installation.md.
Configuration
Create mate.yaml:
mate:
api_key: "your-api-key"
# jwt_token: "your-jwt-token"
base_url: "https://api.dev.weclaw.ai"
timeout: 30
Initialize a client:
from octoevo.mate import Client
from octoevo.mate.config import load_config
client = Client(load_config("mate.yaml"))
Never commit real credentials. Use local config files, environment secret storage, or CI secrets.
Quick Start: Marketing Session
Use run_interactive_session() for marketing tasks that may require user input, X authorization, X account selection, or browser extension connection.
from octoevo.mate import Client, create_task_runner
from octoevo.mate.config import load_config
from octoevo.mate.models import CreateSessionRequest
from octoevo.mate.task_runner import TaskExecutionOptions, TaskMode
from octoevo.mate.websocket import WebSocketClient
client = Client(load_config("mate.yaml"))
req = CreateSessionRequest(
task="Draft a launch thread for my product",
mode="marketing",
platform="api",
extra={"marketing_product": {"product_id": "prod_123"}},
)
session = client.session.create(req)
session_info = client.session.get_info(session.session_id)
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,
)
runner = create_task_runner(ws_client, client, session_info)
runner.run_interactive_session(
initial_task="Generate 3 tweet drafts and recommended replies",
task_mode=TaskMode.Marketing,
extra=req.extra,
options=TaskExecutionOptions(
auto_accept_plan=False,
verbose=True,
stop_on_x_confirm=True,
completion_timeout=600,
),
)
Marketing tasks default to execution_mode="auto" in TaskRunner. Do not pass external_user_id or external_username; the agent selects the execution channel and asks for required input only when needed.
Structured prompts handled by the SDK:
| Prompt | Meaning |
|---|---|
x_api_authorize |
X API authorization is required |
x_api_account_select |
Multiple X accounts are connected and one must be selected |
extension_required |
The browser extension is required for the current action |
Use stop_on_x_confirm=True for CLI-safe runs. Set it to False only when your app should confirm live social actions automatically.
Read generated marketing data:
tweet_data = client.session.get_marketing_data(session.session_id, type="tweet")
reply_data = client.session.get_marketing_data(session.session_id, type="reply")
Runnable example: examples/getting_started/example.py
Product Analysis
Product analysis is HTTP-only. It does not use WebSocket or TaskRunner.
from octoevo.mate import Client
from octoevo.mate.config import load_config
client = Client(load_config("mate.yaml"))
report = client.product.create_and_wait(
product="Notion",
attachments=None,
on_poll=lambda attempt, status: print(f"[poll {attempt}] {status}"),
)
print(report.report_id)
print(report.product_name)
print(report.keywords)
print(report.competitors)
For attachments, upload files first:
upload = client.file_upload.upload_file("brief.pdf")
attachments = [{"file_name": upload["file_name"], "file_url": upload["file_url"]}]
report = client.product.create_and_wait(
product="Notion",
attachments=attachments,
)
Runnable example: examples/product_analysis/example.py
Account Bootstrap
These helpers are standalone account flows. They are not required inside normal marketing task execution.
from octoevo.mate import Client, ClientOptions
client = Client(ClientOptions())
email_resp = client.user.start_email_verification(
email="you@example.com",
invite_code=None,
)
print(email_resp.sign_type, email_resp.pre_auth_id)
x_login = client.user.get_x_oauth_url()
print(x_login.auth_url)
Low-level X connector management requires an authenticated client:
accounts = client.user.list_x_accounts()
auth = client.user.authorize_x_account(target_connector_id=None)
print(len(accounts.items), auth.auth_url)
client.user.delete_x_account("connector-id")
Use connector APIs only for account administration. Do not use them to choose a task execution account; run_interactive_session() handles task-time authorization and account selection.
Runnable examples:
Task Runner API
Create a task runner with:
runner = create_task_runner(ws_client, client, session_info)
Main methods:
run_interactive_session(initial_task, attachments=None, task_mode=TaskMode.Default, extra=None, options=None)run_task(task, attachments=None, task_mode=TaskMode.Default, extra=None, options=None) -> TaskResult
Prefer run_interactive_session() for marketing tasks. Non-interactive run_task() fails safely when authorization, account selection, or browser extension connection is required.
Common options:
verbose: print progress to stdoutauto_accept_plan: auto-approve plan messagesstop_on_x_confirm: stop instead of confirming social actionscompletion_timeout: maximum run time in seconds
Services
client.session: create sessions, stop sessions, read messages, read marketing dataclient.product: create product analysis jobs, poll status, read reports, read categoriesclient.file_upload: upload files for attachmentsclient.user: account bootstrap, API keys, X connector managementclient.marketing: marketing dashboard APIsclient.team,client.agent,client.browser: supporting APIs
Error Types
APIErrorNetworkErrorWebSocketErrorConfigErrorSessionExecutionError
Documentation
- Quick start: examples/quickstart.md
- Installation: installation.md
- Marketing example: examples/getting_started/example.py
- Product analysis example: examples/product_analysis/example.py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file octoevo-0.1.7.tar.gz.
File metadata
- Download URL: octoevo-0.1.7.tar.gz
- Upload date:
- Size: 42.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
075cc93e7194d3412275108f51d3a33b2e0cbb78ad65e355728485f058fce3d3
|
|
| MD5 |
fd28662b4162b424b7e8da7199091fbd
|
|
| BLAKE2b-256 |
afc091b21b916337e95b6ae987d6ebfe17e9576e30adce463cbe277ecc096243
|
File details
Details for the file octoevo-0.1.7-py3-none-any.whl.
File metadata
- Download URL: octoevo-0.1.7-py3-none-any.whl
- Upload date:
- Size: 48.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f65dfda66d08d5f325f2decb751ea1e2bc35447a9774e9bf0b464f0c5a1ca4b2
|
|
| MD5 |
1d3634e5417e3994e6dc41f7639873a0
|
|
| BLAKE2b-256 |
475b42436e21169d0400c9fe6138e5b0da92b84ccb2b3fa105b08877720cc3d5
|