Workflows
List the workflows of a workspace environment and read one workflow's outline, through two read-only operations
Two read-only operations read the workflows of the workspace environment the
call is made in. data.workflows.list lists them. data.workflows.get reads
one workflow: its summary and an outline of its blocks. Neither returns a
block's configuration.
import { createHttpPlatformTransport, createScrydonSDK } from '@scrydon/sdk/platform'
const platform = createScrydonSDK(
createHttpPlatformTransport({
baseUrl: 'https://scrydon.com',
headers: () => ({ authorization: `Bearer ${accessToken}` }),
})
)
const { workflows, truncated } = await platform.data.workflows.list({ limit: 20 })
const { found, workflow } = await platform.data.workflows.get({
workflowId: workflows[0].id,
})| Operation | HTTP | What it does |
|---|---|---|
data.workflows.list | POST /api/platform/v1/data/workflows/list | Lists the workflows of the workspace environment. |
data.workflows.get | POST /api/platform/v1/data/workflows/get | Reads one workflow's summary and block outline. |
Over HTTP, both need the tools:read scope. They are read-only and safe to
retry.
In a workflow, select the Scrydon tools List workflows and Read a
workflow in an Agent block's tools. Inside a Scrydon tool, the same
operations are ctx.data.workflows.list and ctx.data.workflows.get. Only
the Scrydon workflow tools may call them; another extension's tool is refused.
Cortex runs both tools without asking for approval, in any room, because they
only read.
Who sees what
Neither input names a workspace or an environment. The workspace environment is the one the call is made in: for a tool, the run's own. The workflow service then decides each read for the person the call is made for, with the same rules as the workflow editor. Someone who cannot open a workflow in the editor cannot read it here.
Only workflows the editor lists in that environment are returned. Automations and the workflows internal to a process flow are not.
List
| Field | Type | Meaning |
|---|---|---|
limit | integer, 1 to 100, optional | How many workflows to return. Defaults to 50. |
The result is { workflows, truncated }. The workflows are most recently
changed first, so the limit leaves out the ones changed longest ago. Each has id, name, description (when set),
isDeployed, deployedAt (when deployed), createdAt, updatedAt,
lastRunAt (when it has run) and runCount. Times are ISO 8601.
truncated is true when the environment holds more workflows than limit.
Get
| Field | Type | Meaning |
|---|---|---|
workflowId | string, 1 to 200 characters | The workflow to read. |
The result is { found, workflow }. found is false, with no workflow,
when the workflow does not exist, is in another environment, is not the
person's to read, or is internal to a process flow. The four look the same on
purpose.
workflow is the list's summary plus:
blocks: each block'sid,typeandname, at most 200.blocksTruncatedistruewhen the workflow has more.edgeCount: how many connections join the blocks.
A block's settings, prompts, endpoints and credential references are never returned.
@scrydon/sdk/platform exports the bounds (WORKFLOWS_LIST_LIMIT_DEFAULT,
WORKFLOWS_LIST_LIMIT_MAX, WORKFLOWS_GET_BLOCKS_MAX,
WORKFLOW_ID_MAX_CHARS). Unknown fields, including a workspace or
environment field, are refused.
Errors
| Code | When |
|---|---|
INVALID_REQUEST | The input did not pass validation, or the call was made without a workspace environment. |
UNAUTHENTICATED | The workflow service could not tell who the call is made for. |
FORBIDDEN | The person may not list the workflows of this workspace. |
PROVIDER_CONTRACT_VIOLATION | The workflow service answered outside its contract. |
PROVIDER_UNAVAILABLE | The workflow service did not answer, or the caller is not a Scrydon workflow tool. |