Flow. This quickstart walks you from an empty project to running your first task in a handful of lines.
Prerequisites
- Kotlin 2.2 or later
- A JVM toolchain of 17 (or Android minSdk 23)
- A running Figranium instance (
http://localhost:11345by default) - An API key generated from the Figranium web UI
1
Install the SDK
Add the Gradle dependency. See Installation for the full manifest snippet.
build.gradle.kts
2
Create a client
Store your API key securely (for example, in environment variables or Android Keystore) so it never lands in source control.See Client configuration for every constructor option and Authentication for API key setup.
quickstart.kt
3
4
Run the task
Use
runTask (a shortcut for client.tasks.run) and pass runtime variable overrides in ExecuteTaskOptions.quickstart.kt
5
Watch the execution
Poll the execution and emit only when the status changes. The flow finishes when the run reaches a terminal state.See Streaming for
quickstart.kt
executions.stream() and browser.selectorStream().6
Handle errors
Every HTTP, transport, and timeout failure throws See Errors for the full list of codes.
FigraniumException. Inspect status and code to branch on the failure kind.quickstart.kt
Complete example
quickstart.kt
Direct execution without saving
For one-off runs, skiptasks.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.kt
Next steps
Action helpers
Every helper you can use to build a task, from navigation to CAPTCHA solving.
Streaming
Collect live executions with
client.executions.stream().Handle errors
FigraniumException fields, codes, and cancellation semantics.Tasks resource
Save, version, list, and run tasks programmatically.