quantalogic 0.50.12__py3-none-any.whl → 0.50.17__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.
@@ -4,64 +4,35 @@
4
4
 
5
5
  # Local application imports
6
6
  import logging
7
- import os
8
- from typing import Any
9
7
 
10
8
  from dotenv import load_dotenv
11
9
 
12
10
  from quantalogic.agent import Agent
13
11
  from quantalogic.console_print_token import console_print_token
14
- from quantalogic.event_emitter import EventEmitter
15
- from quantalogic.memory import AgentMemory
16
12
  from quantalogic.tools import (
17
13
  AgentTool,
18
- BitbucketCloneTool,
19
- BitbucketOperationsTool,
20
- CloneRepoTool,
21
- ComposioTool,
22
- CSVProcessorTool,
23
14
  DownloadHttpFileTool,
24
15
  DuckDuckGoSearchTool,
25
16
  EditWholeContentTool,
26
17
  ExecuteBashCommandTool,
27
- GitOperationsTool,
28
- GoogleNewsTool,
29
18
  InputQuestionTool,
30
19
  ListDirectoryTool,
31
- LLMImageGenerationTool,
32
20
  LLMTool,
33
21
  LLMVisionTool,
34
- MarkdownToDocxTool,
35
- MarkdownToEpubTool,
36
- MarkdownToHtmlTool,
37
- MarkdownToIpynbTool,
38
- MarkdownToLatexTool,
39
- MarkdownToPdfTool,
40
- MarkdownToPptxTool,
41
22
  MarkitdownTool,
42
- MermaidValidatorTool,
43
- NasaApodTool,
44
- NasaNeoWsTool,
45
23
  NodeJsTool,
46
- PrepareDownloadTool,
47
- PresentationLLMTool,
48
- ProductHuntTool,
49
24
  PythonTool,
50
- RagTool,
51
25
  ReadFileBlockTool,
52
26
  ReadFileTool,
53
27
  ReadHTMLTool,
54
28
  ReplaceInFileTool,
55
29
  RipgrepTool,
56
- SafePythonInterpreterTool,
57
30
  SearchDefinitionNames,
58
- SequenceTool,
59
- SQLQueryTool,
60
- SQLQueryToolAdvanced,
61
31
  TaskCompleteTool,
62
32
  WikipediaSearchTool,
63
33
  WriteFileTool,
64
34
  )
35
+ from quantalogic.tools.image_generation import LLMImageGenerationTool
65
36
 
66
37
  load_dotenv()
67
38
 
@@ -289,197 +260,3 @@ def create_basic_agent(
289
260
  )
290
261
 
291
262
 
