Braintrust icon

Braintrust

Node for performing Braintrust operations

Overview

This node integrates with the Braintrust API to invoke prompts within a specified Braintrust project. It allows users to send input data (either as plain text or JSON) to a chosen prompt identified by its slug or ID, and then returns the result generated by Braintrust.

Common scenarios include:

  • Automating interactions with Braintrust prompts for content generation, data processing, or AI-driven workflows.
  • Integrating Braintrust's capabilities into larger automation pipelines where prompt-based responses are needed.
  • Testing or experimenting with different Braintrust prompts programmatically.

For example, you might use this node to send a customer query to a Braintrust prompt designed to generate support answers, then use the output in subsequent workflow steps.

Properties

Name Meaning
Project Name The name of your Braintrust project. This identifies which project the prompt belongs to.
Slug Name or ID Choose from a list of available prompt slugs or specify a prompt ID manually. This selects the prompt to invoke.
Input Input data sent to the prompt. Can be a plain string or a JSON-formatted string representing structured input.

Output

The node outputs an array of items, each containing a json object with a single field:

  • result: The response returned by the Braintrust API after invoking the specified prompt with the given input. The exact structure depends on the prompt's design and Braintrust's response format.

No binary data is produced by this node.

Dependencies

  • Requires an API key credential for authenticating with the Braintrust API.
  • Uses the external braintrust JavaScript library to invoke prompts.
  • Makes HTTP requests to Braintrust's REST API to load available prompts.
  • Requires network access to https://api.braintrust.dev.

Troubleshooting

  • Invalid API Key or Authentication Errors: Ensure that the provided API key credential is valid and has necessary permissions.
  • Prompt Not Found: If the selected prompt slug or ID does not exist or is misspelled, the node will throw an error. Verify the prompt exists in the specified project.
  • Malformed Input: The input property accepts JSON strings; if invalid JSON is provided, it falls back to treating input as a plain string. Make sure JSON inputs are correctly formatted.
  • API Rate Limits or Network Issues: Temporary failures may occur due to network problems or API rate limiting. Retry or check connectivity.
  • Error Messages: Errors thrown by the Braintrust API are wrapped and surfaced as node errors with context about the item index, helping identify which input caused the failure.

Links and References

Discussion