Skip to main content
POST
RAG-powered Conversational Agent
The RAG-powered Conversational Agent enables interactive, multi-turn communication with an intelligent agent built on R2R’s Retrieval-Augmented Generation (RAG) system. This endpoint allows users to engage in real-time dialogue with an AI capable of retrieving information from internal and external sources, reasoning through complex problems, executing computations, and maintaining context across multiple conversation turns. It operates in two distinct modes: RAG Mode for knowledge-based responses and Research Mode for deep analytical reasoning.

Operating Modes

RAG Mode (Default)

Provides fast, grounded answers by combining retrieval and generation. Features include:
  • Semantic and hybrid search across documents and chunks
  • Optional web search integration for live context
  • Document-level and chunk-level content retrieval
  • Source citation and evidence-based responses

Research Mode

Extends RAG functionality with advanced reasoning and computational abilities. Features include:
  • Dedicated reasoning system for multi-step problem-solving
  • Automated critique generation to identify biases or logical fallacies
  • Python execution for quantitative analysis and code-based reasoning
  • Deep exploration capabilities across multiple sources

Available Tools

RAG Tools:

  • search_file_knowledge — Perform semantic or hybrid search across ingested documents.
  • search_file_descriptions — Search file-level metadata and descriptions.
  • content — Retrieve full documents or chunk structures.
  • web_search — Query external search engines for up-to-date information.
  • web_scrape — Extract content directly from specified web pages.
Research Tools:
  • rag — Invoke the underlying RAG agent for information retrieval.
  • reasoning — Use a dedicated reasoning model for deep analysis and logical inference.
  • critique — Analyze the conversation for potential biases or reasoning flaws.
  • python_executor — Execute Python code for computation, simulation, or data processing.

Streaming Output

When streaming is enabled ("stream": true), the API emits Server-Sent Events (SSE) to deliver updates in real time. Each event corresponds to a stage in the agent’s reasoning and response generation process.

Conversations

The agent maintains persistent conversational context using the conversation_id field. How it works:
  1. On the initial request, the system creates a new conversation and returns a conversation_id.
  2. Include this ID in subsequent requests to continue the same thread.
  3. If no conversation name exists, R2R automatically assigns one.
This design allows for multi-turn, context-aware discussions, where the agent can recall prior messages, reasoning, and results.

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Body

application/json
Params
object

Current message to process

search_mode
enum<string>

Pre-configured search modes: basic, advanced, or custom.

Available options:
basic,
advanced,
custom
search_settings
object

The search configuration object for retrieving context.

rag_generation_config
object

Configuration for RAG generation in 'rag' mode

research_generation_config
object

Configuration for generation in ‘research’ mode. If not provided but mode=‘research’, rag_generation_config will be used with appropriate model overrides.

rag_tools
enum<string>

List of tools to enable for RAG mode. Available tools: search_file_knowledge, get_file_content, web_search, web_scrape, search_file_descriptions

Available options:
web_search,
web_scrape,
search_file_descriptions,
search_file_knowledge,
get_file_content

Response

200

results
object