Handit Prompt Fetcher icon

Handit Prompt Fetcher

Fetch active prompts from Handit API using agent name (auto-converted to slug) and create prompt variables for LLM nodes

Fetch Prompts

AI-generated

Overview

The Handit Prompt Fetcher node fetches active prompts from the Handit API for a specified agent. It converts the agent name to a camelCase slug, calls the API endpoint to retrieve production prompts, and outputs the prompts along with metadata. This node is useful for integrating dynamic prompt data into workflows, especially for use with language model nodes that require prompt variables.

Use Case Examples

  1. Fetch active prompts for an agent named 'My Agent Name' to dynamically update prompt variables in an LLM workflow.
  2. Use a custom API URL to fetch prompts from a different Handit API endpoint for a specific agent slug.

Properties

Name Meaning
Agent Name The name of the agent, which is automatically converted to a camelCase slug used in the API request URL.
API URL Custom API endpoint URL to fetch prompts. If left empty, the default Handit API endpoint is used, with the agent slug inserted.

Output

JSON

  • agentName - The original agent name provided as input.
  • agentSlug - The camelCase slug version of the agent name used in the API URL.
  • fetchedAt - Timestamp when the prompts were fetched.
  • prompts - The raw prompts object fetched from the Handit API.
  • promptsJson - Stringified JSON representation of the prompts for easy viewing.
    prompt_ - Individual prompt entries extracted from the prompts object, where is the prompt identifier.
  • promptMetadata
    • agentName - Agent name metadata.
    • agentSlug - Agent slug metadata.
    • apiEndpoint - The full API endpoint URL used to fetch the prompts.
    • fetchedAt - Timestamp metadata for when the prompts were fetched.
    • totalPrompts - Total number of prompts fetched.
    • availableNodes - List of prompt keys available in the fetched prompts.
  • success - Boolean indicating if the fetch operation was successful.
  • message - Success message detailing the number of prompts fetched and agent information.
  • error - Error message if the fetch operation failed.
  • timestamp - Timestamp of the error occurrence.

Dependencies

  • Handit API credentials (API token)

Troubleshooting

  • Ensure that valid Handit API credentials with an API token are provided; otherwise, the node will throw an error indicating missing credentials.
  • If the API response is not a valid JSON object, the node will throw an error indicating an invalid response from the API.
  • Check that the agent name is correctly provided and that the API URL contains the placeholder {agentSlug} if customized, as the agent slug is required for the API call.

Links

Discussion