Installation Type
{modelData === 'Marketplace' && }
diff --git a/install_tool_dependencies.sh b/install_tool_dependencies.sh
index 7f37ee224..360395e50 100755
--- a/install_tool_dependencies.sh
+++ b/install_tool_dependencies.sh
@@ -1,10 +1,19 @@
#!/bin/bash
+# Update and upgrade apt settings and apps
+apt update && apt upgrade -y
+xargs apt install -y < /app/requirements_apt.txt
+
# Run the project's main requirements.txt
pip install -r /app/requirements.txt
-# Loop through the tools directories and install their requirements.txt if they exist
for tool in /app/superagi/tools/* /app/superagi/tools/external_tools/* /app/superagi/tools/marketplace_tools/* ; do
+# Loop through the tools directories and install their apt_requirements.txt if they exist
+ if [ -d "$tool" ] && [ -f "$tool/requirements_apt.txt" ]; then
+ echo "Installing apt requirements for tool: $(basename "$tool")"
+ xargs apt install -y < "$tool/requirements_apt.txt"
+ fi
+# Loop through the tools directories and install their requirements.txt if they exist
if [ -d "$tool" ] && [ -f "$tool/requirements.txt" ]; then
echo "Installing requirements for tool: $(basename "$tool")"
pip install -r "$tool/requirements.txt"
diff --git a/main.py b/main.py
index 5c5314a34..4f3f83865 100644
--- a/main.py
+++ b/main.py
@@ -75,8 +75,13 @@
db_url = urlparse(db_url)
db_url = db_url.scheme + "://" + db_url.netloc + db_url.path
-engine = create_engine(db_url)
-# SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
+engine = create_engine(db_url,
+ pool_size=20, # Maximum number of database connections in the pool
+ max_overflow=50, # Maximum number of connections that can be created beyond the pool_size
+ pool_timeout=30, # Timeout value in seconds for acquiring a connection from the pool
+ pool_recycle=1800, # Recycle connections after this number of seconds (optional)
+ pool_pre_ping=False, # Enable connection health checks (optional)
+ )
# app.add_middleware(DBSessionMiddleware, db_url=f'postgresql://{db_username}:{db_password}@localhost/{db_name}')
app.add_middleware(DBSessionMiddleware, db_url=db_url)
diff --git a/superagi/controllers/agent_execution.py b/superagi/controllers/agent_execution.py
index 955d864a7..9658712ec 100644
--- a/superagi/controllers/agent_execution.py
+++ b/superagi/controllers/agent_execution.py
@@ -129,21 +129,21 @@ def create_agent_execution(agent_execution: AgentExecutionIn,
organisation = agent.get_agent_organisation(db.session)
agent_execution_knowledge = AgentConfiguration.get_agent_config_by_key_and_agent_id(session= db.session, key= 'knowledge', agent_id= agent_execution.agent_id)
-
- EventHandler(session=db.session).create_event('run_created',
+
+ EventHandler(session=db.session).create_event('run_created',
{'agent_execution_id': db_agent_execution.id,
'agent_execution_name':db_agent_execution.name},
- agent_execution.agent_id,
+ agent_execution.agent_id,
organisation.id if organisation else 0)
if agent_execution_knowledge and agent_execution_knowledge.value != 'None':
knowledge_name = Knowledges.get_knowledge_from_id(db.session, int(agent_execution_knowledge.value)).name
if knowledge_name is not None:
- EventHandler(session=db.session).create_event('knowledge_picked',
- {'knowledge_name': knowledge_name,
+ EventHandler(session=db.session).create_event('knowledge_picked',
+ {'knowledge_name': knowledge_name,
'agent_execution_id': db_agent_execution.id},
- agent_execution.agent_id,
+ agent_execution.agent_id,
organisation.id if organisation else 0)
-
+ Models.api_key_from_configurations(session=db.session, organisation_id=organisation.id)
if db_agent_execution.status == "RUNNING":
execute_agent.delay(db_agent_execution.id, datetime.now())
@@ -205,7 +205,7 @@ def create_agent_run(agent_execution: AgentRunIn, Authorize: AuthJWT = Depends(c
#update status from CREATED to RUNNING
db_agent_execution.status = "RUNNING"
db.session.commit()
-
+
AgentExecutionConfiguration.add_or_update_agent_execution_config(session = db.session, execution = db_agent_execution,
agent_execution_configs = agent_execution_configs)
@@ -213,16 +213,16 @@ def create_agent_run(agent_execution: AgentRunIn, Authorize: AuthJWT = Depends(c
EventHandler(session=db.session).create_event('run_created',
{'agent_execution_id': db_agent_execution.id,
'agent_execution_name':db_agent_execution.name},
- agent_execution.agent_id,
+ agent_execution.agent_id,
organisation.id if organisation else 0)
agent_execution_knowledge = AgentConfiguration.get_agent_config_by_key_and_agent_id(session= db.session, key= 'knowledge', agent_id= agent_execution.agent_id)
if agent_execution_knowledge and agent_execution_knowledge.value != 'None':
knowledge_name = Knowledges.get_knowledge_from_id(db.session, int(agent_execution_knowledge.value)).name
if knowledge_name is not None:
- EventHandler(session=db.session).create_event('knowledge_picked',
- {'knowledge_name': knowledge_name,
+ EventHandler(session=db.session).create_event('knowledge_picked',
+ {'knowledge_name': knowledge_name,
'agent_execution_id': db_agent_execution.id},
- agent_execution.agent_id,
+ agent_execution.agent_id,
organisation.id if organisation else 0)
if db_agent_execution.status == "RUNNING":
diff --git a/superagi/controllers/models_controller.py b/superagi/controllers/models_controller.py
index f4f018e9a..abb771060 100644
--- a/superagi/controllers/models_controller.py
+++ b/superagi/controllers/models_controller.py
@@ -4,6 +4,7 @@
from superagi.apm.call_log_helper import CallLogHelper
from superagi.models.models import Models
from superagi.models.models_config import ModelsConfig
+from superagi.config.config import get_config
from fastapi_sqlalchemy import db
import logging
from pydantic import BaseModel
@@ -121,7 +122,9 @@ def get_knowledge_list(page: int = 0, organisation=Depends(get_user_organisation
@router.get("/marketplace/list/{page}", status_code=200)
def get_marketplace_knowledge_list(page: int = 0):
- organisation_id = 2
+ organisation_id = get_config("MARKETPLACE_ORGANISATION_ID")
+ if organisation_id is not None:
+ organisation_id = int(organisation_id)
page_size = 16
query = db.session.query(Models).filter(Models.org_id == organisation_id)
diff --git a/superagi/jobs/scheduling_executor.py b/superagi/jobs/scheduling_executor.py
index 9d61c657c..f0d5a542a 100644
--- a/superagi/jobs/scheduling_executor.py
+++ b/superagi/jobs/scheduling_executor.py
@@ -1,7 +1,9 @@
+import ast
from datetime import datetime
from fastapi import HTTPException
from sqlalchemy.orm import sessionmaker
+from superagi.models.tool import Tool
from superagi.models.workflows.iteration_workflow import IterationWorkflow
from superagi.worker import execute_agent
@@ -60,8 +62,8 @@ def execute_scheduled_agent(self, agent_id: int, name: str):
session.add(agent_execution_config)
organisation = agent.get_agent_organisation(session)
model = session.query(AgentConfiguration.value).filter(AgentConfiguration.agent_id == agent_id).filter(AgentConfiguration.key == 'model').first()[0]
-
- EventHandler(session=session).create_event('run_created',
+
+ EventHandler(session=session).create_event('run_created',
{'agent_execution_id': db_agent_execution.id,
'agent_execution_name':db_agent_execution.name},
agent_id,
@@ -70,10 +72,10 @@ def execute_scheduled_agent(self, agent_id: int, name: str):
if agent_execution_knowledge and agent_execution_knowledge.value != 'None':
knowledge_name = Knowledges.get_knowledge_from_id(session, int(agent_execution_knowledge.value)).name
if knowledge_name is not None:
- EventHandler(session=session).create_event('knowledge_picked',
- {'knowledge_name': knowledge_name,
+ EventHandler(session=session).create_event('knowledge_picked',
+ {'knowledge_name': knowledge_name,
'agent_execution_id': db_agent_execution.id},
- agent_id,
+ agent_id,
organisation.id if organisation else 0)
session.commit()
diff --git a/superagi/models/models.py b/superagi/models/models.py
index 5de459d3f..815697298 100644
--- a/superagi/models/models.py
+++ b/superagi/models/models.py
@@ -6,8 +6,10 @@
from superagi.helper.encyption_helper import decrypt_data
import requests, logging
-# marketplace_url = "https://app.superagi.com/api"
-marketplace_url = "http://localhost:8001"
+marketplace_url = "https://app.superagi.com/api"
+# marketplace_url = "http://localhost:8001"
+
+
class Models(DBBaseModel):
"""
Represents a Model record in the database
diff --git a/superagi/tools/tool_response_query_manager.py b/superagi/tools/tool_response_query_manager.py
index d2caf5e23..2429945b1 100644
--- a/superagi/tools/tool_response_query_manager.py
+++ b/superagi/tools/tool_response_query_manager.py
@@ -11,8 +11,10 @@ def __init__(self, session: Session, agent_execution_id: int,memory:VectorStore)
def get_last_response(self, tool_name: str = None):
return AgentExecutionFeed.get_last_tool_response(self.session, self.agent_execution_id, tool_name)
-
+
def get_relevant_response(self, query: str,metadata:dict, top_k: int = 5):
+ if self.memory is None:
+ return ""
documents = self.memory.get_matching_text(query, metadata=metadata)
relevant_responses = ""
for document in documents["documents"]:
diff --git a/tools.json b/tools.json
index 5c1875c8f..94de16ccc 100644
--- a/tools.json
+++ b/tools.json
@@ -1,8 +1,4 @@
{
- "tools": {
- "DuckDuckGo": "https://github.com/TransformerOptimus/SuperAGI-Tools/tree/main/DuckDuckGo",
- "notion": "https://github.com/TransformerOptimus/SuperAGI-Tools/tree/main/notion",
- "duck_duck_go": "https://github.com/TransformerOptimus/SuperAGI-Tools/tree/main/duck_duck_go",
- "google_analytics": "https://github.com/TransformerOptimus/SuperAGI-Tools/tree/main/google_analytics"
- }
+ "tools": {
+ }
}
\ No newline at end of file