Official SDKs
Tzafon provides official SDKs for Python and TypeScript with identical functionality and APIs.Python SDK
TypeScript SDK
Installation
- Python
- TypeScript
Environment Variable (Recommended)
Explicit API Key
Basic Usage
Both SDKs follow the same pattern with language-specific conventions.How Actions Work
Actions execute immediately when called. Each method call sends a request to the computer instance.API Levels
The SDK provides two levels of API access:High-Level Wrapper (Recommended for Simple Workflows)
The wrapper provides convenient, language-idiomatic methods for common operations:tab_id or include_context.
Use the wrapper when:
- You’re working with a single tab
- You want clean, readable code
- You don’t need page context or advanced features
Using execute() for Advanced Features
Use execute() when:- You need multi-tab management (
tab_idparameter) - You want page context (
include_contextparameter) - You need low-level actions like
key_down,mouse_down
For multi-tab workflows and page context, see Multi-Tab Management and Page Context.
Async and Cleanup
Python AsyncComputer
Python
TypeScript await using (TS 5.2+)
TypeScript
Client Configuration
Error Handling
Feature Parity
Core actions work identically across both SDKs:| Action | Python | TypeScript |
|---|---|---|
| Navigate | navigate(url) | navigate(url) |
| Click | click(x, y) | click(x, y) |
| Type | type(text) | type(text) |
| Screenshot | screenshot() | screenshot() |
| Double Click | double_click(x, y) | doubleClick(x, y) |
| Right Click | right_click(x, y) | rightClick(x, y) |
| Drag | drag(x1, y1, x2, y2) | drag(x1, y1, x2, y2) |
| Hotkey | hotkey(*keys) | hotkey(keys) |
| Scroll | scroll(dx, dy) | scroll(dx, dy) |
| HTML | html() | getHTML() |
| Debug | debug(command) | debug(command) |
| Set Viewport | set_viewport(w, h) | setViewport(w, h) |
| Wait | wait(seconds) | wait(seconds) |
Advanced Features
Both SDKs provide wrapper methods for advanced operations:| Feature | Python | TypeScript |
|---|---|---|
| Execute Action | execute({...}) | execute({...}) |
| Batch Actions | batch([...]) | batch([...]) |
| Key Down | execute({"type": "key_down", ...}) | execute({ type: 'key_down', ...}) |
| Key Up | execute({"type": "key_up", ...}) | execute({ type: 'key_up', ...}) |
| Mouse Down | execute({"type": "mouse_down", ...}) | execute({ type: 'mouse_down', ...}) |
| Mouse Up | execute({"type": "mouse_up", ...}) | execute({ type: 'mouse_up', ...}) |
| Keep Alive | keep_alive() | keepAlive() |
| Retrieve Status | retrieve() | retrieve() |
| Stream Events | stream_events() | streamEvents() |
| Stream Screencast | stream_screencast() | streamScreencast() |
| Tab Management | execute({"type": "list_tabs"}) | client.computers.tabs.list(id) |
Tab management in TypeScript uses dedicated
client.computers.tabs.* methods. Python uses execute() with tab action types (list_tabs, new_tab, switch_tab, close_tab).