The Java SDK (com.fivexer:fivexer-sdk) targets Java 11 bytecode and works on the JVM and Android.
Install
Maven:
xml<dependency> <groupId>com.fivexer</groupId> <artifactId>fivexer-sdk</artifactId> <version>0.3.0</version> </dependency>
Gradle:
groovyimplementation 'com.fivexer:fivexer-sdk:0.3.0'
Quickstart
javaimport io.fivexer.sdk.Fivexer; import io.fivexer.sdk.model.*; import java.util.List; Fivexer client = new Fivexer("https://api.fivexer.com", "sk_test_..."); client.workers().upsert(new UpsertWorker("agent_1").tags(List.of("english", "billing"))); Task task = client.tasks().create(new CreateTask(List.of("english", "billing")).priority(90)); System.out.println(task.getId() + " " + task.getStatus());
Hand work off and wait for the result
Give the task your own id so a retry cannot create a second one, say what a finished result must
look like, and wait for it. outcome returns as soon as the task is done or the wait (up to 25
seconds) runs out; the SDK raises its own read timeout to cover the wait.
javaclient.tasks().create(new CreateTask(List.of("seo")) .id("audit-2026-10-10") .title("Audit the pricing page") .resultContract(new ResultContract() .schema(Map.of("type", "object", "required", List.of("url"))) .acceptanceCriteria("A link to the published report."))); TaskOutcome outcome = client.tasks().outcome("audit-2026-10-10", 25_000); while (!outcome.isDone()) outcome = client.tasks().outcome("audit-2026-10-10", 25_000); System.out.println(outcome.getStatus() + " " + outcome.getWorkerId() + " " + outcome.getResult());
A result that misses the schema is refused with result_invalid and stays with the worker to
fix; a worker who cannot do the job completes with success: false, which always goes through.
See the MCP agent toolset for the same flow over MCP.
Async
The sync Fivexer blocks on CompletableFuture internally. For async callers, use the async variants directly or wrap calls:
javaCompletableFuture<Task> future = CompletableFuture.supplyAsync(() -> client.tasks().create(input));
Worker portal
javaimport io.fivexer.sdk.FivexerWorker; import io.fivexer.sdk.model.WorkerLogin; try (FivexerWorker worker = new FivexerWorker("https://api.fivexer.com")) { worker.login(new WorkerLogin("ws_1", "agent_1", "4821")); worker.accept(worker.queue().getTaskIds().get(0)); }
Supervisor
javaimport io.fivexer.sdk.FivexerSupervisor; import io.fivexer.sdk.model.AcceptSupervisorInvite; import io.fivexer.sdk.model.SupervisorOverview; try (FivexerSupervisor sv = new FivexerSupervisor("https://api.fivexer.com")) { sv.acceptInvite(new AcceptSupervisorInvite(tokenFromLink)); SupervisorOverview board = sv.overview(); sv.assign(board.getParked().get(0).getId(), board.getCrew().get(0).getWorkerId()); }
Both session clients are AutoCloseable. Supervisor actions are flat methods (unpark,
setPriority, assign, setAvailability) — see
the supervisor plane.
Errors and quotas
javatry { client.tasks().create(new CreateTask(List.of("english"))); } catch (FivexerApiException e) { System.out.println(e.getStatusCode() + " " + e.getCode()); System.out.println(e.getRetryAfterSeconds()); System.out.println(client.getQuota().getTaskRateRemaining()); }
Webhooks
javaimport io.fivexer.sdk.webhook.Webhook; import io.fivexer.sdk.webhook.WebhookEvent; WebhookEvent event = Webhook.constructEvent(rawBodyBytes, signatureHeader, "whsec_...");
Build & test
bash./gradlew check