Python SDK for Voke — serverless macOS compute on Apple Silicon
Project description
voke
Python SDK for Voke -- serverless macOS compute on Apple Silicon. Run scripts on ephemeral macOS VMs with one function call.
Install
pip install voke # core SDK
pip install voke[openai] # + OpenAI function calling
pip install voke[langchain] # + LangChain integration
pip install voke[crewai] # + CrewAI integration
Quick start
Sync
from voke import Voke
client = Voke() # reads VOKE_API_KEY from env
result = client.jobs.create(script="uname -m && sw_vers").wait()
print(result.exit_code) # 0
print(result.stdout) # arm64\nProductName: macOS\n...
Async
import asyncio
from voke import AsyncVoke
async def main():
client = AsyncVoke()
job = await client.jobs.create(script="uname -m")
result = await job.async_wait()
print(result.stdout)
await client.close()
asyncio.run(main())
API reference
Voke(api_key=None, base_url="https://api.voke.run")
Create a sync client. If api_key is not provided, reads VOKE_API_KEY from environment.
client.jobs.create(script, *, image="base", timeout=600, env=None, webhook_url=None) -> Job
Submit a script. Returns a Job object immediately (status will be "queued").
client.jobs.get(job_id) -> Job
Fetch a job by ID.
client.jobs.list(*, limit=20, offset=0, status=None) -> JobList
List your jobs, newest first.
client.jobs.cancel(job_id) -> Job
Cancel a queued job.
job.wait(poll_interval=1.5, timeout=None) -> Job
Poll until the job reaches a terminal state (completed/failed/cancelled).
client.images() -> dict[str, ImageInfo]
List available macOS images.
client.usage() -> UsageResponse
Get current month's usage.
Images
| Image | Description |
|---|---|
base |
Clean macOS Sonoma 14.8 with dev tools |
xcode16 |
base + Xcode 16, Swift 6, CocoaPods, Fastlane |
Error handling
from voke.errors import VokeError, AuthenticationError, RateLimitError
try:
client.jobs.create(script="echo hello")
except AuthenticationError:
print("Bad API key")
except RateLimitError:
print("Too many requests")
except VokeError as e:
print(f"API error {e.status_code}: {e}")
OpenAI Function Calling
from openai import OpenAI
from voke.tools.openai import VOKE_TOOLS, handle_tool_call
client = OpenAI()
response = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "Check the macOS version"}],
tools=VOKE_TOOLS,
)
for tc in response.choices[0].message.tool_calls or []:
result = handle_tool_call(tc, api_key="sk_...")
print(result)
LangChain
from voke.tools.langchain import VokeRunTool
tool = VokeRunTool() # reads VOKE_API_KEY from env
# Use with an agent
from langchain.agents import AgentExecutor
agent = AgentExecutor(tools=[tool], ...)
# Or call directly
result = tool.invoke({"script": "sw_vers", "image": "base"})
CrewAI
from voke.tools.crewai import VokeTool
from crewai import Agent
macos_tool = VokeTool()
agent = Agent(
role="macOS Engineer",
tools=[macos_tool],
...
)
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 voke-0.2.0.tar.gz.
File metadata
- Download URL: voke-0.2.0.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad222b102243befe9dddb59db3e07854e2f76dabf65044a026dd867072c1859f
|
|
| MD5 |
bc8b6d063174701afcbd83fee20585e1
|
|
| BLAKE2b-256 |
df413d3990d9fa6d69f95aacd6a7a559d2d519a68083758da56b83e84716770e
|
File details
Details for the file voke-0.2.0-py3-none-any.whl.
File metadata
- Download URL: voke-0.2.0-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3029143306083bebf5aaab78d2dc789834ee121553f2a27f14945ae0fdbf351
|
|
| MD5 |
e3800189f408e630dd80b0e64e67c323
|
|
| BLAKE2b-256 |
5632bfa446d1aebca431540b4cfdc56856fb2e26715ae42415a9578bd2cdb188
|