# handle_input

## ``autogen.agents.experimental.document_agent.handle_input [#](https://docs.ag2.ai/0.9.6/docs/api-reference/autogen/agents/experimental/document_agent/handle_input/#autogen.agents.experimental.document_agent.handle_input "Permanent link")

```
handle_input(input_path, output_dir='./output')
```

Process the input string and return the appropriate file paths

Source code in `autogen/agents/experimental/document_agent/document_utils.py`

|     |     |
| --- | --- |
| ```<br>312<br>313<br>314<br>315<br>316<br>317<br>318<br>319<br>320<br>321<br>322<br>323<br>324<br>325<br>326<br>327<br>328<br>329<br>330<br>331<br>332<br>333<br>334<br>335<br>``` | ```<br>@export_module("autogen.agents.experimental.document_agent")<br>def handle_input(input_path: Union[Path, str], output_dir: Union[Path, str] = "./output") -> list[Path]:<br>    """Process the input string and return the appropriate file paths"""<br>    output_dir = preprocess_path(str_or_path=output_dir, is_dir=True, mk_path=True)<br>    if isinstance(input_path, str) and is_url(input_path):<br>        _logger.info("Detected URL. Downloading content...")<br>        try:<br>            return [download_url(url=input_path, output_dir=output_dir)]<br>        except Exception as e:<br>            raise e<br>    if isinstance(input_path, str):<br>        input_path = Path(input_path)<br>    if not input_path.exists():<br>        raise ValueError("The input provided does not exist.")<br>    elif input_path.is_dir():<br>        _logger.info("Detected directory. Listing files...")<br>        return list_files(directory=input_path)<br>    elif input_path.is_file():<br>        _logger.info("Detected file. Returning file path...")<br>        return [input_path]<br>    else:<br>        raise ValueError("The input provided is neither a URL, directory, nor a file path.")<br>``` |
