Weles/Docs

Task guide

Start Weles with workflow definitions you already own.

Adopt an exact Weles trajectory API export through one tenant-scoped operation used by the CLI, Weles Web, and Weles Desktop. Accepted definitions persist as host-bound drafts; import never executes or authorizes them.

Export the existing trajectories#

The accepted file format is not a generic interchange guess. Save the JSON response from GET /api/v1/trajectories in the Weles deployment that already owns the workflows. The import also accepts the bare trajectory object returned by GET /api/v1/trajectories/<trajectory-id>.

The export contains real workflow definitions. Store and transfer it as sensitive operational data even though credential contents are forbidden.

Shell
curl --fail --silent --show-error \
  --header "Authorization: Bearer $WELES_TOKEN" \
  --header "X-Wisent-Organization-ID: $WISENT_ORGANIZATION_ID" \
  "$WELES_API_BASE/api/v1/trajectories" \
  --output trajectory-export.json
Accepted source contract
Source partRequirement
DocumentThe exact trajectories list envelope or one bare trajectory object returned by the versioned Weles API; 1 to 200 trajectories and at most 2 MiB.
OrganizationEvery tenant_id must equal the authenticated WISENT_ORGANIZATION_ID. Cross-tenant adoption is refused before mutation.
IdentityUUID id, canonical name-derived action, URL hostname in site, http(s) url, objective, and the existing API metadata fields only.
Executable definitionurl and objective must match the row; constraints and env must be objects; replay or steps must contain 1 to 200 supported Weles tool calls and end in done.
Browser/session configurationbrowser (chromium or firefox), os (macos, windows, or linux), locale, headless, proxy without embedded credentials, and session_label are retained when present.
SecretsPassword, secret, token, cookie, authorization, and proxy-auth shaped keys are refused at any depth. Credentials stay behind Weles/Skarbiec references.

Import from the CLI#

Configure the destination deployment with WELES_API_BASE, WISENT_ORGANIZATION_ID, and WELES_TOKEN. --host is the exact OS hostname of the managed worker that owns any session state the definition may reference.

Shell
weles import trajectory-export.json --host "$WELES_WORKER_HOSTNAME"

# The same operation during first use:
weles onboarding next
weles onboarding import trajectory-export.json --host "$WELES_WORKER_HOSTNAME"

Import from either GUI#

  • Weles Web — sign in, select the organization, and use the import step in the first-use walkthrough or open Setup in the sidebar. Choose the export and enter the exact managed worker hostname.
  • Weles Desktop — configure the same three Weles deployment environment variables, select the execution host already discovered through Stado, open Setup, and explicitly choose the export file. The app sends it to the same versioned Weles API operation; it does not shell out or duplicate the trajectory parser.
  • Both surfaces show imported, unchanged, and refused totals plus a per-workflow result without credential contents. Skip leaves an empty usable product, and Setup remains available for replay.

What is written#

Imported rows deliberately use status draft regardless of the source status. Review and authorize them through the normal Weles trajectory lifecycle. Later saved-task execution checks execution_host against the current worker OS hostname before any browser starts; placement policy, origin/action allowlists, credential grants, and site authorization remain independent requirements.

Durable import behavior
ConditionResult
New valid sourceOne draft weles_trajectories row is inserted with execution_host, import_source_id, semantic SHA-256 digest, preserved source document, and imported_at.
Same source identity and digestunchanged; no duplicate row and no write.
Same action and equivalent destination dataunchanged; existing data is preserved.
Source identity or action conflicts with different datarefused for that item; the existing destination row is never overwritten.
Malformed, unsupported, cross-tenant, credential-shaped, or incomplete exportThe entire request is refused before mutation. A batch insert is one database statement, so a persistence failure cannot leave a partial batch.

Service operation#

POST /api/v1/imports accepts a JSON object with source set to the unmodified export document and target_host set to the exact managed worker hostname. A human organization member or workload token with trajectories:write may call it. The request must carry Authorization and X-Wisent-Organization-ID.

A successful response uses schema weles.seed-import.v1 and returns organization_id, execution_host, imported, unchanged, refused, and per-item source_id, name, action, state, trajectory_id, status, and reason. It never echoes the source document or credential material.