292
- def create_custom_agent(
293
- model_name: str,
294
- vision_model_name: str | None = None,
295
- no_stream: bool = False,
296
- compact_every_n_iteration: int | None = None,
297
- max_tokens_working_memory: int | None = None,
298
- specific_expertise: str = "",
299
- tools: list[Any] | None = None,
300
- memory: AgentMemory | None = None
301
- ) -> Agent:
302
- """Create an agent with the specified model and tools.
303
-
304
- Args:
305
- model_name (str): Name of the model to use
306
- vision_model_name (str | None): Name of the vision model to use
307
- no_stream (bool, optional): If True, the agent will not stream results.
308
- compact_every_n_iteration (int | None, optional): Frequency of memory compaction.
309
- max_tokens_working_memory (int | None, optional): Maximum tokens for working memory.
310
- specific_expertise (str, optional): Specific expertise of the agent.
311
- tools (list[Any], optional): List of tool configurations to add to the agent.
312
- Each tool config should have:
313
- - type: str - The type of tool
314
- - parameters: dict - The parameters required for the tool
315
- memory (AgentMemory, optional): Memory object to use for the agent.
316
-
317
- Returns:
318
- Agent: An agent with the specified model and tools
319
- """
320
- storage_dir = os.path.join(os.path.dirname(__file__), "storage", "rag")
321
- os.makedirs(storage_dir, exist_ok=True)
322
-
323
- # Rebuild AgentTool to resolve forward references
324
- AgentTool.model_rebuild()
325
-
326
- # Create event emitter
327
- event_emitter = EventEmitter()
328
-
329
- # Define tool mapping with their parameter requirements
330
- tool_mapping = {
331
- "llm": lambda params: LLMTool(
332
- model_name=params.get("model_name", model_name),
333
- on_token=console_print_token if not no_stream else None,
334
- event_emitter=event_emitter
335
- ),
336
- "llm_vision": lambda params: LLMVisionTool(
337
- model_name=params.get("vision_model_name") or vision_model_name,
338
- on_token=console_print_token if not no_stream else None,
339
- event_emitter=event_emitter
340
- ),
341
- "llm_image_generation": lambda params: LLMImageGenerationTool(
342
- # provider=params.get("provider", "dall-e"),
343
- provider="dall-e",
344
- # model_name=params.get("model_name", "openai/dall-e-3"),
345
- model_name="openai/dall-e-3",
346
- on_token=console_print_token if not no_stream else None,
347
- # event_emitter=event_emitter
348
- ),
349
- "download_http_file": lambda params: DownloadHttpFileTool(),
350
- "duck_duck_go_search": lambda params: DuckDuckGoSearchTool(),
351
- "edit_whole_content": lambda params: EditWholeContentTool(),
352
- "execute_bash_command": lambda params: ExecuteBashCommandTool(),
353
- "input_question": lambda params: InputQuestionTool(),
354
- "list_directory": lambda params: ListDirectoryTool(),
355
- "markitdown": lambda params: MarkitdownTool(),
356
- "nodejs": lambda params: NodeJsTool(),
357
- "python": lambda params: PythonTool(),
358
- "read_file_block": lambda params: ReadFileBlockTool(),
359
- "read_file": lambda params: ReadFileTool(),
360
- "read_html": lambda params: ReadHTMLTool(),
361
- "replace_in_file": lambda params: ReplaceInFileTool(),
362
- "ripgrep": lambda params: RipgrepTool(),
363
- "safe_python_interpreter": lambda params: SafePythonInterpreterTool(),
364
- "search_definition_names": lambda params: SearchDefinitionNames(),
365
- "wikipedia_search": lambda params: WikipediaSearchTool(),
366
- "write_file": lambda params: WriteFileTool(),
367
- "google_news": lambda params: GoogleNewsTool(
368
- # model_name=params.get("model_name", model_name),
369
- # on_token=console_print_token if not no_stream else None,
370
- # event_emitter=event_emitter
371
- ),
372
- "presentation_llm": lambda params: PresentationLLMTool(
373
- model_name=params.get("model_name", model_name),
374
- additional_info=params.get("additional_info", ""),
375
- on_token=console_print_token if not no_stream else None,
376
- event_emitter=event_emitter
377
- ),
378
- "sequence": lambda params: SequenceTool(
379
- model_name=params.get("model_name", model_name),
380
- on_token=console_print_token if not no_stream else None,
381
- # event_emitter=event_emitter
382
- ),
383
- "sql_query": lambda params: SQLQueryTool(
384
- connection_string=params.get("connection_string", ""),
385
- model_name=params.get("model_name", model_name),
386
- on_token=console_print_token if not no_stream else None,
387
- # event_emitter=event_emitter
388
- ),
389
- "sql_query_advanced": lambda params: SQLQueryToolAdvanced(
390
- connection_string=params.get("connection_string", ""),
391
- model_name=params.get("model_name", model_name),
392
- on_token=console_print_token if not no_stream else None,
393
- # event_emitter=event_emitter
394
- ),
395
- "clone_repo_tool": lambda params: CloneRepoTool(auth_token=params.get("auth_token", "")),
396
- "bitbucket_clone_repo_tool": lambda params: BitbucketCloneTool(access_token=params.get("access_token", "")),
397
- "bitbucket_operations_tool": lambda params: BitbucketOperationsTool(access_token=params.get("access_token", "")),
398
- "git_operations_tool": lambda params: GitOperationsTool(auth_token=params.get("auth_token", "")),
399
- "markdown_to_pdf": lambda params: MarkdownToPdfTool(),
400
- "markdown_to_pptx": lambda params: MarkdownToPptxTool(),
401
- "markdown_to_html": lambda params: MarkdownToHtmlTool(),
402
- "markdown_to_epub": lambda params: MarkdownToEpubTool(),
403
- "markdown_to_ipynb": lambda params: MarkdownToIpynbTool(),
404
- "markdown_to_latex": lambda params: MarkdownToLatexTool(),
405
- "markdown_to_docx": lambda params: MarkdownToDocxTool(),
406
- "csv_processor": lambda params: CSVProcessorTool(),
407
- "mermaid_validator_tool": lambda params: MermaidValidatorTool(),
408
- "download_file_tool": lambda params: PrepareDownloadTool(),
409
- "email_tool": lambda params: ComposioTool(
410
- action="GMAIL_SEND_EMAIL",
411
- name="email_tool",
412
- description="Send emails via Gmail",
413
- need_validation=False
414
- ),
415
- "callendar_tool": lambda params: ComposioTool(
416
- action="GOOGLECALENDAR_CREATE_EVENT",
417
- name="callendar_tool",
418
- description="Create events in Google Calendar",
419
- need_validation=False
420
- ),
421
- "weather_tool": lambda params: ComposioTool(
422
- action="WEATHERMAP_WEATHER",
423
- name="weather_tool",
424
- description="Get weather information for a location"
425
- ),
426
- "nasa_neows_tool": lambda params: NasaNeoWsTool(),
427
- "nasa_apod_tool": lambda params: NasaApodTool(),
428
- "product_hunt_tool": lambda params : ProductHuntTool(),
429
- "rag_tool": lambda params: RagTool(
430
- vector_store=params.get("vector_store", "chroma"),
431
- embedding_model=params.get("embedding_model", "openai"),
432
- persist_dir=storage_dir,
433
- document_paths=params.get("document_paths", [])
434
- )
435
- }
436
-
437
- # Define write tools that should trigger automatic download tool addition
438
- write_tools = {"write_file", "edit_whole_content", "replace_in_file"}
439
-
440
- agent_tools = []
441
- has_write_tool = any(
442
- tool_config.get("type") in write_tools
443
- for tool_config in (tools or [])
444
- )
445
-
446
- # Add tools only if they are provided
447
- if tools:
448
- for tool_config in tools:
449
- tool_type = tool_config.get("type")
450
- logger.debug(f"Processing tool type: {tool_type}")
451
-
452
- if tool_type in tool_mapping:
453
- try:
454
- # Get tool parameters or empty dict if not provided
455
- tool_params = tool_config.get("parameters", {})
456
-
457
- # Create tool instance with parameters
458
- tool = tool_mapping[tool_type](tool_params)
459
- logger.debug(f"Created tool instance: {tool}")
460
-
461
- if tool: # Some tools (like llm_vision) might return None
462
- agent_tools.append(tool)
463
- logger.info(f"Added tool: {tool_type}")
464
- except Exception as e:
465
- logger.error(f"Failed to create tool {tool_type}: {str(e)}")
466
-
467
- # If any write tool was added, also add the download tool
468
- if has_write_tool:
469
- try:
470
- agent_tools.append(PrepareDownloadTool())
471
- logger.info("Added download tool automatically")
472
- except Exception as e:
473
- logger.error(f"Failed to add download tool: {str(e)}")
474
-
475
- agent_tools.append(TaskCompleteTool())
476
-
477
- return Agent(
478
- model_name=model_name,
479
- tools=agent_tools,
480
- event_emitter=event_emitter,
481
- compact_every_n_iterations=compact_every_n_iteration,
482
- max_tokens_working_memory=max_tokens_working_memory,
483
- specific_expertise=specific_expertise,
484
- memory=memory,
485
- )
@@ -5,7 +5,6 @@ from loguru import logger
5
5
  from quantalogic.agent import Agent
