Contextual AI icon

Contextual AI

Access Contextual AI tools for agents, parsing, querying, and reranking.

Overview

The node "Contextual AI" provides access to Contextual AI tools focused on creating and managing AI agents, parsing, querying, and reranking content. Specifically, the Create Agent operation under the Agent resource allows users to create a new AI agent configured with custom prompts, document datastores, and metadata. This is useful for building conversational assistants or bots tailored to specific knowledge bases or tasks.

Common scenarios include:

  • Creating customer support bots that answer product-related questions.
  • Building internal knowledge assistants that reference company documentation.
  • Setting up AI agents that handle multi-turn conversations with context-aware prompts.

Practical example: A user can create an agent named "Customer Support Bot" linked to a product documentation datastore, with system prompts guiding the bot to provide helpful answers about products.

Properties

Name Meaning
Agent Name Name for the new agent (e.g., "Customer Support Bot").
Agent Description Description of the agent's purpose (e.g., "Helps customers with product questions").
Datastore Name Name for the document datastore to associate with the agent (alternative to specifying IDs).
Datastore IDs Comma-separated list of datastore IDs to associate with the agent (alternative to specifying name).
Input Binary Field(s) Name(s) of binary fields on the input item to ingest documents from.
Document Metadata (JSON String) Stringified JSON metadata attached to each uploaded file (e.g., {"custom_metadata": {"topic": "science"}}).
System Prompt Instructions the agent references when generating responses (guides agent behavior).
No Retrieval System Prompt Instructions used when there are no relevant retrievals available.
Multiturn System Prompt Instructions for handling multi-turn conversations (context management).
Filter Prompt Prompt used to filter out irrelevant chunks of information.
Suggested Queries Comma-separated list of suggested queries shown in the UI to guide users.
Agent Configs (JSON String) Optional advanced configuration for the agent as stringified JSON, mapping to API's agent_configs.
Authentication Method of authentication to use; currently supports API Key authentication.

Output

The node outputs an array of JSON objects representing the result of the agent creation operation. The exact structure depends on the API response but typically includes details about the newly created agent such as its ID, name, description, associated datastores, and configuration.

If the node processes binary data (e.g., documents to ingest), it uses the specified binary field names to read input files, but the output primarily focuses on JSON metadata about the created agent.

Dependencies

  • Requires an active API key credential for authenticating requests to the Contextual AI service.
  • The node depends on the external Contextual AI API to perform operations like creating agents.
  • Proper network connectivity to the API endpoint is necessary.
  • Users must configure the API key credential within n8n before using this node.

Troubleshooting

  • Missing or invalid API key: The node will fail if the API key is not provided or incorrect. Ensure the API key credential is set up properly.
  • Invalid JSON strings: Properties like Document Metadata and Agent Configs require valid JSON strings. Malformed JSON will cause errors. Validate JSON syntax before input.
  • Conflicting datastore inputs: Provide either Datastore Name or Datastore IDs, not both. Supplying both may cause unexpected behavior.
  • Empty required fields: Fields like Agent Name should not be empty; missing required inputs may lead to API errors.
  • Binary field issues: If the specified binary field does not exist on input items, ingestion will fail. Verify the binary property name matches input data.

Links and References

Discussion