Implementation:Marker Inc Korea AutoRAG Runner Init
| Knowledge Sources | |
|---|---|
| Domains | RAG Pipeline Deployment, Module Instantiation |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
Concrete tool for instantiating an executable RAG pipeline from a deployment configuration dictionary, provided by the AutoRAG framework.
Description
The BaseRunner.__init__ method accepts a configuration dictionary (with exactly one module per node) and a project directory path. It deep-copies the node_lines from the config to avoid mutating the original, then iterates over every node. For each node, it pops the module_type key, resolves it via get_support_modules to a concrete class, and instantiates the class with the project directory and remaining parameters. The resulting module_instances and module_params lists are stored as instance attributes for use during query execution.
Two convenience class methods provide alternative construction paths: from_yaml loads the config from a YAML file, and from_trial_folder calls extract_best_config internally before constructing the runner. The BaseRunner is subclassed by Runner (synchronous execution), ApiRunner (HTTP API), and GradioRunner (web UI), all of which share this initialization logic.
Usage
Import and instantiate a Runner subclass when you want to deploy an optimized pipeline. Use from_trial_folder for the simplest path from evaluation to deployment. Use from_yaml when you have a previously saved best config file. Use the direct constructor when you have a config dictionary in memory.
Code Reference
Source Location
- Repository: AutoRAG
- File: autorag/deploy/base.py (lines 148-200)
Signature
class BaseRunner:
def __init__(self, config: Dict, project_dir: Optional[str] = None):
...
@classmethod
def from_yaml(cls, yaml_path: str, project_dir: Optional[str] = None):
...
@classmethod
def from_trial_folder(cls, trial_path: str):
...
Import
from autorag.deploy.base import Runner # synchronous runner
from autorag.deploy.api import ApiRunner # REST API runner
from autorag.deploy.gradio import GradioRunner # Gradio web runner
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| config | Dict | yes (for __init__) | Pipeline configuration dictionary with exactly one module per node in node_lines |
| project_dir | Optional[str] | no | Path to the project directory containing data and resources. Defaults to the current working directory. |
| yaml_path | str | yes (for from_yaml) | Path to the extracted best config YAML file |
| trial_path | str | yes (for from_trial_folder) | Path to a completed evaluation trial directory |
Outputs
| Name | Type | Description |
|---|---|---|
| runner | BaseRunner (or subclass) | Initialized runner instance with module_instances (list of instantiated module objects) and module_params (list of parameter dicts) ready for query execution |
Usage Examples
From Trial Folder
from autorag.deploy.base import Runner
# One-step: extract best config and initialize the runner
runner = Runner.from_trial_folder(trial_path="./my_project/0")
answer = runner.run("What is AutoRAG?")
From YAML File
from autorag.deploy.base import Runner
runner = Runner.from_yaml(
yaml_path="./my_project/best.yaml",
project_dir="./my_project"
)
answer = runner.run("Explain the retrieval module.")
Direct Construction
from autorag.deploy.base import Runner, extract_best_config
config = extract_best_config(trial_path="./my_project/0")
runner = Runner(config, project_dir="./my_project")
answer = runner.run("How does reranking work?")