Skip to content

lt.yamlWorkflows

lt.yamlWorkflows manages the YAML workflow lifecycle: compile or create a draft, deploy and activate it, invoke it, keep its version history, and schedule it with cron.

const result = await lt.yamlWorkflows.list({ status: 'active', app_id: 'longtail', limit: 20 });

List YAML workflows with filtering and pagination.

Parameters

Field Type Required Description
status string No draft, deployed, active or archived
graph_topic string No Filter by subscription topic
app_id string No Filter by namespace
search string No Free-text search across name and description
source_workflow_id string No Filter by source execution ID
set_id string No Filter by workflow set
limit number No Max rows
offset number No Pagination offset

Returns: LTApiResult<{ workflows: YamlWorkflow[], total: number }>

Auth: Not required.

const result = await lt.yamlWorkflows.create({
workflow_id: 'wf_abc',
task_queue: 'v1',
workflow_name: 'screenshot_analyze',
name: 'screenshot_analyze_store',
});

Compile an execution into a new YAML workflow draft with the LLM-based generator.

Parameters

Field Type Required Description
workflow_id string Yes ID of the source execution
task_queue string Yes Task queue the source execution ran on
workflow_name string Yes Type name of the source workflow
name string Yes Tool name for the new workflow (no dashes)
description string No Description passed to the generator
app_id string No Target namespace (default "longtail")
subscribes string No Subscription topic override
tags string[] No Tags merged with derived tags
compilation_feedback string No Natural-language guidance for the compiler

Returns: LTApiResult<YamlWorkflow>

Auth: Not required.

const result = await lt.yamlWorkflows.createDirect({
name: 'my_tool',
yaml_content: yamlString,
});

Create a YAML workflow directly from YAML you supply.

Parameters

Field Type Required Description
name string Yes Tool name (normalized to lowercase letters, digits, periods, dashes and underscores)
description string No Description
yaml_content string Yes HotMesh YAML definition
input_schema object No JSON Schema for the workflow’s input (default {})
activity_manifest any[] No Activity declarations (default [])
tags string[] No Tags (default [])
app_id string No Target namespace (default "longtail")
graph_topic string No Subscription topic override (defaults to the normalized name)

Returns: LTApiResult<YamlWorkflow>

Auth: Not required.

const result = await lt.yamlWorkflows.getAppIds({});

List every namespace that holds at least one YAML workflow.

Parameters: none (pass {}).

Returns: LTApiResult<{ app_ids: string[] }>

Auth: Not required.

const result = await lt.yamlWorkflows.get({ id: 'workflow-uuid' });

Get one YAML workflow by ID.

Parameters

Field Type Required Description
id string Yes Workflow UUID

Returns: LTApiResult<YamlWorkflow>

Auth: Not required.

const result = await lt.yamlWorkflows.update({ id: 'workflow-uuid', name: 'new_name', tags: ['updated'] });

Partially update a YAML workflow record.

Parameters

Field Type Required Description
id string Yes Workflow UUID
... any No Any mutable field (name, description, yaml_content, tags and so on)

Returns: LTApiResult<YamlWorkflow>

Auth: Not required.

const result = await lt.yamlWorkflows.regenerate({
id: 'workflow-uuid',
compilation_feedback: 'Add error handling for the upload step',
});

Recompile a YAML workflow from its original execution.

Parameters

Field Type Required Description
id string Yes Workflow UUID
task_queue string No Task queue override (otherwise read from the source task)
compilation_feedback string No Natural-language guidance for the compiler

Returns: LTApiResult<YamlWorkflow>

Auth: Not required.

const result = await lt.yamlWorkflows.delete({ id: 'workflow-uuid' });

Permanently delete a YAML workflow. Only draft or archived workflows can be deleted.

Parameters

Field Type Required Description
id string Yes Workflow UUID

Returns: LTApiResult<{ deleted: true }>

Auth: Not required.

