SDKs & examples
Python and TypeScript SDKs plus curl for OmniScout Cloud.
SDKs wrap the REST API from Endpoints: session lifecycle, actions, files, search, answer, and usage.
Python
pip install omniscout-cloudimport os, time
from omniscout_cloud.client import OmniScoutCloud
client = OmniScoutCloud(
api_key=os.environ["OMNISCOUT_API_KEY"],
base_url=os.environ.get("OMNISCOUT_BASE_URL", "https://api.omniscout.xyz"),
)
created = client.create_session(type="computer")
session_id, secret = created["session_id"], created["session_secret"]
for _ in range(30):
status = client.get_session(session_id)["status"]
if status in {"ready", "active"}:
break
if status == "failed":
raise RuntimeError("session failed to provision")
time.sleep(2)
print(client.run_action(session_id, secret, "terminal.exec", {"command": "echo hello"}))
print(client.run_action(session_id, secret, "computer.screenshot", {"format": "url"}))
print(client.usage())
client.destroy_session(session_id)
client.close()TypeScript
import { OmniScoutCloud } from "./sdk/typescript/src/client";
const client = new OmniScoutCloud({
apiKey: process.env.OMNISCOUT_API_KEY!,
baseUrl: process.env.OMNISCOUT_BASE_URL ?? "https://api.omniscout.xyz",
});
const created = await client.createSession("computer");
const sessionId = created.session_id as string;
const secret = created.session_secret as string;
for (let i = 0; i < 30; i++) {
const { status } = await client.getSession(sessionId);
if (status === "ready" || status === "active") break;
if (status === "failed") throw new Error("session failed");
await new Promise((r) => setTimeout(r, 2000));
}
await client.runAction(sessionId, secret, "terminal.exec", { command: "echo hello" });
await client.runAction(sessionId, secret, "computer.screenshot", { format: "url" });
await client.destroySession(sessionId);curl
The complete lifecycle in bash:
export OMNISCOUT_API_KEY=os_live_...
export OMNISCOUT_BASE_URL=https://api.omniscout.xyzCreate a session, wait until it is ready, run an action, then destroy the session. Extend it with any action from Endpoints — browser actions use short names (navigate, screenshot), computer actions start with computer. (computer.type, computer.screenshot).
Files
Screenshots and PDFs are saved on the session — download them with the file routes:
# After a screenshot action returns a path:
curl "$OMNISCOUT_BASE_URL/v0/sessions/$SESSION_ID/files?path=/tmp/shot.png&format=base64" \
-H "Authorization: Bearer $OMNISCOUT_API_KEY" \
-H "x-session-secret: $SESSION_SECRET"
# Upload a file, then reference it in an upload action:
curl -X POST "$OMNISCOUT_BASE_URL/v0/sessions/$SESSION_ID/files" \
-H "Authorization: Bearer $OMNISCOUT_API_KEY" \
-H "x-session-secret: $SESSION_SECRET" \
-F "file=@./document.pdf"