OpenAI Analytics icon

OpenAI Analytics

Use OpenAI Analytics API

Thread → Run Existing Thread

AI-generated

Overview

The "Run Existing Thread" operation in this OpenAI Analytics node allows users to add messages to an existing conversation thread with a selected assistant and then execute that thread run. This operation is useful for continuing or interacting with ongoing conversations managed by an assistant, enabling dynamic message additions and receiving updated responses.

Typical use cases include:

  • Continuing a multi-turn conversation with an AI assistant.
  • Adding new user or system messages to an existing thread before processing.
  • Attaching relevant files to the thread to provide additional context.
  • Overriding default assistant instructions for specific runs.
  • Waiting for the thread run to complete and retrieving the results synchronously.

For example, you might have a support chatbot assistant running threads for customer queries. Using this operation, you can add follow-up questions or system prompts to an existing thread and get the assistant's updated response immediately.

Properties

Name Meaning
Authentication Choose between using dedicated OpenAI Analytics API credentials or existing OpenAI API credentials.
Select Assistant Method to select the assistant: either from a list of available assistants or by entering the assistant's ID directly.
Assistant When selecting from list, choose the assistant to run the thread with.
Assistant ID When selecting by ID, enter the assistant's ID to use for the run.
File Attachment Method How to attach files to the thread: use existing uploaded file IDs, upload binary files from previous node, use both methods, or no file attachments.
Binary Property The name of the binary property containing data from the previous node when uploading files (e.g., "data"). Required if uploading files.
File Purpose Purpose of uploaded files: for use with assistants or as input to assistants.
Enable File Attachments Whether to attach existing uploaded files to the thread. Only applicable if using existing files or both methods.
File IDs List of file IDs to attach to the thread. Loaded dynamically from available files. Applicable if attaching existing files or both methods and enabled.
Thread ID The ID of the existing thread to run. This is required to identify which thread to add messages to and execute.
Message Input Method Choose whether to add a single message or multiple messages to the thread before running it.
Additional Message The single message content to add to the thread before running. Required if using single message input method.
Messages A collection of messages to add to the thread before running. Each message includes a role (User or System) and content. Required if using multiple messages input method.
Wait for Completion Whether to wait for the thread run to complete before returning the result. If false, the node returns immediately after starting the run.
Maximum Poll Time (Seconds) Maximum time in seconds to wait for the run to complete when waiting for completion. Default is 120 seconds.
Instructions Optional override for the assistant's default system instructions for this run.
Simplify Output Whether to return a simplified response format instead of the full detailed output.

Output

The node outputs JSON data representing the result of running the specified existing thread with the added messages. The structure typically includes:

  • Details about the thread run status.
  • The assistant's response messages.
  • Metadata about the run.
  • If Simplify Output is enabled, the response is returned in a concise, easy-to-use format.

If file attachments are used, the node handles uploading or referencing files accordingly but does not output binary data itself.

Dependencies

  • Requires valid OpenAI API credentials, either dedicated OpenAI Analytics API credentials or standard OpenAI API credentials.
  • Access to the OpenAI Analytics API endpoints for managing assistants, threads, and files.
  • Proper configuration of credentials in n8n with necessary API keys and optional organization IDs.
  • For file uploads, expects binary data from previous nodes under the specified binary property.

Troubleshooting

  • Invalid Thread ID: If the provided thread ID does not exist or is incorrect, the node will throw an error indicating the thread cannot be found. Verify the thread ID is correct.
  • Assistant Not Found: Selecting an assistant by ID or from the list requires valid assistant IDs. Errors occur if the assistant is missing or inaccessible.
  • File Attachment Issues: Uploading files requires valid binary data in the specified property. Missing or incorrectly named binary properties cause failures.
  • Timeouts Waiting for Completion: If the run takes longer than the maximum poll time, the node may timeout. Increase the "Maximum Poll Time" or disable waiting for completion.
  • Credential Errors: Misconfigured or missing API keys lead to authentication errors. Ensure credentials are correctly set up in n8n.
  • Message Content Required: When adding messages, content must not be empty. Validate message inputs before execution.

Links and References

Discussion