6
6
  from quantalogic.agent_config import (
7
7
  create_basic_agent,
8
- create_custom_agent,
9
8
  create_full_agent,
10
9
  create_interpreter_agent,
11
10
  )
@@ -171,17 +170,17 @@ def create_agent_for_mode(
171
170
  max_tokens_working_memory=max_tokens_working_memory,
172
171
  )
173
172
  return agent
174
- if mode == "custom":
175
- agent = create_custom_agent(
176
- model_name,
177
- vision_model_name,
178
- no_stream=no_stream,
179
- compact_every_n_iteration=compact_every_n_iteration,
180
- max_tokens_working_memory=max_tokens_working_memory,
181
- specific_expertise=specific_expertise,
182
- tools=tools,
183
- memory=memory
184
- )
185
- return agent
173
+ # if mode == "custom":
174
+ # agent = create_custom_agent(
175
+ # model_name,
176
+ # vision_model_name,
177
+ # no_stream=no_stream,
178
+ # compact_every_n_iteration=compact_every_n_iteration,
179
+ # max_tokens_working_memory=max_tokens_working_memory,
180
+ # specific_expertise=specific_expertise,
181
+ # tools=tools,
182
+ # memory=memory
183
+ # )
184
+ # return agent
186
185
  else:
187
186
  raise ValueError(f"Unknown agent mode: {mode}")
