Getting Started

This page outlines upcoming features on how to build and run desktop AI agents seamlessly within ToyStack's virtual operating system. These features are currently under development and not yet live.

Deploy your instance

Step-1

Generate API key

Sign up on our dashboard. An API key will be generated for you automatically.

Step-2

Install SDK

Install the Python SDK with pip.

pip install toystack-virtual-os

Step-3

Configure client

Configure the client with your API key.

from toystack import ToystackVirtualOs

client = ToystackVirtualOs(api_key="your_api_key")

Step-4

Start instance of virtual os

instance = client.start(instance_type="virtual_os" )

Interact with the Instance

You can interact with your ToyStack Virtual OS instance using various tools such as screenshot, bash, computer, and edit. Below are examples of how to perform common actions:

# Get the status of the instance
status = instance.get_status()

# Get the streaming URL for interacting with the instance
stream_url = instance.get_stream_url()

# Capture a screenshot of the current instance view
base_64_image = instance.screenshot()

# Move the mouse cursor to specific coordinates
result = instance.computer(
    action="mouse_move",
    coordinate=[200, 100]
)

# Perform a left-click action
result = instance.computer(
    action="left_click"
)

# Execute a bash command within the instance
result = instance.bash(
    command="ls -la"
)

Integrate with Claude (Optional)

You can optionally connect Claude Computer Use to your ToyStack Virtual OS instance using BashTool, ComputerTool, EditTool, and ToolResult.

from toystack.tools import BashTool, ComputerTool, EditTool, ToolResult
from anthropic import Anthropic

# ToolCollection definition omitted for brevity; see full example

tool_collection = ToolCollection(
    ComputerTool(instance),
    BashTool(instance),
    EditTool(instance)
)

# Initialize Anthropic Client
anthropic_client = Anthropic(api_key="your_api_key")

# Send a message with tools enabled
response = anthropic_client.beta.messages.create(
    model="claude-3-5-sonnet-20241022",
    max_tokens=4096,
    messages=messages,
    system=[{"type": "text", "text": SYSTEM_PROMPT}],
    tools=tool_collection.to_params(),
    betas=["computer-use-2024-10-22"]
)

Note: This is an optional integration. If you are using Claude's Computer Use, ensure you have the correct API keys and configurations.


Stop the Instance

When you are done with your session, it is recommended to stop the instance. This action will delete all data stored during the session.

# Stop the instance
instance.stop()

Upcoming Features

ToyStack is actively developing additional features to support desktop AI agents and enhanced tooling within the Virtual OS. Stay tuned for updates as these features are rolled out in future releases

Last updated