run_workflow()
method initiates the execution of predefined Agents in PromptLayer, allowing you to start complex, multi-step sequences. For a comprehensive understanding of Agents, including their use cases, key concepts, and versioning, please refer to the Agents documentation.
workflow_name
/ workflowName
(str, required): The name of the Agent to run.input_variables
/ inputVariables
(Dict[str, Any], optional): Variables to be used in the Agent.metadata
(Dict[str, str], optional): Additional metadata for the Agent run.workflow_label_name
/ workflowLabelName
(str, optional): Label name for the Agent version.workflow_version
/ workflowVersion
(int, optional): Specific version number of the Agent to run.return_all_outputs
/ returnAllOutputs
(bool, optional): Whether to return all outputs from the Agent execution.return_all_outputs
/ returnAllOutputs
is false
, the method returns only the final node’s output as a single value; when set to true
, it returns a dictionary (Python) or object (JavaScript) containing detailed outputs (including status) for each node in the agent.
return_all_outputs
/ returnAllOutputs
is False (default):return_all_outputs
/ returnAllOutputs
is True:status
(str): The execution status (e.g., "SUCCESS"
, "FAILED"
).value
(Any): The output (e.g., text, boolean).error_message
/ raw_error_message
: Error information, if any.is_output_node
(bool): Indicates whether this node is the designated “final output” node.input_variables
– JSON object with the variables the agent needsmetadata
– optional JSON for extra metadatareturn_all_outputs
– Set to true
if you want to include all intermediate node resultsworkflow_version_execution_id
that you’ll need for the next step.
Step 2: Poll until completion
After initiating the run, check for results using “GET /workflow-version-execution-results”.
Include these query parameters:
workflow_version_execution_id
– The ID received from step 1return_all_outputs
– Same setting as in the first requestreturn_all_outputs
or not, you will either return the output value or all node values on completion.