mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
add missing tools
This commit is contained in:
@@ -32,7 +32,7 @@ For authentication details and usage examples, see the
|
||||
|
||||
List endpoints return paginated responses. Use `page` and `page_size` query
|
||||
parameters to navigate results. Maximum page size is 100 items.
|
||||
"""
|
||||
""".strip()
|
||||
|
||||
v2_app = FastAPI(
|
||||
title="AutoGPT Platform External API",
|
||||
|
||||
@@ -61,7 +61,7 @@ async def list_files(
|
||||
description=f"Items per page (max {MAX_PAGE_SIZE})",
|
||||
),
|
||||
auth: APIAuthorizationInfo = Security(
|
||||
require_permission(APIKeyPermission.DOWNLOAD_FILES)
|
||||
require_permission(APIKeyPermission.READ_FILES)
|
||||
),
|
||||
) -> WorkspaceFileListResponse:
|
||||
"""List files in the user's workspace."""
|
||||
@@ -109,7 +109,7 @@ async def list_files(
|
||||
async def get_file(
|
||||
file_id: str,
|
||||
auth: APIAuthorizationInfo = Security(
|
||||
require_permission(APIKeyPermission.DOWNLOAD_FILES)
|
||||
require_permission(APIKeyPermission.READ_FILES)
|
||||
),
|
||||
) -> WorkspaceFileInfo:
|
||||
"""Get metadata for a specific file in the user's workspace."""
|
||||
@@ -147,7 +147,7 @@ async def get_file(
|
||||
async def delete_file(
|
||||
file_id: str,
|
||||
auth: APIAuthorizationInfo = Security(
|
||||
require_permission(APIKeyPermission.UPLOAD_FILES)
|
||||
require_permission(APIKeyPermission.WRITE_FILES)
|
||||
),
|
||||
) -> None:
|
||||
"""Soft-delete a file from the user's workspace."""
|
||||
@@ -188,7 +188,7 @@ async def upload_file(
|
||||
default=24, ge=1, le=48, description="Hours until file expires (1-48)"
|
||||
),
|
||||
auth: APIAuthorizationInfo = Security(
|
||||
require_permission(APIKeyPermission.UPLOAD_FILES)
|
||||
require_permission(APIKeyPermission.WRITE_FILES)
|
||||
),
|
||||
) -> UploadWorkspaceFileResponse:
|
||||
"""
|
||||
@@ -279,7 +279,7 @@ def _sanitize_filename_for_header(filename: str) -> str:
|
||||
async def download_file(
|
||||
file_id: str,
|
||||
auth: APIAuthorizationInfo = Security(
|
||||
require_permission(APIKeyPermission.DOWNLOAD_FILES)
|
||||
require_permission(APIKeyPermission.READ_FILES)
|
||||
),
|
||||
) -> Response:
|
||||
"""Download a file from the user's workspace."""
|
||||
|
||||
@@ -73,6 +73,7 @@ async def list_agents(
|
||||
),
|
||||
page: int = Query(ge=1, default=1),
|
||||
page_size: int = Query(ge=1, le=MAX_PAGE_SIZE, default=DEFAULT_PAGE_SIZE),
|
||||
# This data is public, but we still require auth for access tracking and rate limits
|
||||
auth: APIAuthorizationInfo = Security(require_auth),
|
||||
) -> MarketplaceAgentListResponse:
|
||||
"""List agents available in the marketplace, with optional filtering and sorting."""
|
||||
@@ -102,6 +103,7 @@ async def list_agents(
|
||||
)
|
||||
async def get_agent_by_version(
|
||||
version_id: str,
|
||||
# This data is public, but we still require auth for access tracking and rate limits
|
||||
auth: APIAuthorizationInfo = Security(require_auth),
|
||||
) -> MarketplaceAgentDetails:
|
||||
"""Get details of a marketplace agent by its store listing version ID."""
|
||||
@@ -117,6 +119,7 @@ async def get_agent_by_version(
|
||||
async def get_agent_details(
|
||||
username: str,
|
||||
agent_name: str,
|
||||
# This data is public, but we still require auth for access tracking and rate limits
|
||||
auth: APIAuthorizationInfo = Security(require_auth),
|
||||
) -> MarketplaceAgentDetails:
|
||||
"""Get details of a specific marketplace agent."""
|
||||
@@ -140,7 +143,7 @@ async def add_agent_to_library(
|
||||
username: str,
|
||||
agent_name: str,
|
||||
auth: APIAuthorizationInfo = Security(
|
||||
require_permission(APIKeyPermission.READ_STORE, APIKeyPermission.WRITE_LIBRARY)
|
||||
require_permission(APIKeyPermission.WRITE_LIBRARY)
|
||||
),
|
||||
) -> LibraryAgent:
|
||||
"""Add a marketplace agent to the authenticated user's library."""
|
||||
@@ -183,6 +186,7 @@ async def list_creators(
|
||||
),
|
||||
page: int = Query(ge=1, default=1),
|
||||
page_size: int = Query(ge=1, le=MAX_PAGE_SIZE, default=DEFAULT_PAGE_SIZE),
|
||||
# This data is public, but we still require auth for access tracking and rate limits
|
||||
auth: APIAuthorizationInfo = Security(require_auth),
|
||||
) -> MarketplaceCreatorsResponse:
|
||||
"""List or search marketplace creators."""
|
||||
@@ -210,6 +214,7 @@ async def list_creators(
|
||||
)
|
||||
async def get_creator_details(
|
||||
username: str,
|
||||
# This data is public, but we still require auth for access tracking and rate limits
|
||||
auth: APIAuthorizationInfo = Security(require_auth),
|
||||
) -> MarketplaceCreatorDetails:
|
||||
"""Get a marketplace creator's profile w/ stats."""
|
||||
|
||||
@@ -132,6 +132,10 @@ class SearchFeatureRequestsTool(BaseTool):
|
||||
def name(self) -> str:
|
||||
return "search_feature_requests"
|
||||
|
||||
@property
|
||||
def allow_external_use(self):
|
||||
return True, []
|
||||
|
||||
@property
|
||||
def description(self) -> str:
|
||||
return (
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from prisma.enums import ContentType
|
||||
from prisma.enums import APIKeyPermission, ContentType
|
||||
|
||||
from backend.blocks import get_block
|
||||
from backend.blocks._base import BlockType
|
||||
@@ -49,6 +49,10 @@ class FindBlockTool(BaseTool):
|
||||
def name(self) -> str:
|
||||
return "find_block"
|
||||
|
||||
@property
|
||||
def allow_external_use(self):
|
||||
return True, [APIKeyPermission.READ_BLOCK]
|
||||
|
||||
@property
|
||||
def description(self) -> str:
|
||||
return (
|
||||
|
||||
@@ -19,6 +19,10 @@ class FixAgentGraphTool(BaseTool):
|
||||
def name(self) -> str:
|
||||
return "fix_agent_graph"
|
||||
|
||||
@property
|
||||
def allow_external_use(self):
|
||||
return True, []
|
||||
|
||||
@property
|
||||
def description(self) -> str:
|
||||
return (
|
||||
|
||||
@@ -40,6 +40,10 @@ class GetAgentBuildingGuideTool(BaseTool):
|
||||
def name(self) -> str:
|
||||
return "get_agent_building_guide"
|
||||
|
||||
@property
|
||||
def allow_external_use(self):
|
||||
return True, []
|
||||
|
||||
@property
|
||||
def description(self) -> str:
|
||||
return (
|
||||
|
||||
@@ -36,6 +36,10 @@ class GetMCPGuideTool(BaseTool):
|
||||
def name(self) -> str:
|
||||
return "get_mcp_guide"
|
||||
|
||||
@property
|
||||
def allow_external_use(self):
|
||||
return True, []
|
||||
|
||||
@property
|
||||
def description(self) -> str:
|
||||
return (
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
from typing import Any
|
||||
|
||||
from prisma.enums import APIKeyPermission
|
||||
|
||||
from backend.api.features.library import model as library_model
|
||||
from backend.api.features.library.db import collect_tree_ids
|
||||
from backend.copilot.model import ChatSession
|
||||
@@ -86,6 +88,10 @@ class CreateFolderTool(BaseTool):
|
||||
def name(self) -> str:
|
||||
return "create_folder"
|
||||
|
||||
@property
|
||||
def allow_external_use(self):
|
||||
return True, [APIKeyPermission.WRITE_LIBRARY]
|
||||
|
||||
@property
|
||||
def description(self) -> str:
|
||||
return (
|
||||
@@ -172,6 +178,10 @@ class ListFoldersTool(BaseTool):
|
||||
def name(self) -> str:
|
||||
return "list_folders"
|
||||
|
||||
@property
|
||||
def allow_external_use(self):
|
||||
return True, [APIKeyPermission.READ_LIBRARY]
|
||||
|
||||
@property
|
||||
def description(self) -> str:
|
||||
return (
|
||||
@@ -275,6 +285,10 @@ class UpdateFolderTool(BaseTool):
|
||||
def name(self) -> str:
|
||||
return "update_folder"
|
||||
|
||||
@property
|
||||
def allow_external_use(self):
|
||||
return True, [APIKeyPermission.WRITE_LIBRARY]
|
||||
|
||||
@property
|
||||
def description(self) -> str:
|
||||
return "Update a folder's name, icon, or color."
|
||||
@@ -355,6 +369,10 @@ class MoveFolderTool(BaseTool):
|
||||
def name(self) -> str:
|
||||
return "move_folder"
|
||||
|
||||
@property
|
||||
def allow_external_use(self):
|
||||
return True, [APIKeyPermission.WRITE_LIBRARY]
|
||||
|
||||
@property
|
||||
def description(self) -> str:
|
||||
return (
|
||||
@@ -431,6 +449,10 @@ class DeleteFolderTool(BaseTool):
|
||||
def name(self) -> str:
|
||||
return "delete_folder"
|
||||
|
||||
@property
|
||||
def allow_external_use(self):
|
||||
return True, [APIKeyPermission.WRITE_LIBRARY]
|
||||
|
||||
@property
|
||||
def description(self) -> str:
|
||||
return (
|
||||
@@ -497,6 +519,10 @@ class MoveAgentsToFolderTool(BaseTool):
|
||||
def name(self) -> str:
|
||||
return "move_agents_to_folder"
|
||||
|
||||
@property
|
||||
def allow_external_use(self):
|
||||
return True, [APIKeyPermission.WRITE_LIBRARY]
|
||||
|
||||
@property
|
||||
def description(self) -> str:
|
||||
return (
|
||||
|
||||
@@ -19,6 +19,10 @@ class ValidateAgentGraphTool(BaseTool):
|
||||
def name(self) -> str:
|
||||
return "validate_agent_graph"
|
||||
|
||||
@property
|
||||
def allow_external_use(self):
|
||||
return True, []
|
||||
|
||||
@property
|
||||
def description(self) -> str:
|
||||
return (
|
||||
|
||||
@@ -57,6 +57,10 @@ class WebFetchTool(BaseTool):
|
||||
def name(self) -> str:
|
||||
return "web_fetch"
|
||||
|
||||
@property
|
||||
def allow_external_use(self):
|
||||
return True, []
|
||||
|
||||
@property
|
||||
def description(self) -> str:
|
||||
return (
|
||||
|
||||
@@ -5,6 +5,7 @@ import logging
|
||||
import os
|
||||
from typing import Any, Optional
|
||||
|
||||
from prisma.enums import APIKeyPermission
|
||||
from pydantic import BaseModel
|
||||
|
||||
from backend.copilot.context import (
|
||||
@@ -325,6 +326,10 @@ class ListWorkspaceFilesTool(BaseTool):
|
||||
def name(self) -> str:
|
||||
return "list_workspace_files"
|
||||
|
||||
@property
|
||||
def allow_external_use(self):
|
||||
return True, [APIKeyPermission.READ_FILES]
|
||||
|
||||
@property
|
||||
def description(self) -> str:
|
||||
return (
|
||||
@@ -439,6 +444,10 @@ class ReadWorkspaceFileTool(BaseTool):
|
||||
def name(self) -> str:
|
||||
return "read_workspace_file"
|
||||
|
||||
@property
|
||||
def allow_external_use(self):
|
||||
return True, [APIKeyPermission.READ_FILES]
|
||||
|
||||
@property
|
||||
def description(self) -> str:
|
||||
return (
|
||||
@@ -656,6 +665,10 @@ class WriteWorkspaceFileTool(BaseTool):
|
||||
def name(self) -> str:
|
||||
return "write_workspace_file"
|
||||
|
||||
@property
|
||||
def allow_external_use(self):
|
||||
return True, [APIKeyPermission.WRITE_FILES]
|
||||
|
||||
@property
|
||||
def description(self) -> str:
|
||||
return (
|
||||
@@ -846,6 +859,10 @@ class DeleteWorkspaceFileTool(BaseTool):
|
||||
def name(self) -> str:
|
||||
return "delete_workspace_file"
|
||||
|
||||
@property
|
||||
def allow_external_use(self):
|
||||
return True, [APIKeyPermission.WRITE_FILES]
|
||||
|
||||
@property
|
||||
def description(self) -> str:
|
||||
return (
|
||||
|
||||
@@ -1166,8 +1166,8 @@ enum APIKeyPermission {
|
||||
READ_RUN_REVIEW // Can list pending human-in-the-loop reviews
|
||||
WRITE_RUN_REVIEW // Can submit human-in-the-loop review responses
|
||||
READ_CREDITS // Can get credit balance and transactions
|
||||
UPLOAD_FILES // Can upload files for agent input
|
||||
DOWNLOAD_FILES // Can download files from workspace
|
||||
READ_FILES // Can list and download workspace files
|
||||
WRITE_FILES // Can upload and delete workspace files
|
||||
}
|
||||
|
||||
model APIKey {
|
||||
|
||||
@@ -6938,8 +6938,8 @@
|
||||
"READ_RUN_REVIEW",
|
||||
"WRITE_RUN_REVIEW",
|
||||
"READ_CREDITS",
|
||||
"UPLOAD_FILES",
|
||||
"DOWNLOAD_FILES"
|
||||
"READ_FILES",
|
||||
"WRITE_FILES"
|
||||
],
|
||||
"title": "APIKeyPermission"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user