mirror of https://github.com/kortix-ai/suna.git
project_id to get sandbox id
This commit is contained in:
parent
5a002001cc
commit
aaf405272f
|
@ -468,7 +468,6 @@ async def start_agent(
|
||||||
thread_id=thread_id,
|
thread_id=thread_id,
|
||||||
instance_id=instance_id,
|
instance_id=instance_id,
|
||||||
project_id=project_id,
|
project_id=project_id,
|
||||||
sandbox=sandbox,
|
|
||||||
model_name=MODEL_NAME_ALIASES.get(body.model_name, body.model_name),
|
model_name=MODEL_NAME_ALIASES.get(body.model_name, body.model_name),
|
||||||
enable_thinking=body.enable_thinking,
|
enable_thinking=body.enable_thinking,
|
||||||
reasoning_effort=body.reasoning_effort,
|
reasoning_effort=body.reasoning_effort,
|
||||||
|
@ -606,7 +605,6 @@ async def run_agent_background(
|
||||||
thread_id: str,
|
thread_id: str,
|
||||||
instance_id: str,
|
instance_id: str,
|
||||||
project_id: str,
|
project_id: str,
|
||||||
sandbox,
|
|
||||||
model_name: str,
|
model_name: str,
|
||||||
enable_thinking: Optional[bool],
|
enable_thinking: Optional[bool],
|
||||||
reasoning_effort: Optional[str],
|
reasoning_effort: Optional[str],
|
||||||
|
@ -737,7 +735,6 @@ async def run_agent_background(
|
||||||
project_id=project_id,
|
project_id=project_id,
|
||||||
stream=stream,
|
stream=stream,
|
||||||
thread_manager=thread_manager,
|
thread_manager=thread_manager,
|
||||||
sandbox=sandbox,
|
|
||||||
model_name=model_name,
|
model_name=model_name,
|
||||||
enable_thinking=enable_thinking,
|
enable_thinking=enable_thinking,
|
||||||
reasoning_effort=reasoning_effort,
|
reasoning_effort=reasoning_effort,
|
||||||
|
@ -1118,7 +1115,6 @@ async def initiate_agent_with_files(
|
||||||
thread_id=thread_id,
|
thread_id=thread_id,
|
||||||
instance_id=instance_id,
|
instance_id=instance_id,
|
||||||
project_id=project_id,
|
project_id=project_id,
|
||||||
sandbox=sandbox,
|
|
||||||
model_name=MODEL_NAME_ALIASES.get(model_name, model_name),
|
model_name=MODEL_NAME_ALIASES.get(model_name, model_name),
|
||||||
enable_thinking=enable_thinking,
|
enable_thinking=enable_thinking,
|
||||||
reasoning_effort=reasoning_effort,
|
reasoning_effort=reasoning_effort,
|
||||||
|
|
|
@ -27,7 +27,6 @@ load_dotenv()
|
||||||
async def run_agent(
|
async def run_agent(
|
||||||
thread_id: str,
|
thread_id: str,
|
||||||
project_id: str,
|
project_id: str,
|
||||||
sandbox,
|
|
||||||
stream: bool,
|
stream: bool,
|
||||||
thread_manager: Optional[ThreadManager] = None,
|
thread_manager: Optional[ThreadManager] = None,
|
||||||
native_max_auto_continues: int = 25,
|
native_max_auto_continues: int = 25,
|
||||||
|
@ -48,6 +47,19 @@ async def run_agent(
|
||||||
if not account_id:
|
if not account_id:
|
||||||
raise ValueError("Could not determine account ID for thread")
|
raise ValueError("Could not determine account ID for thread")
|
||||||
|
|
||||||
|
# Get sandbox info from project
|
||||||
|
project = await client.table('projects').select('*').eq('project_id', project_id).execute()
|
||||||
|
if not project.data or len(project.data) == 0:
|
||||||
|
raise ValueError(f"Project {project_id} not found")
|
||||||
|
|
||||||
|
project_data = project.data[0]
|
||||||
|
sandbox_info = project_data.get('sandbox', {})
|
||||||
|
if not sandbox_info.get('id'):
|
||||||
|
raise ValueError(f"No sandbox found for project {project_id}")
|
||||||
|
|
||||||
|
# Get or start the sandbox
|
||||||
|
sandbox = await get_or_start_sandbox(sandbox_info['id'])
|
||||||
|
|
||||||
# Note: Billing checks are now done in api.py before this function is called
|
# Note: Billing checks are now done in api.py before this function is called
|
||||||
|
|
||||||
thread_manager.add_tool(SandboxShellTool, sandbox=sandbox)
|
thread_manager.add_tool(SandboxShellTool, sandbox=sandbox)
|
||||||
|
|
Loading…
Reference in New Issue