Official Python SDK for the CUBE AI Agent Marketplace
Project description
cube-ai-sdk
Python SDK for the CUBE AI Agent Marketplace.
Installation
pip install cube-ai-sdk
The importable module is cube_sdk:
from cube_sdk import CubeClient
Quick Start
from cube_sdk import CubeClient
client = CubeClient(api_key="cube_...", base_url="https://api.cube.bot")
Execute an agent
response = client.agents.execute("agent-id", query="Summarize this report")
print(response["answer"])
print(response["conversation_id"]) # use for multi-turn conversations
Multi-turn conversation
r1 = client.agents.execute("agent-id", query="What is CUBE?")
r2 = client.agents.execute(
"agent-id",
query="Tell me more",
conversation_id=r1["conversation_id"],
)
Streaming
for event in client.agents.stream("agent-id", query="Write a poem"):
if event["type"] == "token":
print(event["content"], end="", flush=True)
print()
Agent specifications
specs = client.agents.specs("agent-id")
print(specs["llm_model"])
print(specs["skills"])
Environments
Three execution environments are supported:
"cube_cloud"(default) -- production on CUBE infrastructure"sandbox"-- free testing with limited quotas"byok"-- bring your own LLM key
response = client.agents.execute(
"agent-id",
query="Hello",
environment="sandbox",
)
BYOK (Bring Your Own Key)
response = client.agents.execute(
"agent-id",
query="Hello",
environment="byok",
llm_api_key="sk-...",
)
Error Handling
from cube_sdk import CubeClient, AuthenticationError, RateLimitError, CubeAPIError
client = CubeClient(api_key="cube_...")
try:
response = client.agents.execute("agent-id", query="Hello")
except AuthenticationError:
print("Invalid API key")
except RateLimitError as e:
print(f"Rate limited. Retry after {e.retry_after}s")
except CubeAPIError as e:
print(f"API error {e.status_code}: {e.detail}")
Resource Management
# Context manager (recommended)
with CubeClient(api_key="cube_...") as client:
response = client.agents.execute("agent-id", query="Hello")
# Manual cleanup
client = CubeClient(api_key="cube_...")
try:
response = client.agents.execute("agent-id", query="Hello")
finally:
client.close()
Marketplace Skills
CUBE agents can integrate with four marketplaces that use buyer-supplied credentials:
ozon-- Ozon seller: products, prices, stocks, orders, reviews, analyticswildberries-- Wildberries seller: cards, prices, stocks, FBS orders, feedbacks, questions, salesdigiseller-- Plati.market / Digiseller: catalog, sales, buyer messagesyandex_direct-- Yandex Direct ads (per-user OAuth): campaigns, ads, negatives, async reports
Credentials aren't passed through the SDK -- buyers connect them once in
Settings -> Marketplaces on their CUBE account and the platform injects them
at runtime. Use client.agents.specs(id) and check specs["skills"] to detect
which integrations an agent needs.
See the Marketplace Skills reference for per-action parameters and gotchas.
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 cube_ai_sdk-0.1.2.tar.gz.
File metadata
- Download URL: cube_ai_sdk-0.1.2.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
724ad00e0d95618f4d33d88e4330197ad73778655a4e77032f19ed22e9e4567f
|
|
| MD5 |
7af0976a6d500850d9808a7478cd48b2
|
|
| BLAKE2b-256 |
888cdaccb9bf6cabc550338798dea5eb2d6e7ae0bbf9fc8be61eccacd5b7c18d
|
File details
Details for the file cube_ai_sdk-0.1.2-py3-none-any.whl.
File metadata
- Download URL: cube_ai_sdk-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36fec923fdd858f7ec71e6c58ecedc7981cc5904bd30beb96c6cc09c3d3a24ce
|
|
| MD5 |
eb51b458f4c3a057f75830518c26ade6
|
|
| BLAKE2b-256 |
7f72dc055d5d82d3dabf6c2db9a3498adfd03be0a35dbcdcfa899a9d73a1595d
|