Overview
This node allows you to run an Agent from the PromptLayer API within an n8n workflow. It is designed to execute a specified Agent by name or ID, optionally targeting a specific version number or label. The node sends input variables to the Agent and waits for its execution results, returning those outputs for further processing.
Common scenarios where this node is beneficial include:
- Automating AI-driven workflows where Agents perform tasks such as data processing, content generation, or decision-making.
- Integrating PromptLayer Agents into larger automation pipelines to leverage their capabilities dynamically.
- Running different versions or labeled variants of an Agent depending on the context or environment.
Practical example:
- You have an Agent that summarizes text documents. Using this node, you can send the document content as input variables, trigger the Agent execution, and receive the summary output to use in subsequent workflow steps.
Properties
| Name | Meaning |
|---|---|
| Agent Name or ID | The name or ID of the Agent to execute. Choose from a dropdown list or specify dynamically via expression. |
| Use Agent Label Name | Boolean flag to decide whether to specify the Agent version by label name instead of version number. |
| Agent Version Number | (Shown if not using label) Specify the numeric version of the Agent to run a specific version. |
| Agent Label Name | (Shown if using label) Specify the label name of the Agent version to run a specific labeled version. |
| Input Variables | JSON dictionary of input variables required by the Agent. |
| Additional Fields | Collection of optional fields: |
| - Metadata | JSON object of metadata key-value pairs to attach to the execution. |
| - Return All Outputs | Boolean to indicate whether to return all outputs from the Agent execution or just the main output. |
| - Timeout | Maximum time in minutes to wait for the Agent execution before timing out (default 10 minutes). |
Output
The node outputs a JSON array where each item corresponds to one execution of the Agent. Each item contains the full response body from the PromptLayer API representing the Agent's execution results.
- The
jsonfield includes details such as the execution ID and the outputs returned by the Agent. - If "Return All Outputs" is enabled, the node returns all outputs generated by the Agent; otherwise, it returns the primary output.
- The node does not output binary data.
Dependencies
- Requires an API key credential for authenticating with the PromptLayer API.
- The node makes HTTP requests to
https://api.promptlayer.comendpoints. - No additional external dependencies beyond the configured API key and network access to PromptLayer.
Troubleshooting
- Invalid JSON in Input Variables or Metadata: If the JSON provided in these fields is malformed, the node will throw an error indicating invalid JSON. Ensure proper JSON formatting.
- Missing Execution ID in Response: If the API response does not contain the expected execution ID, the node throws an error. This may indicate an issue with the Agent name/ID or API service.
- Execution Timeout: If the Agent execution takes longer than the specified timeout (default 10 minutes), the node errors out with a timeout message. Increase the timeout if needed.
- Unexpected Status Code: If the API returns a status code other than 200 (OK) or 202 (Accepted), the node throws an error with the status code. Check API availability and credentials.
- Credential Issues: Ensure the API key credential is correctly configured and has sufficient permissions.
Links and References
- PromptLayer API Documentation (general reference for API usage)
- n8n Expressions Documentation (for dynamic parameter expressions)
- thinkbot.agency (advertised custom n8n nodes and solutions)