diff --git a/backend/agent/tools/computer_use_tool.py b/backend/agent/tools/computer_use_tool.py index 21766463..c1825803 100644 --- a/backend/agent/tools/computer_use_tool.py +++ b/backend/agent/tools/computer_use_tool.py @@ -4,8 +4,8 @@ import base64 import aiohttp import asyncio import logging -from typing import Optional, Dict, Any, Union -from PIL import Image +from typing import Optional, Dict +import os from agentpress.tool import Tool, ToolResult, openapi_schema, xml_schema from sandbox.sandbox import SandboxToolsBase, Sandbox diff --git a/backend/agent/tools/data_providers/AmazonProvider.py b/backend/agent/tools/data_providers/AmazonProvider.py index 5ecea89e..b2972089 100644 --- a/backend/agent/tools/data_providers/AmazonProvider.py +++ b/backend/agent/tools/data_providers/AmazonProvider.py @@ -1,4 +1,4 @@ -from typing import Dict, Optional +from typing import Dict from agent.tools.data_providers.RapidDataProviderBase import RapidDataProviderBase, EndpointSchema diff --git a/backend/agent/tools/message_tool.py b/backend/agent/tools/message_tool.py index 23c44cd9..3c958c49 100644 --- a/backend/agent/tools/message_tool.py +++ b/backend/agent/tools/message_tool.py @@ -1,4 +1,3 @@ -import os from typing import List, Optional, Union from agentpress.tool import Tool, ToolResult, openapi_schema, xml_schema diff --git a/backend/agent/tools/sb_browser_tool.py b/backend/agent/tools/sb_browser_tool.py index 94fdf666..fd955718 100644 --- a/backend/agent/tools/sb_browser_tool.py +++ b/backend/agent/tools/sb_browser_tool.py @@ -3,7 +3,7 @@ import json from agentpress.tool import ToolResult, openapi_schema, xml_schema from agentpress.thread_manager import ThreadManager -from sandbox.sandbox import SandboxToolsBase, Sandbox +from sandbox.sandbox import SandboxToolsBase from utils.logger import logger diff --git a/backend/agent/tools/sb_deploy_tool.py b/backend/agent/tools/sb_deploy_tool.py index adce2ce0..afadf32d 100644 --- a/backend/agent/tools/sb_deploy_tool.py +++ b/backend/agent/tools/sb_deploy_tool.py @@ -1,7 +1,7 @@ import os from dotenv import load_dotenv from agentpress.tool import ToolResult, openapi_schema, xml_schema -from sandbox.sandbox import SandboxToolsBase, Sandbox +from sandbox.sandbox import SandboxToolsBase from utils.files_utils import clean_path from agentpress.thread_manager import ThreadManager diff --git a/backend/agent/tools/sb_expose_tool.py b/backend/agent/tools/sb_expose_tool.py index d437accf..45b8f8fc 100644 --- a/backend/agent/tools/sb_expose_tool.py +++ b/backend/agent/tools/sb_expose_tool.py @@ -1,6 +1,5 @@ -from typing import Optional from agentpress.tool import ToolResult, openapi_schema, xml_schema -from sandbox.sandbox import SandboxToolsBase, Sandbox +from sandbox.sandbox import SandboxToolsBase from agentpress.thread_manager import ThreadManager class SandboxExposeTool(SandboxToolsBase): diff --git a/backend/agent/tools/sb_files_tool.py b/backend/agent/tools/sb_files_tool.py index 549f6777..3af37e7c 100644 --- a/backend/agent/tools/sb_files_tool.py +++ b/backend/agent/tools/sb_files_tool.py @@ -1,9 +1,7 @@ -from daytona_sdk.process import SessionExecuteRequest -from typing import Optional from agentpress.tool import ToolResult, openapi_schema, xml_schema -from sandbox.sandbox import SandboxToolsBase, Sandbox, get_or_start_sandbox -from utils.files_utils import EXCLUDED_FILES, EXCLUDED_DIRS, EXCLUDED_EXT, should_exclude_file, clean_path +from sandbox.sandbox import SandboxToolsBase +from utils.files_utils import should_exclude_file, clean_path from agentpress.thread_manager import ThreadManager from utils.logger import logger import os diff --git a/backend/agent/tools/sb_shell_tool.py b/backend/agent/tools/sb_shell_tool.py index 33fae063..a1378cb1 100644 --- a/backend/agent/tools/sb_shell_tool.py +++ b/backend/agent/tools/sb_shell_tool.py @@ -1,7 +1,7 @@ -from typing import Optional, Dict, List +from typing import Optional, Dict from uuid import uuid4 from agentpress.tool import ToolResult, openapi_schema, xml_schema -from sandbox.sandbox import SandboxToolsBase, Sandbox +from sandbox.sandbox import SandboxToolsBase from agentpress.thread_manager import ThreadManager class SandboxShellTool(SandboxToolsBase): diff --git a/backend/agent/tools/sb_vision_tool.py b/backend/agent/tools/sb_vision_tool.py index a1e0abad..fd022aa8 100644 --- a/backend/agent/tools/sb_vision_tool.py +++ b/backend/agent/tools/sb_vision_tool.py @@ -4,7 +4,7 @@ import mimetypes from typing import Optional from agentpress.tool import ToolResult, openapi_schema, xml_schema -from sandbox.sandbox import SandboxToolsBase, Sandbox +from sandbox.sandbox import SandboxToolsBase from agentpress.thread_manager import ThreadManager from utils.logger import logger import json diff --git a/backend/agent/tools/web_search_tool.py b/backend/agent/tools/web_search_tool.py index dfa1c87b..b85cec58 100644 --- a/backend/agent/tools/web_search_tool.py +++ b/backend/agent/tools/web_search_tool.py @@ -1,8 +1,5 @@ from tavily import AsyncTavilyClient import httpx -from typing import List, Optional -from datetime import datetime -import os from dotenv import load_dotenv from agentpress.tool import Tool, ToolResult, openapi_schema, xml_schema from utils.config import config diff --git a/backend/agentpress/context_manager.py b/backend/agentpress/context_manager.py index 3fd297ec..11405f40 100644 --- a/backend/agentpress/context_manager.py +++ b/backend/agentpress/context_manager.py @@ -8,7 +8,7 @@ reaching the context window limitations of LLM models. import json from typing import List, Dict, Any, Optional -from litellm import token_counter, completion, completion_cost +from litellm import token_counter, completion_cost from services.supabase import DBConnection from services.llm import make_llm_api_call from utils.logger import logger diff --git a/backend/agentpress/response_processor.py b/backend/agentpress/response_processor.py index 4e48791d..1e60f8c9 100644 --- a/backend/agentpress/response_processor.py +++ b/backend/agentpress/response_processor.py @@ -16,7 +16,7 @@ from typing import List, Dict, Any, Optional, Tuple, AsyncGenerator, Callable, U from dataclasses import dataclass from datetime import datetime, timezone -from litellm import completion_cost, token_counter +from litellm import completion_cost from agentpress.tool import Tool, ToolResult from agentpress.tool_registry import ToolRegistry diff --git a/backend/agentpress/tool.py b/backend/agentpress/tool.py index c804602e..de7a5045 100644 --- a/backend/agentpress/tool.py +++ b/backend/agentpress/tool.py @@ -7,7 +7,7 @@ This module defines the base classes and decorators for creating tools in AgentP - Result containers for standardized tool outputs """ -from typing import Dict, Any, Union, Optional, List, Type +from typing import Dict, Any, Union, Optional, List from dataclasses import dataclass, field from abc import ABC import json diff --git a/backend/agentpress/tool_registry.py b/backend/agentpress/tool_registry.py index 238b7b33..b50438a1 100644 --- a/backend/agentpress/tool_registry.py +++ b/backend/agentpress/tool_registry.py @@ -1,5 +1,5 @@ from typing import Dict, Type, Any, List, Optional, Callable -from agentpress.tool import Tool, SchemaType, ToolSchema +from agentpress.tool import Tool, SchemaType from utils.logger import logger diff --git a/backend/sandbox/api.py b/backend/sandbox/api.py index b1fa3677..cd9edfe5 100644 --- a/backend/sandbox/api.py +++ b/backend/sandbox/api.py @@ -1,12 +1,12 @@ import os -from typing import List, Optional +from typing import Optional from fastapi import FastAPI, UploadFile, File, HTTPException, APIRouter, Form, Depends, Request -from fastapi.responses import Response, JSONResponse +from fastapi.responses import Response from pydantic import BaseModel from utils.logger import logger -from utils.auth_utils import get_current_user_id_from_jwt, get_user_id_from_stream_auth, get_optional_user_id +from utils.auth_utils import get_optional_user_id from sandbox.sandbox import get_or_start_sandbox from services.supabase import DBConnection from agent.api import get_or_create_project_sandbox diff --git a/backend/sandbox/docker/browser_api.py b/backend/sandbox/docker/browser_api.py index 579c8458..471fc6b0 100644 --- a/backend/sandbox/docker/browser_api.py +++ b/backend/sandbox/docker/browser_api.py @@ -1,11 +1,10 @@ from fastapi import FastAPI, APIRouter, HTTPException, Body -from playwright.async_api import async_playwright, Browser, Page, ElementHandle +from playwright.async_api import async_playwright, Browser, Page from pydantic import BaseModel -from typing import Optional, List, Dict, Any, Union +from typing import Optional, List, Dict, Any import asyncio import json import logging -import re import base64 from dataclasses import dataclass, field from datetime import datetime diff --git a/backend/sandbox/sandbox.py b/backend/sandbox/sandbox.py index 0dc365a5..1886c747 100644 --- a/backend/sandbox/sandbox.py +++ b/backend/sandbox/sandbox.py @@ -1,4 +1,3 @@ -import os from typing import Optional from daytona_sdk import Daytona, DaytonaConfig, CreateSandboxParams, Sandbox, SessionExecuteRequest diff --git a/backend/services/billing.py b/backend/services/billing.py index 109237dc..b2438bf4 100644 --- a/backend/services/billing.py +++ b/backend/services/billing.py @@ -5,14 +5,14 @@ stripe listen --forward-to localhost:8000/api/billing/webhook """ from fastapi import APIRouter, HTTPException, Depends, Request -from typing import Optional, Dict, Any, List, Tuple +from typing import Optional, Dict, Tuple import stripe from datetime import datetime, timezone from utils.logger import logger from utils.config import config, EnvMode from services.supabase import DBConnection from utils.auth_utils import get_current_user_id_from_jwt -from pydantic import BaseModel, Field +from pydantic import BaseModel # Initialize Stripe stripe.api_key = config.STRIPE_SECRET_KEY diff --git a/backend/services/llm.py b/backend/services/llm.py index b7a83251..99dad404 100644 --- a/backend/services/llm.py +++ b/backend/services/llm.py @@ -18,8 +18,6 @@ from openai import OpenAIError import litellm from utils.logger import logger from utils.config import config -from datetime import datetime -import traceback # litellm.set_verbose=True litellm.modify_params=True diff --git a/backend/services/supabase.py b/backend/services/supabase.py index e2930075..0bb1419a 100644 --- a/backend/services/supabase.py +++ b/backend/services/supabase.py @@ -2,7 +2,6 @@ Centralized database connection management for AgentPress using Supabase. """ -import os from typing import Optional from supabase import create_async_client, AsyncClient from utils.logger import logger diff --git a/backend/utils/auth_utils.py b/backend/utils/auth_utils.py index f051815b..e2a090b8 100644 --- a/backend/utils/auth_utils.py +++ b/backend/utils/auth_utils.py @@ -1,8 +1,7 @@ -from fastapi import HTTPException, Request, Depends -from typing import Optional, List, Dict, Any +from fastapi import HTTPException, Request +from typing import Optional import jwt from jwt.exceptions import PyJWTError -from utils.logger import logger # This function extracts the user ID from Supabase JWT async def get_current_user_id_from_jwt(request: Request) -> str: diff --git a/backend/utils/logger.py b/backend/utils/logger.py index db7dca53..6f107ee6 100644 --- a/backend/utils/logger.py +++ b/backend/utils/logger.py @@ -13,7 +13,6 @@ import json import sys import os from datetime import datetime -from typing import Any, Dict, Optional from contextvars import ContextVar from functools import wraps import traceback