const result = await lt.yamlWorkflows.deploy({ id: 'workflow-uuid' });

Deploy a YAML workflow together with every workflow sharing its namespace.

Parameters

Field Type Required Description
id string Yes Workflow UUID

Returns: LTApiResult<YamlWorkflow>

Auth: Not required.

const result = await lt.yamlWorkflows.activate({ id: 'workflow-uuid' });

Activate a deployed YAML workflow and the workflows sharing its namespace.

Parameters

Field Type Required Description
id string Yes Workflow UUID

Returns: LTApiResult<YamlWorkflow>

Auth: Not required.

const result = await lt.yamlWorkflows.invoke({
id: 'workflow-uuid',
data: { url: 'https://example.com' },
sync: true,
});

Invoke an active YAML workflow.

Parameters

Field Type Required Description
id string Yes Workflow UUID
data any No Input payload
sync boolean No true waits for the workflow to finish and returns its output
timeout number No Max milliseconds to wait when sync is true
execute_as string No Identity to run as

Returns: LTApiResult<any>. 404 if the workflow is unknown.

Auth: Optional. The userId is forwarded when provided. execute_as requires an authenticated caller and the act-as rule: a superadmin may act as anyone, and a caller holding an admin-type grant may act as an account that holds no superadmin grant and whose every role the caller holds at the same or higher type. The server sets the workflow’s _scope identity context; a _scope key in data is ignored.

const result = await lt.yamlWorkflows.archive({ id: 'workflow-uuid' });

Archive a YAML workflow, taking it out of service.

Parameters

Field Type Required Description
id string Yes Workflow UUID

Returns: LTApiResult<YamlWorkflow>

Auth: Not required.

const result = await lt.yamlWorkflows.getVersionHistory({ id: 'workflow-uuid', limit: 10 });

List a YAML workflow’s version history.

Parameters

Field Type Required Description
id string Yes Workflow UUID
limit number No Max versions (default 20)
offset number No Pagination offset (default 0)

Returns: LTApiResult<VersionSnapshot[]>

Auth: Not required.

const result = await lt.yamlWorkflows.getVersionSnapshot({ id: 'workflow-uuid', version: 3 });

Get one version snapshot of a YAML workflow.

Parameters

Field Type Required Description
id string Yes Workflow UUID
version number Yes Version number (1-based)

Returns: LTApiResult<VersionSnapshot>

Auth: Not required.

const current = await lt.yamlWorkflows.getYamlContent({ id: 'workflow-uuid' });
const v2 = await lt.yamlWorkflows.getYamlContent({ id: 'workflow-uuid', version: 2 });

Get a workflow’s YAML, optionally at a specific version.

Parameters

Field Type Required Description
id string Yes Workflow UUID
version number No Version number; omitted returns the current YAML

Returns: LTApiResult<string>

Auth: Not required.

const result = await lt.yamlWorkflows.setCronSchedule({
id: 'workflow-uuid',
cron_schedule: '0 * * * *',
});

Set or update a YAML workflow’s cron schedule.

Parameters

Field Type Required Description
id string Yes Workflow UUID
cron_schedule string Yes Cron expression (for example "0 * * * *")
cron_envelope any No Payload for each scheduled run
execute_as string No Identity for scheduled runs

Returns: LTApiResult<YamlWorkflow>

Auth: Not required.

const result = await lt.yamlWorkflows.clearCronSchedule({ id: 'workflow-uuid' });

Remove a YAML workflow’s cron schedule.

Parameters

Field Type Required Description
id string Yes Workflow UUID

Returns: LTApiResult<YamlWorkflow>

Auth: Not required.

const result = await lt.yamlWorkflows.getCronStatus({});

List every YAML workflow with a cron schedule and the live state of its timer.

Parameters: none (pass {}).

Returns: LTApiResult<{ schedules: Array<{ id, name, graph_topic, app_id, cron_schedule, execute_as, active }> }>

Auth: Not required.