A system for orchestrating LLM tasks that exceed context limits
Project description
LLMaestro
A system for orchestrating large-scale LLM tasks that exceed token limits through task decomposition and parallel processing.
Architecture
The system is built around three main concepts:
- Task Manager: Handles task decomposition, scheduling, and result aggregation
- Agent Pool: Manages a pool of LLM agents that can be assigned subtasks
- Storage Manager: Handles efficient storage and retrieval of intermediate results
Core Components
TaskManager: Decomposes large tasks into smaller, manageable chunksAgent: Represents an LLM instance that can process subtasksStorageManager: Manages intermediate results using disk-based storageValidator: Ensures data consistency using Pydantic models
Key Features
- Task decomposition strategies for different types of tasks (PDF analysis, code refactoring, etc.)
- Efficient resource management for parallel processing
- Model-agnostic design supporting different LLM providers
- Disk-based storage for handling large datasets
- Strong type validation using Pydantic
Examples
Each example demonstrates how LLM Orchestrator handles tasks that would typically exceed token limits by:
- Automatically decomposing large tasks into manageable chunks
- Processing subtasks in parallel where possible
- Managing context and resources efficiently
- Aggregating results into a coherent output
Visualization
The system provides interactive visualizations for different types of task decomposition patterns:
- Sequential Chain - Simple linear task decomposition
- Parallel Chain - Tasks processed concurrently
- Chord Chain - Complex dependencies between tasks
- Group Chain - Tasks organized in logical groups
- Map Chain - Map-reduce style processing
- Reminder Chain - Tasks with temporal dependencies
- Recursive Chain - Self-referential task decomposition
- Nested Chain - Hierarchical task organization
Each visualization demonstrates how different types of tasks are broken down and processed by the orchestrator. Click the links above to view the interactive visualizations.
Note: To view the interactive visualizations locally, clone the repository and open the HTML files in your browser.
Configuration
The project requires configuration for LLM API access. You can set this up in two ways:
1. Using a Configuration File
- Copy the example configuration:
cp example_config.yaml config.yaml
- Edit
config.yamland replace the placeholder API key with your actual key:
llm:
provider: anthropic
model: claude-3-sonnet-20240229
api_key: your-api-key-here
2. Using Environment Variables
Alternatively, you can set the following environment variables:
export ANTHROPIC_API_KEY=your-api-key-here
export ANTHROPIC_MODEL=claude-3-sonnet-20240229 # optional, defaults to sonnet
Security Notes
- Never commit API keys to version control
- The
config.yamlfile is already added to.gitignore - Use environment variables in production environments
- Rotate API keys if they are ever exposed
Getting Started
- Install dependencies:
poetry install
-
Set up configuration using one of the methods above
-
Try the visualization demo:
python examples/live_visualization_demo.py
- Open
examples/visualization.htmlin your browser when prompted
Usage
from llm_orchestrator import TaskManager, Agent
# Initialize the orchestrator
task_manager = TaskManager()
# Create a task
task = task_manager.create_task(
task_type="pdf_analysis",
input_data="path/to/pdfs",
config={"batch_size": 100}
)
# Execute the task
results = task_manager.execute(task)
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llmaestro-0.1.0.tar.gz.
File metadata
- Download URL: llmaestro-0.1.0.tar.gz
- Upload date:
- Size: 66.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ebebed5ef2651f561ca0af6c8045d660b07f8413a0ccc681e0c34ff9b15500f
|
|
| MD5 |
894cfa385e0ee227f51bfc6886b35d73
|
|
| BLAKE2b-256 |
f6da92b62ecb688efd4efb8a870efa24ad70c7a4914a44676daf517912a3a493
|
Provenance
The following attestation bundles were made for llmaestro-0.1.0.tar.gz:
Publisher:
publish.yml on billthefighter/LLMaestro
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llmaestro-0.1.0.tar.gz -
Subject digest:
6ebebed5ef2651f561ca0af6c8045d660b07f8413a0ccc681e0c34ff9b15500f - Sigstore transparency entry: 168679817
- Sigstore integration time:
-
Permalink:
billthefighter/LLMaestro@a03e63cf970c6ae4fa00a8abc60181cf90e65d1c -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/billthefighter
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a03e63cf970c6ae4fa00a8abc60181cf90e65d1c -
Trigger Event:
release
-
Statement type:
File details
Details for the file llmaestro-0.1.0-py3-none-any.whl.
File metadata
- Download URL: llmaestro-0.1.0-py3-none-any.whl
- Upload date:
- Size: 85.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2faf05c3cff81319e8e521f1118aa44ed8509436991ed239426aeed3d92716de
|
|
| MD5 |
d169107442d937c9202789fd89b908c9
|
|
| BLAKE2b-256 |
885163f6c5a2f95f283c4741ca730be9984160d634f24907ee7fb1b91ebaeaac
|
Provenance
The following attestation bundles were made for llmaestro-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on billthefighter/LLMaestro
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llmaestro-0.1.0-py3-none-any.whl -
Subject digest:
2faf05c3cff81319e8e521f1118aa44ed8509436991ed239426aeed3d92716de - Sigstore transparency entry: 168679818
- Sigstore integration time:
-
Permalink:
billthefighter/LLMaestro@a03e63cf970c6ae4fa00a8abc60181cf90e65d1c -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/billthefighter
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a03e63cf970c6ae4fa00a8abc60181cf90e65d1c -
Trigger Event:
release
-
Statement type: