Skip to content

Add documentation for load_workflow() #306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion docs/source/workflows/run-workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,17 @@ Refer to `aiq serve --help` for more information on how to customize the server.

## Using the Python API

Using the Python API for running workflows is outside the scope of this document. Refer to the Python API documentation for the {py:class}`~aiq.runtime.runner.AIQRunner` class for more information.
The toolkit offers a programmatic way to execute workflows through its Python API, allowing you to integrate workflow execution directly into your Python code. Here's how to use it:

```python
async with load_workflow(config_file) as workflow:
async with workflow.run(input_str) as runner:
result = await runner.result(to_type=str)
```

In this example:
- `config_file`: A string path pointing to your workflow YAML file
- `input_str`: A string containing the input for your workflow
- The `workflow.run(input_str)` method returns an instance of {py:class}`~aiq.runtime.runner.AIQRunner`

For detailed information about the `AIQRunner` class and its capabilities, please refer to the Python API documentation for the {py:class}`~aiq.runtime.runner.AIQRunner` class.