Implementation:Marker Inc Korea AutoRAG Runner Run
| Knowledge Sources | |
|---|---|
| Domains | RAG Pipeline Execution, Query Processing |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
Concrete tool for executing a user query through the full optimized RAG pipeline and returning a generated answer, provided by the AutoRAG framework.
Description
The Runner.run method creates a single-row pseudo QA DataFrame with the user's query, a UUID-based query ID, and empty ground truth placeholders. It then iterates through all module_instances in order, calling each module's pure method with the accumulated DataFrame and the module's parameters. After each module, it merges the new result columns into the running DataFrame by dropping duplicate column names from the previous result and concatenating. Finally, it extracts the value from the specified result_column (default generated_texts) and returns it.
The method handles column overlap explicitly: when a module produces columns that already exist in the DataFrame, the older versions are dropped in favor of the new ones. This allows modules such as rerankers to update retrieval scores without creating naming conflicts.
Usage
Import Runner and call run whenever you need synchronous, single-query inference from a deployed AutoRAG pipeline. For HTTP API deployment, use ApiRunner instead (which uses the same execution logic internally). For interactive chat, use GradioRunner.
Code Reference
Source Location
- Repository: AutoRAG
- File: autorag/deploy/base.py (lines 203-235)
Signature
class Runner(BaseRunner):
def run(self, query: str, result_column: str = "generated_texts") -> str:
Import
from autorag.deploy.base import Runner
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| query | str | yes | The natural language query from the user |
| result_column | str | no | The DataFrame column name to extract the final result from. Default is "generated_texts", which is the standard output column of generation modules. |
Outputs
| Name | Type | Description |
|---|---|---|
| result | str | The generated answer text (or other column value if result_column is overridden) |
Usage Examples
Basic Usage
from autorag.deploy.base import Runner
# Initialize from a trial folder
runner = Runner.from_trial_folder(trial_path="./my_project/0")
# Run a single query
answer = runner.run("What are the key features of AutoRAG?")
print(answer)
# Output: "AutoRAG is an automated RAG pipeline optimization framework..."
Custom Result Column
from autorag.deploy.base import Runner
runner = Runner.from_yaml("./my_project/best.yaml", project_dir="./my_project")
# Retrieve intermediate results instead of the final generation
retrieved_ids = runner.run(
query="Explain vector retrieval",
result_column="retrieved_ids"
)
print(retrieved_ids)
# Output: ["doc_001", "doc_042", "doc_117"]
Batch Processing (Multiple Queries)
from autorag.deploy.base import Runner
runner = Runner.from_trial_folder("./my_project/0")
queries = [
"What is BM25?",
"How does hybrid retrieval work?",
"Explain prompt construction.",
]
answers = [runner.run(q) for q in queries]
for q, a in zip(queries, answers):
print(f"Q: {q}\nA: {a}\n")