quantalogic 0.50.28__py3-none-any.whl → 0.51.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- quantalogic/agent.py +9 -11
- quantalogic/flow/flow.py +9 -7
- quantalogic/flow/flow_extractor.py +5 -2
- quantalogic/flow/flow_generator.py +5 -2
- quantalogic/flow/flow_manager.py +61 -15
- quantalogic/flow/flow_manager_schema.py +1 -1
- quantalogic/flow/flow_yaml.md +349 -262
- quantalogic/prompts/memory_compaction_prompt.j2 +16 -0
- quantalogic-0.51.0.dist-info/METADATA +700 -0
- {quantalogic-0.50.28.dist-info → quantalogic-0.51.0.dist-info}/RECORD +13 -12
- quantalogic-0.50.28.dist-info/METADATA +0 -554
- {quantalogic-0.50.28.dist-info → quantalogic-0.51.0.dist-info}/LICENSE +0 -0
- {quantalogic-0.50.28.dist-info → quantalogic-0.51.0.dist-info}/WHEEL +0 -0
- {quantalogic-0.50.28.dist-info → quantalogic-0.51.0.dist-info}/entry_points.txt +0 -0
@@ -1,5 +1,5 @@
|
|
1
1
|
quantalogic/__init__.py,sha256=BcM0DKB86DijMFtht9YTBdWyzh81zU7E5fhNLFiP260,869
|
2
|
-
quantalogic/agent.py,sha256=
|
2
|
+
quantalogic/agent.py,sha256=4XKUVAW4tnNwmdcwWbz9HjWe5CRWeouaC7Xlq-7CSHU,41129
|
3
3
|
quantalogic/agent_config.py,sha256=fPyMfm77BzimyfyFkTzb2ZdyZtGlr2fq5aTRETu77Vs,8202
|
4
4
|
quantalogic/agent_factory.py,sha256=LO0qsFtHxU7lcEi8dn-nDHhkh6Dl8Is6sP_3f1ap_Vg,6251
|
5
5
|
quantalogic/coding_agent.py,sha256=A-firiPWQjMC56B329Ne606_v2GsoF5-nxcuz3rVbYM,5496
|
@@ -10,12 +10,12 @@ quantalogic/create_custom_agent.py,sha256=1ZMsbpQGHFueJJpfJIuYCWvR3LUsEtDYqDbr6O
|
|
10
10
|
quantalogic/docs_cli.py,sha256=Ie6NwKQuxLKwVQ-cjhFMCttXeiHDjGhNY4hSmMtc0Qg,1664
|
11
11
|
quantalogic/event_emitter.py,sha256=e_1r6hvx5GmW84iuRkoqcjpjRiYHBk4hzujd5ZoUC6U,16777
|
12
12
|
quantalogic/flow/__init__.py,sha256=asLVwbDH6zVFhILschBOuZZWyKvMGdqhQbB1rd2RXHo,590
|
13
|
-
quantalogic/flow/flow.py,sha256
|
14
|
-
quantalogic/flow/flow_extractor.py,sha256=
|
15
|
-
quantalogic/flow/flow_generator.py,sha256=
|
16
|
-
quantalogic/flow/flow_manager.py,sha256=
|
17
|
-
quantalogic/flow/flow_manager_schema.py,sha256=
|
18
|
-
quantalogic/flow/flow_yaml.md,sha256=
|
13
|
+
quantalogic/flow/flow.py,sha256=P4T6N6IDOHA5OKqoNjLIZ9BQ9Vk8LwhrqcYjz3wjMB8,25297
|
14
|
+
quantalogic/flow/flow_extractor.py,sha256=4-q1gBBvSIova7DPTzr4x6e7Dg9SmueowPWqoeDHUwU,29926
|
15
|
+
quantalogic/flow/flow_generator.py,sha256=rd-aJMngzJ3Jv8b7rkU6FlLRYPKBYTQ46dqsrzYjQFE,3987
|
16
|
+
quantalogic/flow/flow_manager.py,sha256=622rikNGT0AVryWzhiEu15oTyZ8_HqIp_tOl2M6yTjE,20650
|
17
|
+
quantalogic/flow/flow_manager_schema.py,sha256=5ytHEh9Qa31yKA4FPRh1lGJYOBGp33ag7crqsJexWG8,7288
|
18
|
+
quantalogic/flow/flow_yaml.md,sha256=ZKhKW7Rp5czJWe99MnOHaXLs3U5OsgxUK6K8ezqnSzk,15776
|
19
19
|
quantalogic/generative_model.py,sha256=os30wdVRq3OsSf8M7TjoaGqJweL99UINQtSGCwoE91k,15913
|
20
20
|
quantalogic/get_model_info.py,sha256=RgblwjjP7G97v_AzoGbXxXBIO082jVCRmvRwxnEpW_s,2991
|
21
21
|
quantalogic/interactive_text_editor.py,sha256=CzefvRiLscFfOKBS4gmrI10Gn3SF_eS5zbiLVQ9Gugw,16334
|
@@ -25,6 +25,7 @@ quantalogic/model_info.py,sha256=j7QqvjEFQDGpDOgQs8uTkVyI3a50Oa_nrsQjyxizTLc,272
|
|
25
25
|
quantalogic/model_info_list.py,sha256=Xeeb7QS4xEpe9ke7Guh0CxEx-Hl59U4kC-qzVts-eAU,2437
|
26
26
|
quantalogic/model_info_litellm.py,sha256=Uoo8ZATjqH6POnTE3Ee3kfHfFllPYp8LkvJwlJjFZH8,2089
|
27
27
|
quantalogic/model_names.py,sha256=UZlz25zG9B2dpfwdw_e1Gw5qFsKQ7iME9FJh9Ts4u6s,938
|
28
|
+
quantalogic/prompts/memory_compaction_prompt.j2,sha256=Xsy9XKN7zxL4wNnNjWWlUjYjmtktgtee5dDG4dSvRW8,569
|
28
29
|
quantalogic/prompts/observation_response_format.j2,sha256=lvyveAJbXbc94aIvHgppKyaD9Tf7X5bCTGWjh51BDjI,1655
|
29
30
|
quantalogic/prompts/repeated_tool_call_error.j2,sha256=IRENR3a3D28Dtys-kGDP-x_uSkJnxeQZ5-jYHWv_3G4,319
|
30
31
|
quantalogic/prompts/system_prompt.j2,sha256=L2yBvUhCnKs25VJ4FuC_9sRyR4biVxbiHGvDVMJUclE,2767
|
@@ -160,8 +161,8 @@ quantalogic/version_check.py,sha256=JyQFTNMDWtpHCLnN-BiakzB2cyXf6kUFsTjvmSruZi4,
|
|
160
161
|
quantalogic/welcome_message.py,sha256=o4tHdgabNuIV9kbIDPgS3_2yzJhayK30oKad2UouYDc,3020
|
161
162
|
quantalogic/xml_parser.py,sha256=AKuMdJC3QAX3Z_tErHVlZ-msjPemWaZUFiTwkHz76jg,11614
|
162
163
|
quantalogic/xml_tool_parser.py,sha256=Vz4LEgDbelJynD1siLOVkJ3gLlfHsUk65_gCwbYJyGc,3784
|
163
|
-
quantalogic-0.
|
164
|
-
quantalogic-0.
|
165
|
-
quantalogic-0.
|
166
|
-
quantalogic-0.
|
167
|
-
quantalogic-0.
|
164
|
+
quantalogic-0.51.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
165
|
+
quantalogic-0.51.0.dist-info/METADATA,sha256=RZgwZd1kGVzEaJQFX-jt821N3p6T32gtyYum_TQ9qCE,24260
|
166
|
+
quantalogic-0.51.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
167
|
+
quantalogic-0.51.0.dist-info/entry_points.txt,sha256=h74O_Q3qBRCrDR99qvwB4BpBGzASPUIjCfxHq6Qnups,183
|
168
|
+
quantalogic-0.51.0.dist-info/RECORD,,
|
@@ -1,554 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.1
|
2
|
-
Name: quantalogic
|
3
|
-
Version: 0.50.28
|
4
|
-
Summary: QuantaLogic ReAct Agents
|
5
|
-
Author: Raphaël MANSUY
|
6
|
-
Author-email: raphael.mansuy@gmail.com
|
7
|
-
Requires-Python: >=3.12,<4.0
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
9
|
-
Classifier: Programming Language :: Python :: 3.12
|
10
|
-
Classifier: Programming Language :: Python :: 3.13
|
11
|
-
Requires-Dist: beautifulsoup4 (>=4.12.3,<5.0.0)
|
12
|
-
Requires-Dist: click (>=8.1.8,<9.0.0)
|
13
|
-
Requires-Dist: duckduckgo-search (>=7.2.1,<8.0.0)
|
14
|
-
Requires-Dist: faker (>=36.1.1,<37.0.0)
|
15
|
-
Requires-Dist: fuzzywuzzy (>=0.18.0,<0.19.0)
|
16
|
-
Requires-Dist: google-search-results (>=2.4.2,<3.0.0)
|
17
|
-
Requires-Dist: html2text (>=2024.2.26,<2025.0.0)
|
18
|
-
Requires-Dist: instructor (>=1.7.2,<2.0.0)
|
19
|
-
Requires-Dist: jinja2 (>=3.1.5,<4.0.0)
|
20
|
-
Requires-Dist: litellm (>=1.56.4,<2.0.0)
|
21
|
-
Requires-Dist: loguru (>=0.7.3,<0.8.0)
|
22
|
-
Requires-Dist: markdownify (>=0.14.1,<0.15.0)
|
23
|
-
Requires-Dist: markitdown (>=0.0.1a3,<0.0.2)
|
24
|
-
Requires-Dist: networkx (>=3.2.1,<4.0.0)
|
25
|
-
Requires-Dist: pathspec (>=0.12.1,<0.13.0)
|
26
|
-
Requires-Dist: prompt-toolkit (>=3.0.48,<4.0.0)
|
27
|
-
Requires-Dist: pydantic (>=2.10.4,<3.0.0)
|
28
|
-
Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
|
29
|
-
Requires-Dist: requests (>=2.32.3,<3.0.0)
|
30
|
-
Requires-Dist: rich (>=13.9.4,<14.0.0)
|
31
|
-
Requires-Dist: serpapi (>=0.1.5,<0.2.0)
|
32
|
-
Requires-Dist: sqlalchemy (>=2.0.25,<3.0.0)
|
33
|
-
Requires-Dist: tenacity (>=9.0.0,<10.0.0)
|
34
|
-
Requires-Dist: tree-sitter (>=0.23.2,<0.24.0)
|
35
|
-
Requires-Dist: tree-sitter-c (>=0.23.4,<0.24.0)
|
36
|
-
Requires-Dist: tree-sitter-cpp (>=0.23.4,<0.24.0)
|
37
|
-
Requires-Dist: tree-sitter-go (>=0.23.4,<0.24.0)
|
38
|
-
Requires-Dist: tree-sitter-java (>=0.23.5,<0.24.0)
|
39
|
-
Requires-Dist: tree-sitter-javascript (>=0.23.1,<0.24.0)
|
40
|
-
Requires-Dist: tree-sitter-python (>=0.23.6,<0.24.0)
|
41
|
-
Requires-Dist: tree-sitter-rust (>=0.23.2,<0.24.0)
|
42
|
-
Requires-Dist: tree-sitter-scala (>=0.23.4,<0.24.0)
|
43
|
-
Requires-Dist: tree-sitter-typescript (>=0.23.2,<0.24.0)
|
44
|
-
Description-Content-Type: text/markdown
|
45
|
-
|
46
|
-
# QuantaLogic
|
47
|
-
|
48
|
-
[](https://opensource.org/licenses/Apache-2.0)
|
49
|
-
[](https://www.python.org/downloads/)
|
50
|
-
[](https://quantalogic.github.io/quantalogic/)
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
QuantaLogic is a ReAct (Reasoning & Action) framework for building advanced AI agents.
|
55
|
-
|
56
|
-
|
57
|
-
It seamlessly integrates large language models (LLMs) with a robust tool system, enabling agents to understand, reason about, and execute complex tasks through natural language interaction.
|
58
|
-
|
59
|
-
The `cli` version include coding capabilities comparable to Aider.
|
60
|
-
|
61
|
-
[📖 Documentation](https://quantalogic.github.io/quantalogic/)
|
62
|
-
|
63
|
-

|
64
|
-
|
65
|
-
|
66
|
-
[HowTo Guide](./docs/howto/howto.md)
|
67
|
-
|
68
|
-
## Why QuantaLogic?
|
69
|
-
|
70
|
-
We created [QuantaLogic](https://www.quantalogic.app) because we saw a significant gap between the advanced AI models developed by companies like OpenAI, Anthropic, DeepSeek and their practical implementation in everyday business processes.
|
71
|
-
|
72
|
-
> Our mission is to bridge this gap, making the power of generative AI accessible and actionable for businesses of all sizes.
|
73
|
-
|
74
|
-
|
75
|
-
## 🌟 Highlights
|
76
|
-
|
77
|
-
- **ReAct Framework**: Advanced implementation combining LLM reasoning with concrete actions
|
78
|
-
- **Universal LLM Support**: Integration with OpenAI, Anthropic, LM Studio, Bedrock, Ollama, DeepSeek V3, DeepSeek R1, via LiteLLM. Example usage: `quantalogic --model-name deepseek/deepseek-reasoner` or `quantalogic --model-name openrouter/deepseek/deepseek-r1`
|
79
|
-
- **Secure Tool System**: Docker-based code execution and file manipulation tools
|
80
|
-
- **Real-time Monitoring**: Web interface with SSE-based event visualization
|
81
|
-
- **Memory Management**: Intelligent context handling and optimization
|
82
|
-
- **Enterprise Ready**: Comprehensive logging, error handling, and validation system
|
83
|
-
|
84
|
-
|
85
|
-
## 📋 Table of Contents
|
86
|
-
|
87
|
-
- [Usage](#usage)
|
88
|
-
- [Release Notes](#release-notes)
|
89
|
-
|
90
|
-
- [Installation](#-installation)
|
91
|
-
- [Quick Start](#-quickstart)
|
92
|
-
- [Key Components](#-key-components)
|
93
|
-
- [Agent System](#-agent-system)
|
94
|
-
- [Tool System](#-tool-system)
|
95
|
-
- [Web Interface](#-web-interface)
|
96
|
-
- [Examples](#-examples)
|
97
|
-
- [Development](#-development)
|
98
|
-
- [Contributing](#-contributing)
|
99
|
-
- [License](#-license)
|
100
|
-
- [Documentation Development](#-documentation-development)
|
101
|
-
|
102
|
-
## Usage
|
103
|
-
|
104
|
-
**Usage:** `quantalogic [OPTIONS] COMMAND i[ARGS]...`
|
105
|
-
**Environment Variables:** Set `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, and `DEEPSEEK_API_KEY` for API integration.
|
106
|
-
|
107
|
-
**Options:**
|
108
|
-
- `--model-name TEXT`: Specify the model (litellm format, e.g., "openrouter/deepseek/deepseek-chat")
|
109
|
-
- `--log [info|debug|warning]`: Set logging level
|
110
|
-
- `--mode [code|basic|interpreter|full|code-basic|search|search-full]`: Agent mode
|
111
|
-
- `--vision-model-name TEXT`: Specify vision model (litellm format)
|
112
|
-
- `--max-tokens-working-memory INTEGER`: Maximum tokens in working memory (default: 4000)
|
113
|
-
- `--max-iterations INTEGER`: Maximum task iterations (default: 30)
|
114
|
-
- `--compact-every-n-iteration INTEGER`: Compact memory every N iterations (default: 5)
|
115
|
-
- `--no-stream`: Disable streaming output (default: enabled)
|
116
|
-
- `--help`: Show help message
|
117
|
-
|
118
|
-
**Commands:**
|
119
|
-
|
120
|
-
- `task`: Execute a task with the QuantaLogic AI Assistant
|
121
|
-
- `--file PATH`: Path to task file
|
122
|
-
- `--model-name TEXT`: Specify model
|
123
|
-
- `--verbose`: Enable verbose output
|
124
|
-
- `--mode`: Select agent capabilities
|
125
|
-
- `--log`: Set logging level
|
126
|
-
- `--vision-model-name`: Specify vision model
|
127
|
-
- `--max-iterations`: Maximum task iterations
|
128
|
-
- `--max-tokens-working-memory`: Memory limit
|
129
|
-
- `--compact-every-n-iteration`: Memory optimization
|
130
|
-
- `--no-stream`: Disable streaming
|
131
|
-
|
132
|
-
|
133
|
-
- `list-models`: List available models with optional filtering.
|
134
|
-
- `--search TEXT`: Filter models by name or description.
|
135
|
-
- `--help`: Show help message.
|
136
|
-
|
137
|
-
Example:
|
138
|
-
```bash
|
139
|
-
quantalogic list-models --search qwen
|
140
|
-
```
|
141
|
-
|
142
|
-
Output:
|
143
|
-
```
|
144
|
-
Model Name Description
|
145
|
-
------------------- -------------------------------------------------------
|
146
|
-
dashscope/qwen-max Alibaba's Qwen-Max model optimized for maximum performance
|
147
|
-
dashscope/qwen-plus Alibaba's Qwen-Plus model offering balanced performance
|
148
|
-
```
|
149
|
-
|
150
|
-
|
151
|
-
## Release Notes
|
152
|
-
|
153
|
-
See our [Release Notes](RELEASE_NOTES.MD) for detailed version history and changes.
|
154
|
-
|
155
|
-
[TODO List](TODO.md)
|
156
|
-
|
157
|
-
## Environment Configuration
|
158
|
-
|
159
|
-
### Supported Models
|
160
|
-
|
161
|
-
| Model Name | API Key Environment Variable | Description |
|
162
|
-
|------------|------------------------------|-------------|
|
163
|
-
| openai/gpt-4o-mini | OPENAI_API_KEY | OpenAI's compact version of GPT-4, optimized for efficiency and cost-effectiveness while maintaining strong performance. |
|
164
|
-
| openai/gpt-4o | OPENAI_API_KEY | OpenAI's flagship model offering state-of-the-art performance across various tasks with enhanced reasoning capabilities. |
|
165
|
-
| anthropic/claude-3.5-sonnet | ANTHROPIC_API_KEY | Claude 3.5 Sonnet model from Anthropic, balancing performance and speed with strong reasoning capabilities. |
|
166
|
-
| deepseek/deepseek-chat | DEEPSEEK_API_KEY | DeepSeek's conversational model optimized for chat-based interactions and general-purpose tasks. |
|
167
|
-
| deepseek/deepseek-reasoner | DEEPSEEK_API_KEY | DeepSeek's specialized model for complex reasoning tasks and problem-solving. |
|
168
|
-
| openrouter/deepseek/deepseek-r1 | OPENROUTER_API_KEY | DeepSeek R1 model available through OpenRouter, optimized for research and development tasks. |
|
169
|
-
| openrouter/openai/gpt-4o | OPENROUTER_API_KEY | OpenAI's GPT-4o model accessible through OpenRouter platform. |
|
170
|
-
| openrouter/mistralai/mistral-large-2411 | OPENROUTER_API_KEY | Mistral's large model optimized for complex reasoning tasks, available through OpenRouter with enhanced multilingual capabilities. |
|
171
|
-
| mistral/mistral-large-2407 | MISTRAL_API_KEY | Mistral's high-performance model designed for enterprise-grade applications, offering advanced reasoning and multilingual support. |
|
172
|
-
| nvidia/deepseek-ai/deepseek-r1 | NVIDIA_API_KEY | NVIDIA's DeepSeek R1 model optimized for high-performance AI tasks and advanced reasoning capabilities. |
|
173
|
-
| gemini/gemini-2.0-flash | GEMINI_API_KEY | Google's Gemini Flash 2.0 model offering a balance of speed and performance for various tasks. |
|
174
|
-
| openrouter/google/gemini-2.0-flash-001 | OPENROUTER_API_KEY | Google's Gemini Flash 2.0 model offering a balance of speed and performance for various tasks through the OpenRouter platform. |
|
175
|
-
| ovh/DeepSeek-R1-Distill-Llama-70B | OVH_API_KEY | DeepSeek's R1 model optimized for research and development tasks hosted on OVH in France. |
|
176
|
-
| lm_studio/mistral-small-24b-instruct-2501 | LM_STUDIO_API_KEY | LM Studio's Mistral Small model optimized for local inference with advanced reasoning capabilities. |
|
177
|
-
| dashscope/qwen-max | DASHSCOPE_API_KEY | Alibaba's Qwen-Max model optimized for maximum performance and extensive reasoning capabilities. |
|
178
|
-
| dashscope/qwen-plus | DASHSCOPE_API_KEY | Alibaba's Qwen-Plus model offering balanced performance and cost-efficiency for a variety of tasks. |
|
179
|
-
| dashscope/qwen-turbo | DASHSCOPE_API_KEY | Alibaba's Qwen-Turbo model designed for fast and efficient responses, ideal for high-throughput scenarios. |
|
180
|
-
|
181
|
-
To configure the environment API key for Quantalogic using LiteLLM, set the required environment variable for your chosen provider and any optional variables like `OPENAI_API_BASE` or `OPENROUTER_REFERRER`. Use a `.env` file or a secrets manager to securely store these keys, and load them in your code using `python-dotenv`. For advanced configurations, refer to the [LiteLLM documentation](https://docs.litellm.ai/docs/).
|
182
|
-
|
183
|
-
### LM Studio Local Setup
|
184
|
-
|
185
|
-
To use LM Studio with the Mistral model locally, set the following environment variables:
|
186
|
-
|
187
|
-
```bash
|
188
|
-
export LM_STUDIO_API_BASE="http://localhost:1234/v1"
|
189
|
-
export LM_STUDIO_API_KEY="your-api-key-here"
|
190
|
-
```
|
191
|
-
|
192
|
-
Replace `http://localhost:1234/v1` with your LM Studio server URL and `your-api-key-here` with your actual API key.
|
193
|
-
|
194
|
-
|
195
|
-
## 📦 Installation
|
196
|
-
|
197
|
-
### Prerequisites
|
198
|
-
|
199
|
-
- Python 3.12+
|
200
|
-
- Docker (optional for code execution tools)
|
201
|
-
|
202
|
-
### Via pip
|
203
|
-
|
204
|
-
```bash
|
205
|
-
# Basic installation
|
206
|
-
pip install quantalogic
|
207
|
-
```
|
208
|
-
|
209
|
-
### From Source
|
210
|
-
|
211
|
-
```bash
|
212
|
-
git clone https://github.com/quantalogic/quantalogic.git
|
213
|
-
cd quantalogic
|
214
|
-
python -m venv .venv
|
215
|
-
source ./venv/bin/activate
|
216
|
-
poetry install
|
217
|
-
```
|
218
|
-
|
219
|
-
## Using pipx
|
220
|
-
|
221
|
-
```
|
222
|
-
pipx install quantalogic
|
223
|
-
```
|
224
|
-
|
225
|
-
|
226
|
-
## 🚀 Quickstart
|
227
|
-
|
228
|
-
### Basic Usage
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
### Detailed Usage
|
235
|
-
|
236
|
-
#### Agent Modes
|
237
|
-
- code: Coding-focused agent with basic capabilities
|
238
|
-
- basic: General-purpose agent without coding tools
|
239
|
-
- interpreter: Interactive code execution agent
|
240
|
-
- full: Full-featured agent with all capabilities
|
241
|
-
- code-basic: Coding agent with basic reasoning
|
242
|
-
- search: Web search agent with Wikipedia, DuckDuckGo and SERPApi integration
|
243
|
-
|
244
|
-
#### Task Execution
|
245
|
-
|
246
|
-
Tasks can be provided:
|
247
|
-
|
248
|
-
1. Directly via `task` parameter
|
249
|
-
2. Through a file using --file parameter
|
250
|
-
3. Interactively via standard input
|
251
|
-
|
252
|
-
|
253
|
-
#### Examples
|
254
|
-
|
255
|
-
|
256
|
-
Using a task file:
|
257
|
-
```bash
|
258
|
-
quantalogic task --file tasks/example.md --verbose
|
259
|
-
```
|
260
|
-
|
261
|
-
Selecting agent mode:
|
262
|
-
```bash
|
263
|
-
quantalogic --mode interpreter task "Explain quantum computing"
|
264
|
-
```
|
265
|
-
|
266
|
-
Interactive mode:
|
267
|
-
```bash
|
268
|
-
quantalogic
|
269
|
-
```
|
270
|
-
|
271
|
-
### Using QuantaLogic With code
|
272
|
-
|
273
|
-
```python
|
274
|
-
from quantalogic import Agent
|
275
|
-
|
276
|
-
# Initialize agent with default configuration
|
277
|
-
agent = Agent(model_name="deepseek/deepseek-chat")
|
278
|
-
|
279
|
-
# Execute a task
|
280
|
-
result = agent.solve_task(
|
281
|
-
"Create a Python function that calculates the Fibonacci sequence"
|
282
|
-
)
|
283
|
-
print(result)
|
284
|
-
```
|
285
|
-
|
286
|
-
### Environment Configuration Example
|
287
|
-
|
288
|
-
```python
|
289
|
-
import os
|
290
|
-
|
291
|
-
from quantalogic import Agent
|
292
|
-
|
293
|
-
# Verify that DEEPSEEK_API_KEY is set
|
294
|
-
if not os.environ.get("DEEPSEEK_API_KEY"):
|
295
|
-
raise ValueError("DEEPSEEK_API_KEY environment variable is not set")
|
296
|
-
|
297
|
-
# Initialize the AI agent with default configuration
|
298
|
-
agent = Agent(model_name="deepseek/deepseek-chat")
|
299
|
-
|
300
|
-
# Execute a sample task
|
301
|
-
result = agent.solve_task("Create a Python function that calculates the Fibonacci sequence")
|
302
|
-
print(result)
|
303
|
-
```
|
304
|
-
|
305
|
-
## 📖 Examples
|
306
|
-
|
307
|
-
Watch how QuantaLogic can generate complete tutorials from simple prompts:
|
308
|
-
|
309
|
-
[](./examples/generated_tutorials/python/quantalogic_long.mp4)
|
310
|
-
|
311
|
-
Example prompt: [04-write-a-tutorial.md](./examples/tasks/04-write-a-tutorial.md)
|
312
|
-
|
313
|
-
Here are some practical examples to help you get started:
|
314
|
-
|
315
|
-
|
316
|
-
| Example | Description | File |
|
317
|
-
|---------|-------------|------|
|
318
|
-
| Simple Agent | A basic example of an agent implementation. | [examples/01-simple-agent.py](examples/01-simple-agent.py) |
|
319
|
-
| Agent with Event Monitoring | An example of an agent with event monitoring capabilities. | [examples/02-agent-with-event-monitoring.py](examples/02-agent-with-event-monitoring.py) |
|
320
|
-
| Agent with Interpreter | An example of an agent that includes an interpreter. | [examples/03-agent-with-interpreter.py](examples/03-agent-with-interpreter.py) |
|
321
|
-
| Agent Summary Task | An example of an agent performing a summary task. | [examples/04-agent-summary-task.py](examples/04-agent-summary-task.py) |
|
322
|
-
| Code Example | A general code example. | [examples/05-code.py](examples/05-code.py) |
|
323
|
-
| Code Screen Example | An example demonstrating code execution with screen output. | [examples/06-code-screen.py](examples/06-code-screen.py) |
|
324
|
-
| Write Tutorial | An example of generating a tutorial using the agent. | [examples/07-write-tutorial.py](examples/07-write-tutorial.py) |
|
325
|
-
| PRD Writer | An example of generating a Product Requirements Document (PRD). | [examples/08-prd-writer.py](examples/08-prd-writer.py) |
|
326
|
-
| SQL Query | An example of executing SQL queries using the agent. | [examples/09-sql-query.py](examples/09-sql-query.py) |
|
327
|
-
| Finance Agent | An example of a finance-focused agent. | [examples/10-finance-agent.py](examples/10-finance-agent.py) |
|
328
|
-
| Textual Agent Interface | An example of a textual user interface for the agent. | [examples/11-textual-agent-interface.py](examples/11-textual-agent-interface.py) |
|
329
|
-
|
330
|
-
|
331
|
-
## 🔨 Key Components
|
332
|
-
|
333
|
-
### Agent System
|
334
|
-
|
335
|
-
The core agent implements the `ReAct`paradigm, combining:
|
336
|
-
|
337
|
-
- Language model reasoning
|
338
|
-
- Tool execution capabilities
|
339
|
-
- Memory management
|
340
|
-
- Event handling
|
341
|
-
- Task validation
|
342
|
-
|
343
|
-
QuantaLogic offers both synchronous (`solve_task`) and asynchronous (`async_solve_task`) methods for solving tasks using the ReAct framework. The `async_solve_task` function is specifically designed for asynchronous environments like web servers, allowing for non-blocking execution and improved responsiveness. It takes a task description as input and iteratively reasons and acts upon it using available tools until the task is completed or a maximum number of iterations is reached. This asynchronous approach ensures that the agent can handle complex tasks without tying up resources, making it suitable for applications requiring concurrency and scalability.
|
344
|
-
|
345
|
-
|
346
|
-
```python
|
347
|
-
from quantalogic import Agent
|
348
|
-
from quantalogic.tools import PythonTool, ReadFileTool
|
349
|
-
|
350
|
-
# Create agent with specific tools
|
351
|
-
agent = Agent(
|
352
|
-
model_name="openrouter/deepseek/deepseek-chat",
|
353
|
-
tools=[
|
354
|
-
PythonTool(),
|
355
|
-
ReadFileTool()
|
356
|
-
]
|
357
|
-
)
|
358
|
-
|
359
|
-
```
|
360
|
-
|
361
|
-
### How it works
|
362
|
-
|
363
|
-
|
364
|
-
The ReAct (Reasoning & Action) framework represents a significant advancement in the development of intelligent agents capable of autonomously reasoning through tasks and taking appropriate actions.
|
365
|
-
|
366
|
-
QuantaLogic implements this framework, allowing integration with large language models (LLMs) to construct sophisticated agents that can tackle complex problems through natural language interaction.
|
367
|
-
|
368
|
-
## What is a ReAct Agent?
|
369
|
-
|
370
|
-
### Basic Concept
|
371
|
-
|
372
|
-
A ReAct agent utilizes the synergy of reasoning and action. It not only processes natural language inputs but also executes actions in response to these inputs, utilizing various available tools. This functionality is particularly beneficial for environments where complex tasks can be decomposed into manageable subtasks.
|
373
|
-
|
374
|
-
### The QuantaLogic Implementation
|
375
|
-
|
376
|
-
QuantaLogic provides an effective implementation of the ReAct framework with several core components:
|
377
|
-
|
378
|
-
- **Generative Model**: This serves as the agent's brain, enabling it to interpret tasks and generate human-like text responses.
|
379
|
-
- **Memory Management**: This capability allows the agent to maintain context, keeping track of previous inputs and interactions to provide coherent responses.
|
380
|
-
- **Tool Management**: The agent has access to a diverse range of tools, enabling it to perform actions such as code execution, file manipulation, and API communication.
|
381
|
-
|
382
|
-
## How the ReAct Framework Works
|
383
|
-
|
384
|
-
### Workflow of a ReAct Agent
|
385
|
-
|
386
|
-
The following state diagram shows the core workflow of a QuantaLogic agent:
|
387
|
-
|
388
|
-
```mermaid
|
389
|
-
stateDiagram-v2
|
390
|
-
[*] --> InitializeAgent
|
391
|
-
InitializeAgent --> Idle: Agent Initialized
|
392
|
-
|
393
|
-
state Idle {
|
394
|
-
[*] --> WaitForTask
|
395
|
-
WaitForTask --> SolveTask: Task Received
|
396
|
-
}
|
397
|
-
|
398
|
-
state SolveTask {
|
399
|
-
[*] --> ResetSession
|
400
|
-
ResetSession --> AddSystemPrompt
|
401
|
-
AddSystemPrompt --> PreparePrompt
|
402
|
-
PreparePrompt --> EmitTaskStartEvent
|
403
|
-
EmitTaskStartEvent --> UpdateTokens
|
404
|
-
UpdateTokens --> CompactMemoryIfNeeded
|
405
|
-
CompactMemoryIfNeeded --> GenerateResponse
|
406
|
-
GenerateResponse --> ObserveResponse
|
407
|
-
ObserveResponse --> CheckToolExecution
|
408
|
-
CheckToolExecution --> TaskComplete: Tool Executed (task_complete)
|
409
|
-
CheckToolExecution --> UpdatePrompt: Tool Not Executed
|
410
|
-
UpdatePrompt --> UpdateTokens
|
411
|
-
TaskComplete --> EmitTaskCompleteEvent
|
412
|
-
EmitTaskCompleteEvent --> [*]
|
413
|
-
}
|
414
|
-
|
415
|
-
state CompactMemoryIfNeeded {
|
416
|
-
[*] --> CheckMemoryOccupancy
|
417
|
-
CheckMemoryOccupancy --> CompactMemory: Memory Occupancy > MAX_OCCUPANCY
|
418
|
-
CheckMemoryOccupancy --> [*]: Memory Occupancy <= MAX_OCCUPANCY
|
419
|
-
CompactMemory --> [*]
|
420
|
-
}
|
421
|
-
|
422
|
-
state ObserveResponse {
|
423
|
-
[*] --> ProcessResponse
|
424
|
-
ProcessResponse --> ExecuteTool: Tool Identified
|
425
|
-
ProcessResponse --> UpdateAnswer: No Tool Identified
|
426
|
-
ExecuteTool --> UpdateAnswer
|
427
|
-
UpdateAnswer --> [*]
|
428
|
-
}
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
Idle --> [*]: Task Completed
|
433
|
-
SolveTask --> Idle: Task Completed
|
434
|
-
```
|
435
|
-
|
436
|
-
The following sequence diagram illustrates the workflow of a ReAct agent as it processes and solves a task:
|
437
|
-
|
438
|
-
```mermaid
|
439
|
-
sequenceDiagram
|
440
|
-
participant User
|
441
|
-
participant Agent
|
442
|
-
participant ToolManager
|
443
|
-
participant Memory
|
444
|
-
|
445
|
-
User->>Agent: Submit task
|
446
|
-
Agent->>Memory: Store task details
|
447
|
-
Agent->>ToolManager: Retrieve tools
|
448
|
-
ToolManager-->>Agent: Provide available tools
|
449
|
-
Agent->>Agent: Prepare prompt for task
|
450
|
-
Agent->>Agent: Analyze input and generate response
|
451
|
-
Agent->>ToolManager: Execute required tool
|
452
|
-
ToolManager-->>Agent: Return tool execution result
|
453
|
-
Agent->>User: Present final result
|
454
|
-
```
|
455
|
-
|
456
|
-
### Key Components Explained
|
457
|
-
|
458
|
-
1. **User Input**: The agent begins by receiving a task or question from the user, which initiates the interaction.
|
459
|
-
2. **Memory Management**: Before tackling the task, the agent logs relevant task details into its memory, ensuring it has the necessary context for processing.
|
460
|
-
3. **Tool Retrieval**: The agent communicates with the ToolManager to inquire about available tools that can facilitate the required actions.
|
461
|
-
4. **Prompt Generation**: The agent constructs a prompt that outlines the task specifics, available tools, and any other pertinent context information.
|
462
|
-
5. **Analysis and Response Generation**: The agent uses its generative model to analyze the task input and formulate a response.
|
463
|
-
6. **Tool Execution**: If certain tools are needed for the task, the agent instructs the ToolManager to execute those tools, fetching the results for processing.
|
464
|
-
7. **Output to User**: Finally, the agent compiles and presents the results back to the user.
|
465
|
-
|
466
|
-
### Tool System
|
467
|
-
|
468
|
-
The QuantaLogic framework incorporates a well-defined tool system that enhances the functionality of AI agents by enabling them to perform a variety of tasks efficiently. Each tool is designed to address specific needs that arise in the context of complex problem-solving and task execution:
|
469
|
-
|
470
|
-
1. **Core Functionality**: Tools such as **AgentTool** and **LLMTool** are fundamental to the agent's operation, allowing it to manage tasks and interact with large language models. The integration of these tools enables the agent to process natural language inputs and execute corresponding actions effectively. **AgentTool** enables the agent to delegate tasks to specialized agents, and **LLMTool** provides the agent to explore a specific area of a latent space using role play.
|
471
|
-
|
472
|
-
2. **Code Execution**: Tools like **PythonTool**, **NodeJsTool**, and **ElixirTool** are vital for executing code in different programming languages. This capability allows the agent to handle programming tasks directly, facilitating real-time coding assistance and code evaluation.
|
473
|
-
|
474
|
-
3. **File Operations**: The framework includes tools for file management, such as **ReadFileTool**, **WriteFileTool**, and **ReplaceInFileTool**. These tools are essential for enabling the agent to read from and write to files, as well as update file content dynamically. This functionality supports scenarios where agents need to manipulate data or configuration files as part of the task execution process.
|
475
|
-
|
476
|
-
4. **Search Capabilities**: Tools like **RipgrepTool** and **SearchDefinitionNames** enhance the agent's ability to search through codebases and identify relevant definitions. This is crucial when dealing with large volumes of code, allowing the agent to quickly locate information necessary for problem-solving.
|
477
|
-
|
478
|
-
5. **Utility Functions**: Additional tools such as **DownloadHttpFileTool**, **ListDirectoryTool**, and **ExecuteBashCommandTool** provide broader functionality that supports various tasks, from fetching external resources to executing system commands. These utilities expand the operational scope of agents, allowing them to perform diverse actions beyond simple text processing.
|
479
|
-
|
480
|
-
6. **Documentation and Representation**: Tools like **MarkitdownTool** facilitate the generation of documentation, ensuring that output from the agent can be formatted and presented clearly. This is particularly beneficial for creating reports or guides based on the agent's findings and actions.
|
481
|
-
|
482
|
-
By integrating these tools into its architecture, QuantaLogic allows agents to perform a wide range of tasks autonomously while ensuring that they have the necessary resources and capabilities to do so effectively. This tool system is fundamental to the agent's ability to reason and act in sophisticated ways, thereby enhancing the overall utility of the framework in complex scenarios.
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
### Development
|
487
|
-
|
488
|
-
### Tools Documentation
|
489
|
-
|
490
|
-
For detailed documentation of all available tools, please see [REFERENCE_TOOLS.md](REFERENCE_TOOLS.md).
|
491
|
-
## 🔧 Development
|
492
|
-
### Setup Development Environment
|
493
|
-
|
494
|
-
```bash
|
495
|
-
# Clone repository
|
496
|
-
git clone https://github.com/quantalogic/quantalogic.git
|
497
|
-
cd quantalogic
|
498
|
-
|
499
|
-
# Create virtual environment
|
500
|
-
python -m venv venv
|
501
|
-
source venv/bin/activate # Windows: venv\Scripts\activate
|
502
|
-
|
503
|
-
# Install dependencies
|
504
|
-
poetry install
|
505
|
-
|
506
|
-
```
|
507
|
-
|
508
|
-
### Run Tests
|
509
|
-
|
510
|
-
```bash
|
511
|
-
# Run all tests
|
512
|
-
pytest
|
513
|
-
|
514
|
-
# With coverage
|
515
|
-
pytest --cov=quantalogic
|
516
|
-
|
517
|
-
# Run specific tests
|
518
|
-
pytest tests/unit
|
519
|
-
```
|
520
|
-
|
521
|
-
### Code Quality
|
522
|
-
|
523
|
-
```bash
|
524
|
-
# Format code
|
525
|
-
ruff format
|
526
|
-
|
527
|
-
# Type checking
|
528
|
-
mypy quantalogic
|
529
|
-
|
530
|
-
# Linting
|
531
|
-
ruff check quantalogic
|
532
|
-
```
|
533
|
-
|
534
|
-
## 🤝 Contributing
|
535
|
-
|
536
|
-
1. Fork the repository
|
537
|
-
2. Create a feature branch
|
538
|
-
3. Write tests
|
539
|
-
4. Implement changes
|
540
|
-
5. Submit pull request
|
541
|
-
|
542
|
-
See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
|
543
|
-
|
544
|
-
## 📄 License
|
545
|
-
|
546
|
-
Copyright 2024 QuantaLogic Contributors
|
547
|
-
|
548
|
-
Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for details.
|
549
|
-
|
550
|
-
## Project Growth
|
551
|
-
[](https://star-history.com/#quantalogic/quantalogic&Date)
|
552
|
-
|
553
|
-
Initiated with ❤️ by Raphaël MANSUY. Founder of [Quantalogic](https://www.quantalogic.app).
|
554
|
-
|
File without changes
|
File without changes
|
File without changes
|