Skip to main content
The Figranium Python SDK lets you drive a Figranium server from Python: build tasks with typed action helpers, run them synchronously or asynchronously, and stream results. This quickstart walks you from an empty project to running your first task in a handful of lines.

Prerequisites

  • Python 3.9 or later
  • A running Figranium instance (http://localhost:11345 by default)
  • An API key generated from the Figranium web UI
1

Install the SDK

The package installs figranium (the import name) plus its only runtime dependency, httpx. See Installation for optional extras.
2

Create a client

Store your API key in an environment variable so it never lands in source control.
quickstart.py
See Client configuration for every constructor option and Authentication for API key setup.
3

Define and save a task

Use actions helpers to describe the browser workflow. variable("query") produces the template token {$query} that is replaced at runtime.
quickstart.py
See Actions for every helper and Variables for typed variable declarations.
4

Run the task

Use run_task (a shortcut for client.tasks.run) and pass runtime variable overrides in input.
quickstart.py
5

Handle errors

Every HTTP, transport, and timeout failure raises FigraniumError. Inspect code and status to branch on the failure kind.
quickstart.py
See Errors for the full list of codes.

Complete example

quickstart.py

Direct execution without saving

For one-off runs, skip tasks.save and call client.scrape, client.agent, or client.headful directly. These use the same Task shape, but the server does not persist them.
direct_scrape.py

Next steps

Action helpers

Every helper you can use to build a task, from navigation to CAPTCHA solving.

Streaming

Iterate over live executions with client.executions.stream().

Handle errors

FigraniumError fields, codes, and cancellation semantics.

Tasks resource

Save, version, list, and run tasks programmatically.