Python SDK for the Plato API
Project description
Plato Python SDK
Python SDK for the Plato platform.
Installation
pip install plato-sdk-v2
# For agent functionality (requires Python 3.12+)
pip install 'plato-sdk-v2[agents]'
Or with uv:
uv add plato-sdk-v2
uv add 'plato-sdk-v2[agents]' # for agent support
Configuration
Create a .env file in your project root:
PLATO_API_KEY=your-api-key
PLATO_BASE_URL=https://plato.so # optional, defaults to https://plato.so
Or set environment variables directly:
export PLATO_API_KEY=your-api-key
Agents
Agents run inside Plato VMs. The first-party agent is computer-use (browser
automation, install: pip install plato-agent-computer-use); custom agents
subclass plato.agents.BaseAgent.
Python Usage
from plato.agents import BaseAgent, AgentTask, run_agent, get_agent_schema, AGENT_SCHEMAS
# List available agent config schemas
print(list(AGENT_SCHEMAS.keys()))
CLI Usage
# List available agents
plato agent list
# Get agent config schema
plato agent schema computer-use
# Publish a custom agent to Plato PyPI
plato agent publish ./my-agent
Agent Schemas
Get configuration schemas for any agent:
from plato.agents import get_agent_schema, AGENT_SCHEMAS
# Get schema for specific agent
schema = get_agent_schema("claude-code")
print(schema)
# List all available schemas
print(list(AGENT_SCHEMAS.keys()))
Custom Agents
Create a custom agent by subclassing plato.agents.BaseAgent (see
plato/agents/base.py for the interface).
Publish to Plato PyPI:
plato agent publish ./my-agent-package
Sessions & Environments
Flow 1: Create Session from Environments
Use this when you want to spin up environments for development, testing, or custom automation.
import asyncio
from plato.v2 import AsyncPlato, Env
async def main():
plato = AsyncPlato()
# Create session with one or more environments
# (heartbeat starts automatically to keep session alive)
session = await plato.sessions.create(
envs=[
Env.simulator("gitea", dataset="blank", alias="gitea"),
Env.simulator("kanboard", alias="kanboard"),
],
timeout=600,
)
# Reset environments to initial state
await session.reset()
# Get public URLs for browser access
public_urls = await session.get_public_url()
for alias, url in public_urls.items():
print(f"{alias}: {url}")
# Get state mutations from all environments
state = await session.get_state()
print(state)
# Cleanup
await session.close()
await plato.close()
asyncio.run(main())
Flow 2: Create Session from Task
Use this when running evaluations against predefined tasks. This flow includes task evaluation at the end.
import asyncio
from plato.v2 import AsyncPlato
async def main():
plato = AsyncPlato()
# Create session from task ID
session = await plato.sessions.create(task=123, timeout=600)
# Reset environments to initial state
await session.reset()
# Get public URLs for browser access
public_urls = await session.get_public_url()
for alias, url in public_urls.items():
print(f"{alias}: {url}")
# Evaluate task completion
evaluation = await session.evaluate()
print(f"Task completed: {evaluation}")
# Cleanup
await session.close()
await plato.close()
asyncio.run(main())
Environment Configuration
Two ways to specify environments:
from plato.v2 import Env
# 1. From simulator (most common)
Env.simulator("gitea") # default tag
Env.simulator("gitea", tag="staging") # specific tag
Env.simulator("gitea", dataset="blank") # specific dataset
Env.simulator("gitea", alias="my-git") # custom alias
# 2. From artifact ID
Env.artifact("artifact-abc123")
Env.artifact("artifact-abc123", alias="my-env")
Per-Environment Operations
Access individual environments within a session:
# Get all environments
for env in session.envs:
print(f"{env.alias}: {env.job_id}")
# Get specific environment by alias
gitea = session.get_env("gitea")
if gitea:
# Execute shell command
result = await gitea.execute("whoami", timeout=30)
print(result)
# Get state for this environment only
state = await gitea.get_state()
# Reset this environment only
await gitea.reset()
Sync Client
A synchronous client is also available:
from plato.v2 import Plato, Env
plato = Plato()
session = plato.sessions.create(
envs=[Env.simulator("gitea", alias="gitea")],
timeout=600,
)
session.reset()
public_urls = session.get_public_url()
state = session.get_state()
session.close()
plato.close()
Architecture
plato/
├── agents/ # Agent SDK (BaseAgent, AgentTask, run_agent) + schemas
├── sims/ # Simulator clients (Spree, Firefly, etc.)
├── world/ # World/environment abstractions
├── v1/ # Legacy SDK + CLI
└── v2/ # New API client
Documentation
- Generating Simulator SDKs - How to create API clients for simulators
- Building Simulators - Internal docs for snapshotting simulators
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 plato_sdk_v2-2.107.0.tar.gz.
File metadata
- Download URL: plato_sdk_v2-2.107.0.tar.gz
- Upload date:
- Size: 1.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21c0118b23b597a67b7d287fc994702235ff0298a9f3aa8808698191b83bbb4a
|
|
| MD5 |
af4defce6ffd87fe291bf228bd96fd98
|
|
| BLAKE2b-256 |
2e46d2e456389ee54214efba87936810cad6d9fe6ca0e2ba022fba65cfc91c2a
|
File details
Details for the file plato_sdk_v2-2.107.0-py3-none-any.whl.
File metadata
- Download URL: plato_sdk_v2-2.107.0-py3-none-any.whl
- Upload date:
- Size: 1.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb60b6114bd6aed1825ed31c7cdfa9030b2961a0bbabaf0281428e1d9fe2ca2e
|
|
| MD5 |
befe242b2124e1c7550bf53749aca3c9
|
|
| BLAKE2b-256 |
31d3082c1ed1fd0a2b9cec92889263744e583d64fe6ceca8e80020740e1a038a
|