Skip to main content

collections

collections.add_file

Add File to Collection

Effects: write

Add a file to a knowledge collection.

The file must be uploaded and indexed first (files_upload + files_ingest). If the file was previously removed, it is re-enabled.

Arguments

ArgumentTypeRequiredDescription
collection_idintegeryesID of the collection
file_idintegeryesID of the file to add (from files_upload)

collections.assign_agent

Assign Collection to Agent

Effects: write

Assign a knowledge collection to an AI agent.

Once assigned, the agent's knowledge.query will automatically scope RAG search to files in its assigned collections.

Arguments

ArgumentTypeRequiredDescription
agent_idintegeryesID of the AI agent
collection_idintegeryesID of the collection to assign

collections.create

Create Knowledge Collection

Effects: write

Create a named knowledge collection.

Collections group files for RAG search. After creating, add files with collections.add_file and assign to agents with collections.assign_agent.

Arguments

ArgumentTypeRequiredDescription
descriptionstringnoOptional description of the collection
namestringyesCollection name (must be unique per user) (min 1.0; max 255.0)

collections.delete

Delete Knowledge Collection

Effects: delete

Delete a knowledge collection.

If the collection is assigned to agents, prompts, or channels, pass force=true to delete anyway. CASCADE removes all assignments automatically.

Arguments

ArgumentTypeRequiredDescription
collection_idintegeryesID of the collection to delete
forcebooleannoForce delete even if collection is in use. OMIT for the safe default (refuse to delete in-use collections).

collections.list

List Knowledge Collections

Effects: read

List all knowledge collections in the workspace.

Collections are named groups of files used for RAG search. Auto-created collections (per-agent, per-prompt) are hidden by default.

Arguments

ArgumentTypeRequiredDescription
include_inactivebooleannoInclude inactive collections. OMIT to list only active collections (the default).

collections.list_files

List Files in Collection

Effects: read

List all files in a knowledge collection with their indexing status and chunk counts. Each returned file has a file_id (integer) that can be passed to messages.send as attachments=[file_id] to send the file to a contact, or to files.read to read its text content.

Arguments

ArgumentTypeRequiredDescription
collection_idintegeryesID of the collection

collections.remove_file

Remove File from Collection

Effects: write

Remove a file from a knowledge collection.

The file itself is not deleted — only the collection membership is removed.

Arguments

ArgumentTypeRequiredDescription
collection_idintegeryesID of the collection
file_idintegeryesID of the file to remove

collections.unassign_agent

Unassign Collection from Agent

Effects: write

Remove a knowledge collection from an AI agent.

The collection and its files are not deleted — only the agent assignment is removed.

Arguments

ArgumentTypeRequiredDescription
agent_idintegeryesID of the AI agent
collection_idintegeryesID of the collection to unassign