@@ -52,7 +52,7 @@ def create_coding_agent(
52
52
  specific_expertise = (
53
53
  "Software expert focused on pragmatic solutions."
54
54
  "Validates codebase pre/post changes."
55
- "Employs SearchDefinitionNames for code search; ReplaceInFileTool for updates."
55
+ "Employs SearchDefinitionNamesTool for code search; ReplaceInFileTool for updates."
56
56
  "Exercise caution with the surrounding context during search/replace operations."
57
57
  "For refactoring tasks, take the time to develop a comprehensive plan for implementing the proposed changes."
58
58
  )
@@ -0,0 +1,254 @@
1
+ # Import statements
2
+ # import os
3
+ # from typing import Any
4
+ # from loguru import logger
5
+ # from quantalogic.agent import Agent, AgentMemory
6
+ # from quantalogic.agent_tools import (
7
+ # AgentTool,
8
+ # DownloadHttpFileTool,
9
+ # DuckDuckGoSearchTool,
10
+ # EditWholeContentTool,
11
+ # ExecuteBashCommandTool,
12
+ # InputQuestionTool,
13
+ # ListDirectoryTool,
14
+ # LLMTool,
15
+ # LLMVisionTool,
16
+ # LLMImageGenerationTool,
17
+ # MarkitdownTool,
18
+ # NodeJsTool,
19
+ # PythonTool,
20
+ # ReadFileBlockTool,
21
+ # ReadFileTool,
22
+ # ReadHTMLTool,
23
+ # ReplaceInFileTool,
24
+ # RipgrepTool,
25
+ # SafePythonInterpreterTool,
26
+ # SearchDefinitionNames,
27
+ # TaskCompleteTool,
28
+ # WikipediaSearchTool,
29
+ # WriteFileTool,
30
+ # GoogleNewsTool,
31
+ # PresentationLLMTool,
32
+ # SequenceTool,
33
+ # SQLQueryTool,
34
+ # SQLQueryToolAdvanced,
35
+ # CloneRepoTool,
36
+ # BitbucketCloneTool,
37
+ # BitbucketOperationsTool,
38
+ # GitOperationsTool,
39
+ # MarkdownToPdfTool,
40
+ # MarkdownToPptxTool,
41
+ # MarkdownToHtmlTool,
42
+ # MarkdownToEpubTool,
43
+ # MarkdownToIpynbTool,
44
+ # MarkdownToLatexTool,
45
+ # MarkdownToDocxTool,
46
+ # CSVProcessorTool,
47
+ # MermaidValidatorTool,
48
+ # PrepareDownloadTool,
49
+ # ComposioTool,
50
+ # NasaNeoWsTool,
51
+ # NasaApodTool,
52
+ # ProductHuntTool,
53
+ # RagTool
54
+ # )
55
+ # from quantalogic.event_emitter import EventEmitter
56
+ # from quantalogic.console_token_printer import console_print_token
57
+
58
+ # Function to create a custom agent
59
+ # def create_custom_agent(
60
+ # model_name: str,
61
+ # vision_model_name: str | None = None,
62
+ # no_stream: bool = False,
63
+ # compact_every_n_iteration: int | None = None,
64
+ # max_tokens_working_memory: int | None = None,
65
+ # specific_expertise: str = "",
66
+ # tools: list[Any] | None = None,
67
+ # memory: AgentMemory | None = None
68
+ # ) -> Agent:
69
+ # """Create an agent with the specified model and tools.
70
+
71
+ # Args:
72
+ # model_name (str): Name of the model to use
73
+ # vision_model_name (str | None): Name of the vision model to use
74
+ # no_stream (bool, optional): If True, the agent will not stream results.
75
+ # compact_every_n_iteration (int | None, optional): Frequency of memory compaction.
76
+ # max_tokens_working_memory (int | None, optional): Maximum tokens for working memory.
77
+ # specific_expertise (str, optional): Specific expertise of the agent.
78
+ # tools (list[Any], optional): List of tool configurations to add to the agent.
79
+ # Each tool config should have:
80
+ # - type: str - The type of tool
81
+ # - parameters: dict - The parameters required for the tool
82
+ # memory (AgentMemory, optional): Memory object to use for the agent.
83
+
84
+ # Returns:
85
+ # Agent: An agent with the specified model and tools
86
+ # """
87
+ # # Create storage directory for RAG
88
+ # # storage_dir = os.path.join(os.path.dirname(__file__), "storage", "rag")
89
+ # # os.makedirs(storage_dir, exist_ok=True)
90
+
91
+ # # Rebuild AgentTool to resolve forward references
92
+ # # AgentTool.model_rebuild()
93
+
94
+ # # Create event emitter
95
+ # # event_emitter = EventEmitter()
96
+
97
+ # # Define tool mapping with their parameter requirements
98
+ # # tool_mapping = {
99
+ # # "llm": lambda params: LLMTool(
100
+ # # model_name=params.get("model_name", model_name),
101
+ # # on_token=console_print_token if not no_stream else None,
102
+ # # event_emitter=event_emitter
103
+ # # ),
104
+ # # "llm_vision": lambda params: LLMVisionTool(
105
+ # # model_name=params.get("vision_model_name") or vision_model_name,
106
+ # # on_token=console_print_token if not no_stream else None,
107
+ # # event_emitter=event_emitter
108
+ # # ),
109
+ # # "llm_image_generation": lambda params: LLMImageGenerationTool(
110
+ # # provider="dall-e",
111
+ # # model_name="openai/dall-e-3",
112
+ # # on_token=console_print_token if not no_stream else None,
113
+ # # ),
114
+ # # "download_http_file": lambda params: DownloadHttpFileTool(),
115
+ # # "duck_duck_go_search": lambda params: DuckDuckGoSearchTool(),
116
+ # # "edit_whole_content": lambda params: EditWholeContentTool(),
117
+ # # "execute_bash_command": lambda params: ExecuteBashCommandTool(),
118
+ # # "input_question": lambda params: InputQuestionTool(),
119
+ # # "list_directory": lambda params: ListDirectoryTool(),
120
+ # # "markitdown": lambda params: MarkitdownTool(),
121
+ # # "nodejs": lambda params: NodeJsTool(),
122
+ # # "python": lambda params: PythonTool(),
123
+ # # "read_file_block": lambda params: ReadFileBlockTool(),
124
+ # # "read_file": lambda params: ReadFileTool(),
125
+ # # "read_html": lambda params: ReadHTMLTool(),
126
+ # # "replace_in_file": lambda params: ReplaceInFileTool(),
127
+ # # "ripgrep": lambda params: RipgrepTool(),
128
+ # # "safe_python_interpreter": lambda params: SafePythonInterpreterTool(),
129
+ # # "search_definition_names": lambda params: SearchDefinitionNames(),
130
+ # # "wikipedia_search": lambda params: WikipediaSearchTool(),
131
+ # # "write_file": lambda params: WriteFileTool(),
132
+ # # "google_news": lambda params: GoogleNewsTool(
133
+ # # model_name=params.get("model_name", model_name),
134
+ # # on_token=console_print_token if not no_stream else None,
135
+ # # event_emitter=event_emitter
136
+ # # ),
137
+ # # "presentation_llm": lambda params: PresentationLLMTool(
138
+ # # model_name=params.get("model_name", model_name),
139
+ # # additional_info=params.get("additional_info", ""),
140
+ # # on_token=console_print_token if not no_stream else None,
141
+ # # event_emitter=event_emitter
142
+ # # ),
143
+ # # "sequence": lambda params: SequenceTool(
144
+ # # model_name=params.get("model_name", model_name),
145
+ # # on_token=console_print_token if not no_stream else None,
146
+ # # event_emitter=event_emitter
147
+ # # ),
148
+ # # "sql_query": lambda params: SQLQueryTool(
149
+ # # connection_string=params.get("connection_string", ""),
150
+ # # model_name=params.get("model_name", model_name),
151
+ # # on_token=console_print_token if not no_stream else None,
152
+ # # event_emitter=event_emitter
153
+ # # ),
154
+ # # "sql_query_advanced": lambda params: SQLQueryToolAdvanced(
155
+ # # connection_string=params.get("connection_string", ""),
156
+ # # model_name=params.get("model_name", model_name),
157
+ # # on_token=console_print_token if not no_stream else None,
158
+ # # event_emitter=event_emitter
159
+ # # ),
160
+ # # "clone_repo_tool": lambda params: CloneRepoTool(auth_token=params.get("auth_token", "")),
161
+ # # "bitbucket_clone_repo_tool": lambda params: BitbucketCloneTool(access_token=params.get("access_token", "")),
162
+ # # "bitbucket_operations_tool": lambda params: BitbucketOperationsTool(access_token=params.get("access_token", "")),
163
+ # # "git_operations_tool": lambda params: GitOperationsTool(auth_token=params.get("auth_token", "")),
164
+ # # "markdown_to_pdf": lambda params: MarkdownToPdfTool(),
165
+ # # "markdown_to_pptx": lambda params: MarkdownToPptxTool(),
166
+ # # "markdown_to_html": lambda params: MarkdownToHtmlTool(),
167
+ # # "markdown_to_epub": lambda params: MarkdownToEpubTool(),
168
+ # # "markdown_to_ipynb": lambda params: MarkdownToIpynbTool(),
169
+ # # "markdown_to_latex": lambda params: MarkdownToLatexTool(),
170
+ # # "markdown_to_docx": lambda params: MarkdownToDocxTool(),
171
+ # # "csv_processor": lambda params: CSVProcessorTool(),
172
+ # # "mermaid_validator_tool": lambda params: MermaidValidatorTool(),
173
+ # # "download_file_tool": lambda params: PrepareDownloadTool(),
174
+ # # "email_tool": lambda params: ComposioTool(
175
+ # # action="GMAIL_SEND_EMAIL",
176
+ # # name="email_tool",
177
+ # # description="Send emails via Gmail",
178
+ # # need_validation=False
179
+ # # ),
180
+ # # "callendar_tool": lambda params: ComposioTool(
181
+ # # action="GOOGLECALENDAR_CREATE_EVENT",
182
+ # # name="callendar_tool",
183
+ # # description="Create events in Google Calendar",
184
+ # # need_validation=False
185
+ # # ),
186
+ # # "weather_tool": lambda params: ComposioTool(
187
+ # # action="WEATHERMAP_WEATHER",
188
+ # # name="weather_tool",
189
+ # # description="Get weather information for a location"
190
+ # # ),
191
+ # # "nasa_neows_tool": lambda params: NasaNeoWsTool(),
192
+ # # "nasa_apod_tool": lambda params: NasaApodTool(),
193
+ # # "product_hunt_tool": lambda params : ProductHuntTool(),
194
+ # # "rag_tool": lambda params: RagTool(
195
+ # # vector_store=params.get("vector_store", "chroma"),
196
+ # # embedding_model=params.get("embedding_model", "openai"),
197
+ # # persist_dir=storage_dir,
198
+ # # document_paths=params.get("document_paths", [])
199
+ # # )
200
+ # # }
201
+
202
+ # # Define write tools that should trigger automatic download tool addition
203
+ # # write_tools = {"write_file", "edit_whole_content", "replace_in_file"}
204
+
205
+ # # Initialize agent tools list
206
+ # # agent_tools = []
207
+ # # Check if any write tools are present
208
+ # # has_write_tool = any(
209
+ # # tool_config.get("type") in write_tools
210
+ # # for tool_config in (tools or [])
211
+ # # )
212
+
213
+ # # Add tools only if they are provided
214
+ # # if tools:
215
+ # # for tool_config in tools:
216
+ # # tool_type = tool_config.get("type")
217
+ # # logger.debug(f"Processing tool type: {tool_type}")
218
+
219
+ # # if tool_type in tool_mapping:
220
+ # # try:
221
+ # # # Get tool parameters or empty dict if not provided
222
+ # # tool_params = tool_config.get("parameters", {})
223
+
224
+ # # # Create tool instance with parameters
225
+ # # tool = tool_mapping[tool_type](tool_params)
226
+ # # logger.debug(f"Created tool instance: {tool}")
227
+
228
+ # # if tool: # Some tools (like llm_vision) might return None
229
+ # # agent_tools.append(tool)
230
+ # # logger.info(f"Added tool: {tool_type}")
231
+ # # except Exception as e:
232
+ # # logger.error(f"Failed to create tool {tool_type}: {str(e)}")
233
+
234
+ # # If any write tool was added, also add the download tool
235
+ # # if has_write_tool:
236
+ # # try:
237
+ # # agent_tools.append(PrepareDownloadTool())
238
+ # # logger.info("Added download tool automatically")
239
+ # # except Exception as e:
240
+ # # logger.error(f"Failed to add download tool: {str(e)}")
241
+
242
+ # # Always add TaskCompleteTool
243
+ # # agent_tools.append(TaskCompleteTool())
244
+
245
+ # # Return the configured Agent
246
+ # # return Agent(
247
+ # # model_name=model_name,
248
+ # # tools=agent_tools,
249
+ # # event_emitter=event_emitter,
250
+ # # compact_every_n_iterations=compact_every_n_iteration,
251
+ # # max_tokens_working_memory=max_tokens_working_memory,
252
+ # # specific_expertise=specific_expertise,
253
+ # # memory=memory,
254
+ # # )