# What Are the Default Settings for output_dir and output_file_path in AutoHedge?

> Discover the default settings for output_dir and output_file_path in AutoHedge. Learn how AutoHedge automatically creates timestamped files in the outputs folder.

- Repository: [Swarms/AutoHedge](https://github.com/The-Swarm-Corporation/AutoHedge)
- Tags: api-reference
- Published: 2026-09-08

---

**The `output_dir` parameter defaults to `"outputs"` and `output_file_path` defaults to `None`, causing AutoHedge to automatically create timestamped files inside the outputs folder when results are saved.**

The AutoHedge library from The-Swarm-Corporation provides systematic result persistence through configurable output paths. Understanding the default settings for `output_dir` and `output_file_path` ensures you know exactly where your analysis results are stored without explicit configuration. These defaults are defined in the core implementation at [`autohedge/main.py`](https://github.com/The-Swarm-Corporation/AutoHedge/blob/main/autohedge/main.py) and balance immediate usability with filesystem organization.

## Default Values for Output Configuration

### output_dir Defaults to "outputs"

The `output_dir` parameter initializes to the string `"outputs"`, which the library converts to a **Path** object. According to the source code in [`autohedge/main.py`](https://github.com/The-Swarm-Corporation/AutoHedge/blob/main/autohedge/main.py), if this directory does not exist when AutoHedge attempts to save results, the system creates it automatically.

### output_file_path Defaults to None

When `output_file_path` remains at its default of **None**, AutoHedge does not use a fixed filename. Instead, the library generates a **timestamp-based filename** dynamically inside `output_dir` at save time, ensuring unique filenames for each execution.

## Source Code Location and Implementation

These defaults are declared in [[`autohedge/main.py`](https://github.com/The-Swarm-Corporation/AutoHedge/blob/main/autohedge/main.py)](https://github.com/The-Swarm-Corporation/AutoHedge/blob/main/autohedge/main.py) at lines 19-20 within the core AutoHedge class constructor. The implementation handles path resolution and directory creation transparently, allowing zero-configuration operation while supporting explicit path overrides through class instantiation.

## Practical Code Examples

### Using Default Settings

Initialize AutoHedge without arguments to leverage the automatic output handling:

```python
from autohedge import AutoHedge

# Initialize with defaults

hedger = AutoHedge()

# Verify default values

print(f"Output directory: {hedger.output_dir}")  # Path('outputs')

print(f"Output file path: {hedger.output_file_path}")  # None

# Results are saved with auto-generated timestamped filenames

result = hedger.run(task="Analyze Q3 earnings for MSFT")

```

### Overriding Default Paths

Specify custom locations by passing parameters to the constructor:

```python
from autohedge import AutoHedge

# Custom paths override defaults

hedger = AutoHedge(
    output_dir="my_results",
    output_file_path="my_results/analysis.json"
)

print(hedger.output_dir)        # Path('my_results')

print(hedger.output_file_path)  # 'my_results/analysis.json'

```

## Summary

- The `output_dir` default setting in AutoHedge is `"outputs"`, automatically created if missing.
- The `output_file_path` default is `None`, triggering automatic timestamp-based filename generation.
- Both settings are defined in [`autohedge/main.py`](https://github.com/The-Swarm-Corporation/AutoHedge/blob/main/autohedge/main.py) at lines 19-20 and can be overridden via constructor arguments.
- When using defaults, results persist to timestamped files within the outputs folder without manual path management.

## Frequently Asked Questions

### What happens if the outputs directory doesn't exist?

AutoHedge automatically creates the `outputs` directory (or any custom `output_dir` specified) when saving results if it does not already exist on the filesystem. This behavior is handled internally by the library's path management logic.

### How does AutoHedge generate filenames when output_file_path is None?

When `output_file_path` remains at its default `None` value, AutoHedge generates a timestamp-based filename at runtime and saves the file inside the designated `output_dir` folder. This prevents file overwrites and maintains execution history.

### Can I change the output directory after initialization?

While the defaults are set in the constructor defined in [`autohedge/main.py`](https://github.com/The-Swarm-Corporation/AutoHedge/blob/main/autohedge/main.py), you can modify the `output_dir` attribute on the instance directly. However, best practice is to set your preferred path during initialization to ensure consistent behavior across the object lifecycle.

### Where are these default settings defined in the source code?

The default settings for `output_dir` and `output_file_path` are defined in the AutoHedge class `__init__` method within the [`autohedge/main.py`](https://github.com/The-Swarm-Corporation/AutoHedge/blob/main/autohedge/main.py) file at lines 19-20, according to the repository source code maintained by The-Swarm-Corporation.