AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
feat(platform): AutoPilot runs read-only and workspace blocks and workflows without asking, and names the block or workflow on every card (#14837)
Reinier van der Leer67b126cee887
diff --git a/.secrets.baseline b/.secrets.baselineindex 26543521bf..3720c681e0 100644--- a/.secrets.baseline+++ b/.secrets.baseline@@ -240,7 +240,7 @@"filename": "autogpt_platform/backend/backend/blocks/google/docs.py","hashed_secret": "c95da0c6696342c867ef0c8258d2f74d20fd94d4","is_verified": false,- "line_number": 203+ "line_number": 204}],"autogpt_platform/backend/backend/blocks/google/sheets.py": [@@ -249,7 +249,7 @@"filename": "autogpt_platform/backend/backend/blocks/google/sheets.py","hashed_secret": "bd5a04fa3667e693edc13239b6d310c5c7a8564b","is_verified": false,- "line_number": 57+ "line_number": 58}],"autogpt_platform/backend/backend/blocks/linear/_config.py": [@@ -267,7 +267,7 @@"filename": "autogpt_platform/backend/backend/blocks/medium.py","hashed_secret": "ff998abc1ce6d8f01a675fa197368e44c8916e9c","is_verified": false,- "line_number": 131+ "line_number": 132}],"autogpt_platform/backend/backend/blocks/replicate/replicate_block.py": [@@ -617,5 +617,5 @@}]},- "generated_at": "2026-09-23T05:05:41Z"+ "generated_at": "2026-09-23T11:02:10Z"}diff --git a/autogpt_platform/backend/backend/blocks/_base.py b/autogpt_platform/backend/backend/blocks/_base.pyindex 81cc4d499d..727f5d713a 100644--- a/autogpt_platform/backend/backend/blocks/_base.py+++ b/autogpt_platform/backend/backend/blocks/_base.py@@ -65,6 +65,19 @@ BlockTestOutput = BlockOutputEntry | tuple[str, Callable[[Any], bool]]CapabilityKind = Literal["service", "primitive"]+class BlockEffect(Enum):+ """What running the block does, ranked; declared per block, never derived.++ Undeclared (``None``) means unreadable, which every consumer treats as EXTERNAL.+ """++ NONE = "none" # pure computation: no network, no disk, no database+ READ = "read" # fetches or computes; changes nothing+ WORKSPACE = "workspace" # writes only to the user's workspace or key-value store+ PLATFORM = "platform" # changes only the user's own objects on the platform+ EXTERNAL = "external" # changes something outside the platform++class BlockType(Enum):STANDARD = "Standard"INPUT = "Input"@@ -591,6 +604,7 @@ class Block(ABC, Generic[BlockSchemaInputType, BlockSchemaOutputType]):webhook_config: Optional[BlockWebhookConfig | BlockManualWebhookConfig] = None,is_irreversible_action: bool = False,capability_kind: CapabilityKind | None = None,+ effect: BlockEffect | None = None,):"""Initialize the block with the given schema.@@ -616,6 +630,8 @@ class Block(ABC, Generic[BlockSchemaInputType, BlockSchemaOutputType]):Defaults to ``service`` when the block's credentials name exactlyone provider and ``primitive`` otherwise; set it explicitly onprovider-backed generic blocks (code sandboxes, SQL, HTTP).+ effect: What running the block does; see BlockEffect. Irreversible+ implies EXTERNAL."""self.id = idself.input_schema = input_schema@@ -633,6 +649,7 @@ class Block(ABC, Generic[BlockSchemaInputType, BlockSchemaOutputType]):self.webhook_config = webhook_configself.is_irreversible_action = is_irreversible_actionself._capability_kind: CapabilityKind | None = capability_kind+ self.effect = effect# Read from ClassVar set by initialize_blocks()self.optimized_description: str | None = type(self)._optimized_descriptionself.execution_stats: NodeExecutionStats = NodeExecutionStats()diff --git a/autogpt_platform/backend/backend/blocks/agent_mail/attachments.py b/autogpt_platform/backend/backend/blocks/agent_mail/attachments.pyindex 02604de85d..47531c34a5 100644--- a/autogpt_platform/backend/backend/blocks/agent_mail/attachments.py+++ b/autogpt_platform/backend/backend/blocks/agent_mail/attachments.py@@ -15,6 +15,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -78,6 +79,7 @@ class AgentMailGetMessageAttachmentBlock(Block):test_mock={"get_attachment": lambda *a, **kw: b"test",},+ effect=BlockEffect.READ,)@staticmethod@@ -170,6 +172,7 @@ class AgentMailGetThreadAttachmentBlock(Block):test_mock={"get_attachment": lambda *a, **kw: b"test",},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/agent_mail/drafts.py b/autogpt_platform/backend/backend/blocks/agent_mail/drafts.pyindex 3dcd6ac4c8..8dd8db61b8 100644--- a/autogpt_platform/backend/backend/blocks/agent_mail/drafts.py+++ b/autogpt_platform/backend/backend/blocks/agent_mail/drafts.py@@ -12,6 +12,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -210,6 +211,7 @@ class AgentMailGetDraftBlock(Block):},)(),},+ effect=BlockEffect.READ,)@staticmethod@@ -305,6 +307,7 @@ class AgentMailListDraftsBlock(Block):},)(),},+ effect=BlockEffect.READ,)@staticmethod@@ -506,6 +509,7 @@ class AgentMailSendDraftBlock(Block):},)(),},+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -572,6 +576,7 @@ class AgentMailDeleteDraftBlock(Block):test_mock={"delete_draft": lambda *a, **kw: None,},+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -653,6 +658,7 @@ class AgentMailListOrgDraftsBlock(Block):},)(),},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/agent_mail/inbox.py b/autogpt_platform/backend/backend/blocks/agent_mail/inbox.pyindex edee5ce5a7..d1ac5322c7 100644--- a/autogpt_platform/backend/backend/blocks/agent_mail/inbox.py+++ b/autogpt_platform/backend/backend/blocks/agent_mail/inbox.py@@ -12,6 +12,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -172,6 +173,7 @@ class AgentMailGetInboxBlock(Block):},)(),},+ effect=BlockEffect.READ,)@staticmethod@@ -255,6 +257,7 @@ class AgentMailListInboxesBlock(Block):},)(),},+ effect=BlockEffect.READ,)@staticmethod@@ -397,6 +400,7 @@ class AgentMailDeleteInboxBlock(Block):test_mock={"delete_inbox": lambda *a, **kw: None,},+ effect=BlockEffect.EXTERNAL,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/agent_mail/lists.py b/autogpt_platform/backend/backend/blocks/agent_mail/lists.pyindex 07e5450197..e7ca6be50d 100644--- a/autogpt_platform/backend/backend/blocks/agent_mail/lists.py+++ b/autogpt_platform/backend/backend/blocks/agent_mail/lists.py@@ -17,6 +17,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -107,6 +108,7 @@ class AgentMailListEntriesBlock(Block):},)(),},+ effect=BlockEffect.READ,)@staticmethod@@ -201,6 +203,7 @@ class AgentMailCreateListEntryBlock(Block):},)(),},+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -286,6 +289,7 @@ class AgentMailGetListEntryBlock(Block):},)(),},+ effect=BlockEffect.READ,)@staticmethod@@ -358,6 +362,7 @@ class AgentMailDeleteListEntryBlock(Block):test_mock={"delete_entry": lambda *a, **kw: None,},+ effect=BlockEffect.EXTERNAL,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/agent_mail/messages.py b/autogpt_platform/backend/backend/blocks/agent_mail/messages.pyindex 46da5e66be..254b578290 100644--- a/autogpt_platform/backend/backend/blocks/agent_mail/messages.py+++ b/autogpt_platform/backend/backend/blocks/agent_mail/messages.py@@ -10,6 +10,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -111,6 +112,7 @@ class AgentMailSendMessageBlock(Block):},)(),},+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -223,6 +225,7 @@ class AgentMailListMessagesBlock(Block):},)(),},+ effect=BlockEffect.READ,)@staticmethod@@ -326,6 +329,7 @@ class AgentMailGetMessageBlock(Block):},)(),},+ effect=BlockEffect.READ,)@staticmethod@@ -425,6 +429,7 @@ class AgentMailReplyToMessageBlock(Block):},)(),},+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -546,6 +551,7 @@ class AgentMailForwardMessageBlock(Block):},)(),},+ effect=BlockEffect.EXTERNAL,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/agent_mail/pods.py b/autogpt_platform/backend/backend/blocks/agent_mail/pods.pyindex f17a071146..0a11514947 100644--- a/autogpt_platform/backend/backend/blocks/agent_mail/pods.py+++ b/autogpt_platform/backend/backend/blocks/agent_mail/pods.py@@ -11,6 +11,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -133,6 +134,7 @@ class AgentMailGetPodBlock(Block):},)(),},+ effect=BlockEffect.READ,)@staticmethod@@ -212,6 +214,7 @@ class AgentMailListPodsBlock(Block):},)(),},+ effect=BlockEffect.READ,)@staticmethod@@ -273,6 +276,7 @@ class AgentMailDeletePodBlock(Block):test_mock={"delete_pod": lambda *a, **kw: None,},+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -350,6 +354,7 @@ class AgentMailListPodInboxesBlock(Block):},)(),},+ effect=BlockEffect.READ,)@staticmethod@@ -443,6 +448,7 @@ class AgentMailListPodThreadsBlock(Block):},)(),},+ effect=BlockEffect.READ,)@staticmethod@@ -532,6 +538,7 @@ class AgentMailListPodDraftsBlock(Block):},)(),},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/agent_mail/threads.py b/autogpt_platform/backend/backend/blocks/agent_mail/threads.pyindex cc91669584..202fd4c272 100644--- a/autogpt_platform/backend/backend/blocks/agent_mail/threads.py+++ b/autogpt_platform/backend/backend/blocks/agent_mail/threads.py@@ -10,6 +10,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -90,6 +91,7 @@ class AgentMailListInboxThreadsBlock(Block):},)(),},+ effect=BlockEffect.READ,)@staticmethod@@ -179,6 +181,7 @@ class AgentMailGetInboxThreadBlock(Block):},)(),},+ effect=BlockEffect.READ,)@staticmethod@@ -245,6 +248,7 @@ class AgentMailDeleteInboxThreadBlock(Block):test_mock={"delete_thread": lambda *a, **kw: None,},+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -331,6 +335,7 @@ class AgentMailListOrgThreadsBlock(Block):},)(),},+ effect=BlockEffect.READ,)@staticmethod@@ -415,6 +420,7 @@ class AgentMailGetOrgThreadBlock(Block):},)(),},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/ai_condition.py b/autogpt_platform/backend/backend/blocks/ai_condition.pyindex f2697131b2..ac9759e4e5 100644--- a/autogpt_platform/backend/backend/blocks/ai_condition.py+++ b/autogpt_platform/backend/backend/blocks/ai_condition.py@@ -7,6 +7,7 @@ if TYPE_CHECKING:from backend.blocks._base import (BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -133,6 +134,7 @@ class AIConditionBlock(AIBlockBase):reasoning=None,)},+ effect=BlockEffect.READ,)async def llm_call(diff --git a/autogpt_platform/backend/backend/blocks/ai_image_customizer.py b/autogpt_platform/backend/backend/blocks/ai_image_customizer.pyindex f63e6833dc..b0964c4c7f 100644--- a/autogpt_platform/backend/backend/blocks/ai_image_customizer.py+++ b/autogpt_platform/backend/backend/blocks/ai_image_customizer.py@@ -9,6 +9,7 @@ from replicate.helpers import FileOutputfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -129,6 +130,7 @@ class AIImageCustomizerBlock(Block):),},test_credentials=TEST_CREDENTIALS,+ effect=BlockEffect.WORKSPACE,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/ai_image_generator_block.py b/autogpt_platform/backend/backend/blocks/ai_image_generator_block.pyindex 864abee530..e3926c1dca 100644--- a/autogpt_platform/backend/backend/blocks/ai_image_generator_block.py+++ b/autogpt_platform/backend/backend/blocks/ai_image_generator_block.py@@ -8,6 +8,7 @@ from replicate.helpers import FileOutputfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockSchemaInput,BlockSchemaOutput,)@@ -184,6 +185,7 @@ class AIImageGeneratorBlock(Block):"data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAQAcJYgCdAEO")},+ effect=BlockEffect.WORKSPACE,)async def _run_client(diff --git a/autogpt_platform/backend/backend/blocks/ai_music_generator.py b/autogpt_platform/backend/backend/blocks/ai_music_generator.pyindex 9a0639a9c0..3258de7ae5 100644--- a/autogpt_platform/backend/backend/blocks/ai_music_generator.py+++ b/autogpt_platform/backend/backend/blocks/ai_music_generator.py@@ -9,6 +9,7 @@ from replicate.client import Client as ReplicateClientfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -145,6 +146,7 @@ class AIMusicGeneratorBlock(Block):"run_model": lambda api_key, music_gen_model_version, prompt, duration, temperature, top_k, top_p, classifier_free_guidance, output_format, normalization_strategy: "https://replicate.com/output/generated-audio-url.wav",},test_credentials=TEST_CREDENTIALS,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/ai_shortform_video_block.py b/autogpt_platform/backend/backend/blocks/ai_shortform_video_block.pyindex 2c53748fde..b40fdf225f 100644--- a/autogpt_platform/backend/backend/blocks/ai_shortform_video_block.py+++ b/autogpt_platform/backend/backend/blocks/ai_shortform_video_block.py@@ -9,6 +9,7 @@ from pydantic import SecretStrfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -292,6 +293,7 @@ class AIShortformVideoCreatorBlock(Block):"wait_for_video": lambda *args, **kwargs: "data:video/mp4;base64,AAAA",},test_credentials=TEST_CREDENTIALS,+ effect=BlockEffect.WORKSPACE,)async def run(@@ -482,6 +484,7 @@ class AIAdMakerVideoCreatorBlock(Block):"wait_for_video": lambda *args, **kwargs: "data:video/mp4;base64,AAAA",},test_credentials=TEST_CREDENTIALS,+ effect=BlockEffect.WORKSPACE,)async def run(@@ -677,6 +680,7 @@ class AIScreenshotToVideoAdBlock(Block):"wait_for_video": lambda *args, **kwargs: "data:video/mp4;base64,AAAA",},test_credentials=TEST_CREDENTIALS,+ effect=BlockEffect.WORKSPACE,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/airtable/bases.py b/autogpt_platform/backend/backend/blocks/airtable/bases.pyindex 550f6b7fdc..16a581ce2c 100644--- a/autogpt_platform/backend/backend/blocks/airtable/bases.py+++ b/autogpt_platform/backend/backend/blocks/airtable/bases.py@@ -8,6 +8,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -143,6 +144,7 @@ class AirtableListBasesBlock(Block):categories={BlockCategory.DATA},input_schema=self.Input,output_schema=self.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/airtable/records.py b/autogpt_platform/backend/backend/blocks/airtable/records.pyindex 5778273147..8d8e0620f6 100644--- a/autogpt_platform/backend/backend/blocks/airtable/records.py+++ b/autogpt_platform/backend/backend/blocks/airtable/records.py@@ -8,6 +8,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -83,6 +84,7 @@ class AirtableListRecordsBlock(Block):categories={BlockCategory.DATA},input_schema=self.Input,output_schema=self.Output,+ effect=BlockEffect.READ,)async def run(@@ -170,6 +172,7 @@ class AirtableGetRecordBlock(Block):categories={BlockCategory.DATA},input_schema=self.Input,output_schema=self.Output,+ effect=BlockEffect.READ,)async def run(@@ -363,6 +366,7 @@ class AirtableDeleteRecordsBlock(Block):input_schema=self.Input,output_schema=self.Output,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/airtable/schema.py b/autogpt_platform/backend/backend/blocks/airtable/schema.pyindex 715df6f0eb..2e6f54daad 100644--- a/autogpt_platform/backend/backend/blocks/airtable/schema.py+++ b/autogpt_platform/backend/backend/blocks/airtable/schema.py@@ -6,6 +6,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -43,6 +44,7 @@ class AirtableListSchemaBlock(Block):categories={BlockCategory.DATA},input_schema=self.Input,output_schema=self.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/allquiet/incident_search.py b/autogpt_platform/backend/backend/blocks/allquiet/incident_search.pyindex 6be2857b1a..515293faa7 100644--- a/autogpt_platform/backend/backend/blocks/allquiet/incident_search.py+++ b/autogpt_platform/backend/backend/blocks/allquiet/incident_search.py@@ -7,6 +7,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -82,6 +83,7 @@ class AllQuietGetIncidentBlock(Block):test_mock={"get_incident": lambda *args, **kwargs: (TEST_INCIDENT, ""),},+ effect=BlockEffect.READ,)@staticmethod@@ -220,6 +222,7 @@ class AllQuietListIncidentsBlock(Block):test_mock={"list_incidents": lambda *args, **kwargs: ([TEST_INCIDENT], False),},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/allquiet/incidents.py b/autogpt_platform/backend/backend/blocks/allquiet/incidents.pyindex f26a5cd766..f898d7f72d 100644--- a/autogpt_platform/backend/backend/blocks/allquiet/incidents.py+++ b/autogpt_platform/backend/backend/blocks/allquiet/incidents.py@@ -6,6 +6,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -120,6 +121,7 @@ class AllQuietCreateIncidentBlock(Block):],test_mock={"create_incident": lambda *args, **kwargs: TEST_INCIDENT},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/allquiet/on_call.py b/autogpt_platform/backend/backend/blocks/allquiet/on_call.pyindex 513ff3674c..6f31418521 100644--- a/autogpt_platform/backend/backend/blocks/allquiet/on_call.py+++ b/autogpt_platform/backend/backend/blocks/allquiet/on_call.py@@ -4,6 +4,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -92,6 +93,7 @@ class AllQuietGetOnCallBlock(Block):("has_coverage", True),],test_mock={"get_on_call": lambda *args, **kwargs: [TEST_SHIFT]},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/allquiet/teams.py b/autogpt_platform/backend/backend/blocks/allquiet/teams.pyindex 1927f5ca05..5d8190e757 100644--- a/autogpt_platform/backend/backend/blocks/allquiet/teams.py+++ b/autogpt_platform/backend/backend/blocks/allquiet/teams.py@@ -4,6 +4,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -73,6 +74,7 @@ class AllQuietListTeamsBlock(Block):("has_more", False),],test_mock={"list_teams": lambda *args, **kwargs: ([TEST_TEAM], False)},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/apollo/organization.py b/autogpt_platform/backend/backend/blocks/apollo/organization.pyindex 66b87ca6b9..f5e2e9b048 100644--- a/autogpt_platform/backend/backend/blocks/apollo/organization.py+++ b/autogpt_platform/backend/backend/blocks/apollo/organization.py@@ -1,6 +1,7 @@from backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -204,6 +205,7 @@ To find IDs, identify the values for organization_id when you call this endpoint)]},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/apollo/people.py b/autogpt_platform/backend/backend/blocks/apollo/people.pyindex 5d4f3c22ec..28bb4e4255 100644--- a/autogpt_platform/backend/backend/blocks/apollo/people.py+++ b/autogpt_platform/backend/backend/blocks/apollo/people.py@@ -3,6 +3,7 @@ import asynciofrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -300,6 +301,7 @@ class SearchPeopleBlock(Block):),]},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/apollo/person.py b/autogpt_platform/backend/backend/blocks/apollo/person.pyindex 4d586175e0..afdd160f0f 100644--- a/autogpt_platform/backend/backend/blocks/apollo/person.py+++ b/autogpt_platform/backend/backend/blocks/apollo/person.py@@ -1,6 +1,7 @@from backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -124,6 +125,7 @@ class GetPersonDetailBlock(Block):linkedin_url="https://www.linkedin.com/in/johndoe",)},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_bluesky.py b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_bluesky.pyindex 83bd7d5b43..1956a0f568 100644--- a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_bluesky.py+++ b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_bluesky.py@@ -3,6 +3,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaOutput,BlockType,@@ -56,6 +57,7 @@ class PostToBlueskyBlock(Block):input_schema=PostToBlueskyBlock.Input,output_schema=PostToBlueskyBlock.Output,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_facebook.py b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_facebook.pyindex 438cfc95aa..3419248a43 100644--- a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_facebook.py+++ b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_facebook.py@@ -3,6 +3,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaOutput,BlockType,@@ -114,6 +115,7 @@ class PostToFacebookBlock(Block):input_schema=PostToFacebookBlock.Input,output_schema=PostToFacebookBlock.Output,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_gmb.py b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_gmb.pyindex 64bb45d31d..9384afdf58 100644--- a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_gmb.py+++ b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_gmb.py@@ -3,6 +3,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaOutput,BlockType,@@ -112,6 +113,7 @@ class PostToGMBBlock(Block):input_schema=PostToGMBBlock.Input,output_schema=PostToGMBBlock.Output,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_instagram.py b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_instagram.pyindex c7a2794dd7..38e08e50ab 100644--- a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_instagram.py+++ b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_instagram.py@@ -5,6 +5,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaOutput,BlockType,@@ -106,6 +107,7 @@ class PostToInstagramBlock(Block):input_schema=PostToInstagramBlock.Input,output_schema=PostToInstagramBlock.Output,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_linkedin.py b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_linkedin.pyindex da2f55b6c2..c46bd8aa35 100644--- a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_linkedin.py+++ b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_linkedin.py@@ -3,6 +3,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaOutput,BlockType,@@ -111,6 +112,7 @@ class PostToLinkedInBlock(Block):input_schema=PostToLinkedInBlock.Input,output_schema=PostToLinkedInBlock.Output,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_pinterest.py b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_pinterest.pyindex 64ba141c2d..ea441180fa 100644--- a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_pinterest.py+++ b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_pinterest.py@@ -3,6 +3,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaOutput,BlockType,@@ -86,6 +87,7 @@ class PostToPinterestBlock(Block):input_schema=PostToPinterestBlock.Input,output_schema=PostToPinterestBlock.Output,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_reddit.py b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_reddit.pyindex b3f6fd6195..0cba3f3c90 100644--- a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_reddit.py+++ b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_reddit.py@@ -3,6 +3,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaOutput,BlockType,@@ -37,6 +38,7 @@ class PostToRedditBlock(Block):input_schema=PostToRedditBlock.Input,output_schema=PostToRedditBlock.Output,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_snapchat.py b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_snapchat.pyindex 5a06f2bad8..6549e2a7c0 100644--- a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_snapchat.py+++ b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_snapchat.py@@ -3,6 +3,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaOutput,BlockType,@@ -69,6 +70,7 @@ class PostToSnapchatBlock(Block):input_schema=PostToSnapchatBlock.Input,output_schema=PostToSnapchatBlock.Output,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_telegram.py b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_telegram.pyindex 706e6322c9..b0055a064c 100644--- a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_telegram.py+++ b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_telegram.py@@ -3,6 +3,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaOutput,BlockType,@@ -56,6 +57,7 @@ class PostToTelegramBlock(Block):input_schema=PostToTelegramBlock.Input,output_schema=PostToTelegramBlock.Output,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_threads.py b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_threads.pyindex b66d49144b..c41aa2bfdf 100644--- a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_threads.py+++ b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_threads.py@@ -3,6 +3,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaOutput,BlockType,@@ -49,6 +50,7 @@ class PostToThreadsBlock(Block):input_schema=PostToThreadsBlock.Input,output_schema=PostToThreadsBlock.Output,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_tiktok.py b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_tiktok.pyindex 6458ab0e27..fbaaf26462 100644--- a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_tiktok.py+++ b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_tiktok.py@@ -5,6 +5,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaOutput,BlockType,@@ -115,6 +116,7 @@ class PostToTikTokBlock(Block):input_schema=PostToTikTokBlock.Input,output_schema=PostToTikTokBlock.Output,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_x.py b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_x.pyindex 1e561e93e1..88eab13ac3 100644--- a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_x.py+++ b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_x.py@@ -3,6 +3,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaOutput,BlockType,@@ -114,6 +115,7 @@ class PostToXBlock(Block):input_schema=PostToXBlock.Input,output_schema=PostToXBlock.Output,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_youtube.py b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_youtube.pyindex 7919831685..33d061b6a2 100644--- a/autogpt_platform/backend/backend/blocks/ayrshare/post_to_youtube.py+++ b/autogpt_platform/backend/backend/blocks/ayrshare/post_to_youtube.py@@ -6,6 +6,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaOutput,BlockType,@@ -144,6 +145,7 @@ class PostToYouTubeBlock(Block):input_schema=PostToYouTubeBlock.Input,output_schema=PostToYouTubeBlock.Output,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/baas/bots.py b/autogpt_platform/backend/backend/blocks/baas/bots.pyindex 453291b46b..5f118a4df4 100644--- a/autogpt_platform/backend/backend/blocks/baas/bots.py+++ b/autogpt_platform/backend/backend/blocks/baas/bots.py@@ -11,6 +11,7 @@ from backend.sdk import (BlockCategory,BlockCost,BlockCostType,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -85,6 +86,7 @@ class BaasBotJoinMeetingBlock(Block):input_schema=self.Input,output_schema=self.Output,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(@@ -177,6 +179,7 @@ class BaasBotFetchMeetingDataBlock(Block):categories={BlockCategory.DATA},input_schema=self.Input,output_schema=self.Output,+ effect=BlockEffect.READ,)async def run(@@ -232,6 +235,7 @@ class BaasBotDeleteRecordingBlock(Block):input_schema=self.Input,output_schema=self.Output,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/bannerbear/text_overlay.py b/autogpt_platform/backend/backend/blocks/bannerbear/text_overlay.pyindex 62aaf63d88..b72c99b683 100644--- a/autogpt_platform/backend/backend/blocks/bannerbear/text_overlay.py+++ b/autogpt_platform/backend/backend/blocks/bannerbear/text_overlay.py@@ -11,6 +11,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -152,6 +153,7 @@ class BannerbearTextOverlayBlock(Block):}},test_credentials=TEST_CREDENTIALS,+ effect=BlockEffect.WORKSPACE,)async def _make_api_request(self, payload: dict, api_key: str) -> dict:diff --git a/autogpt_platform/backend/backend/blocks/basic.py b/autogpt_platform/backend/backend/blocks/basic.pyindex 4fd9ceba57..4b8793e79f 100644--- a/autogpt_platform/backend/backend/blocks/basic.py+++ b/autogpt_platform/backend/backend/blocks/basic.py@@ -5,6 +5,7 @@ from typing import Anyfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -107,6 +108,7 @@ class StoreValueBlock(Block):("output", "Existing Data"), # Data is provided, so data is returned.],static_output=True,+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:@@ -134,6 +136,7 @@ class PrintToConsoleBlock(Block):("output", "Hello, World!"),("status", "printed"),],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:@@ -191,6 +194,7 @@ class UniversalTypeConverterBlock(Block):categories={BlockCategory.BASIC},input_schema=UniversalTypeConverterBlock.Input,output_schema=UniversalTypeConverterBlock.Output,+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:@@ -230,6 +234,7 @@ class ReverseListOrderBlock(Block):output_schema=ReverseListOrderBlock.Output,test_input={"input_list": [1, 2, 3, 4, 5]},test_output=[("reversed_list", [5, 4, 3, 2, 1])],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:diff --git a/autogpt_platform/backend/backend/blocks/branching.py b/autogpt_platform/backend/backend/blocks/branching.pyindex fa4d8089ff..35dd86f67a 100644--- a/autogpt_platform/backend/backend/blocks/branching.py+++ b/autogpt_platform/backend/backend/blocks/branching.py@@ -4,6 +4,7 @@ from typing import Anyfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -75,6 +76,7 @@ class ConditionBlock(Block):("result", True),("yes_output", "Greater"),],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:@@ -188,6 +190,7 @@ class IfInputMatchesBlock(Block):# ("result", True),# ("yes_output", "Yes"),],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:diff --git a/autogpt_platform/backend/backend/blocks/code_extraction_block.py b/autogpt_platform/backend/backend/blocks/code_extraction_block.pyindex bde4bc9fc6..0e5531c50b 100644--- a/autogpt_platform/backend/backend/blocks/code_extraction_block.py+++ b/autogpt_platform/backend/backend/blocks/code_extraction_block.py@@ -3,6 +3,7 @@ import refrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -53,6 +54,7 @@ class CodeExtractionBlock(Block):("python", "print('Hello World')"),("remaining_text", "Here's a Python example:\nAnd some HTML:"),],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:diff --git a/autogpt_platform/backend/backend/blocks/count_words_and_char_block.py b/autogpt_platform/backend/backend/blocks/count_words_and_char_block.pyindex 041f1bfaa1..60d974fb08 100644--- a/autogpt_platform/backend/backend/blocks/count_words_and_char_block.py+++ b/autogpt_platform/backend/backend/blocks/count_words_and_char_block.py@@ -1,6 +1,7 @@from backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -34,6 +35,7 @@ class WordCharacterCountBlock(Block):output_schema=WordCharacterCountBlock.Output,test_input={"text": "Hello, how are you?"},test_output=[("word_count", 4), ("character_count", 19)],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:diff --git a/autogpt_platform/backend/backend/blocks/data_manipulation.py b/autogpt_platform/backend/backend/blocks/data_manipulation.pyindex 577040c6e9..31448bdf61 100644--- a/autogpt_platform/backend/backend/blocks/data_manipulation.py+++ b/autogpt_platform/backend/backend/blocks/data_manipulation.py@@ -3,6 +3,7 @@ from typing import Any, Listfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -57,6 +58,7 @@ class CreateDictionaryBlock(Block):{"numbers": [1, 2, 3], "active": True, "score": 95.5},),],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:@@ -131,6 +133,7 @@ class AddToDictionaryBlock(Block):},),],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:@@ -179,6 +182,7 @@ class FindInDictionaryBlock(Block):("output", ["v1", "v3"]),],categories={BlockCategory.BASIC},+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:@@ -241,6 +245,7 @@ class RemoveFromDictionaryBlock(Block):("removed_value", 2),("updated_dictionary", {"y": "world"}),],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:@@ -289,6 +294,7 @@ class ReplaceDictionaryValueBlock(Block):("updated_dictionary", {"x": "hello", "y": "universe"}),("old_value", "world"),],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:@@ -318,6 +324,7 @@ class DictionaryIsEmptyBlock(Block):output_schema=DictionaryIsEmptyBlock.Output,test_input=[{"dictionary": {}}, {"dictionary": {"a": 1}}],test_output=[("is_empty", True), ("is_empty", False)],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:@@ -376,6 +383,7 @@ class CreateListBlock(Block):[1, 2, 3, "four", {"key": "value"}],),],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:@@ -468,6 +476,7 @@ class AddToListBlock(Block):("updated_list", ["a", "b", "c", "d"]),("updated_list", ["a", "f", "g", "e", "b"]),],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:@@ -515,6 +524,7 @@ class FindInListBlock(Block):("found", False),("not_found_value", 6),],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:@@ -551,6 +561,7 @@ class GetListItemBlock(Block):("item", 2),("item", 3),],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:@@ -594,6 +605,7 @@ class RemoveFromListBlock(Block):("removed_item", 2),("updated_list", ["a", "c"]),],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:@@ -645,6 +657,7 @@ class ReplaceListItemBlock(Block):("updated_list", ["a", "c"]),("old_item", "b"),],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:@@ -676,6 +689,7 @@ class ListIsEmptyBlock(Block):output_schema=ListIsEmptyBlock.Output,test_input=[{"list": []}, {"list": [1]}],test_output=[("is_empty", True), ("is_empty", False)],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:@@ -928,6 +942,7 @@ class ConcatenateListsBlock(Block):("concatenated_list", [1, 2, 3]),("length", 3),],+ effect=BlockEffect.NONE,)def _validate_inputs(self, lists: List[Any]) -> str | None:@@ -1036,6 +1051,7 @@ class FlattenListBlock(Block):("length", 3),("original_depth", 1),],+ effect=BlockEffect.NONE,)def _compute_depth(self, items: List[Any]) -> int:@@ -1115,6 +1131,7 @@ class InterleaveListsBlock(Block):("interleaved_list", []),("length", 0),],+ effect=BlockEffect.NONE,)def _validate_inputs(self, lists: List[Any]) -> str | None:@@ -1196,6 +1213,7 @@ class ZipListsBlock(Block):("zipped_list", []),("length", 0),],+ effect=BlockEffect.NONE,)def _validate_inputs(self, lists: List[Any]) -> str | None:@@ -1308,6 +1326,7 @@ class ListDifferenceBlock(Block):("difference", []),("length", 0),],+ effect=BlockEffect.NONE,)def _compute_difference(self, list_a: List[Any], list_b: List[Any]) -> List[Any]:@@ -1387,6 +1406,7 @@ class ListIntersectionBlock(Block):("intersection", []),("length", 0),],+ effect=BlockEffect.NONE,)def _compute_intersection(self, list_a: List[Any], list_b: List[Any]) -> List[Any]:diff --git a/autogpt_platform/backend/backend/blocks/dataforb2b/reasoning.py b/autogpt_platform/backend/backend/blocks/dataforb2b/reasoning.pyindex 2a2ae236e8..21800e1700 100644--- a/autogpt_platform/backend/backend/blocks/dataforb2b/reasoning.py+++ b/autogpt_platform/backend/backend/blocks/dataforb2b/reasoning.py@@ -10,6 +10,7 @@ from backend.blocks.dataforb2b._enums import SearchCategoryfrom backend.sdk import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -128,6 +129,7 @@ class SmartSearchBlock(Block):"results": [{"id": "1"}],}},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/dataforb2b/search.py b/autogpt_platform/backend/backend/blocks/dataforb2b/search.pyindex f492c9fc24..447eefcf94 100644--- a/autogpt_platform/backend/backend/blocks/dataforb2b/search.py+++ b/autogpt_platform/backend/backend/blocks/dataforb2b/search.py@@ -13,6 +13,7 @@ from backend.blocks.dataforb2b._filters import build_slot_condition, finalize_fifrom backend.sdk import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -395,6 +396,7 @@ class PeopleSearchBlock(Block):"results": [{"id": "1"}],}},+ effect=BlockEffect.READ,)@staticmethod@@ -467,6 +469,7 @@ class CompanySearchBlock(Block):"results": [{"id": "1"}],}},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/dataforb2b/typeahead.py b/autogpt_platform/backend/backend/blocks/dataforb2b/typeahead.pyindex 96c5dc3f97..d5c423ceb6 100644--- a/autogpt_platform/backend/backend/blocks/dataforb2b/typeahead.py+++ b/autogpt_platform/backend/backend/blocks/dataforb2b/typeahead.py@@ -10,6 +10,7 @@ from backend.blocks.dataforb2b._enums import TypeaheadTypefrom backend.sdk import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -76,6 +77,7 @@ class SearchFilterTypeaheadBlock(Block):"results": [{"value": "Google"}]}},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/dataforseo/keyword_suggestions.py b/autogpt_platform/backend/backend/blocks/dataforseo/keyword_suggestions.pyindex 1c546615f7..dcbabc76c9 100644--- a/autogpt_platform/backend/backend/blocks/dataforseo/keyword_suggestions.py+++ b/autogpt_platform/backend/backend/blocks/dataforseo/keyword_suggestions.py@@ -8,6 +8,7 @@ from backend.data.model import NodeExecutionStatsfrom backend.sdk import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -277,6 +278,7 @@ class KeywordSuggestionExtractorBlock(Block):("serp_info", None),("clickstream_data", None),],+ effect=BlockEffect.NONE,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/dataforseo/related_keywords.py b/autogpt_platform/backend/backend/blocks/dataforseo/related_keywords.pyindex 711f5ea5ef..24c6e1555e 100644--- a/autogpt_platform/backend/backend/blocks/dataforseo/related_keywords.py+++ b/autogpt_platform/backend/backend/blocks/dataforseo/related_keywords.py@@ -8,6 +8,7 @@ from backend.data.model import NodeExecutionStatsfrom backend.sdk import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -290,6 +291,7 @@ class RelatedKeywordExtractorBlock(Block):("serp_info", None),("clickstream_data", None),],+ effect=BlockEffect.NONE,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/decoder_block.py b/autogpt_platform/backend/backend/blocks/decoder_block.pyindex b9eb56e48f..1a6553db97 100644--- a/autogpt_platform/backend/backend/blocks/decoder_block.py+++ b/autogpt_platform/backend/backend/blocks/decoder_block.py@@ -3,6 +3,7 @@ import codecsfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -38,6 +39,7 @@ World!This is a "quoted" string.""",)],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:diff --git a/autogpt_platform/backend/backend/blocks/discord/bot_blocks.py b/autogpt_platform/backend/backend/blocks/discord/bot_blocks.pyindex 012725f0b8..83110d6282 100644--- a/autogpt_platform/backend/backend/blocks/discord/bot_blocks.py+++ b/autogpt_platform/backend/backend/blocks/discord/bot_blocks.py@@ -11,6 +11,7 @@ from pydantic import SecretStrfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -101,6 +102,7 @@ class ReadDiscordMessagesBlock(Block):"username": "test_user",}},+ effect=BlockEffect.READ,)async def run_bot(self, token: SecretStr):@@ -234,6 +236,7 @@ class SendDiscordMessageBlock(Block):},test_credentials=TEST_CREDENTIALS,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def send_message(@@ -369,6 +372,7 @@ class SendDiscordDMBlock(Block):},test_credentials=TEST_CREDENTIALS,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def send_dm(self, token: str, user_id: str, message_content: str) -> dict:@@ -489,6 +493,7 @@ class SendDiscordEmbedBlock(Block):},test_credentials=TEST_CREDENTIALS,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def send_embed(@@ -661,6 +666,7 @@ class SendDiscordFileBlock(Block):},test_credentials=TEST_CREDENTIALS,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def send_file(@@ -850,6 +856,7 @@ class ReplyToDiscordMessageBlock(Block):},test_credentials=TEST_CREDENTIALS,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def send_reply(@@ -989,6 +996,7 @@ class DiscordUserInfoBlock(Block):}},test_credentials=TEST_CREDENTIALS,+ effect=BlockEffect.READ,)async def get_user_info(self, token: str, user_id: str) -> dict:@@ -1100,6 +1108,7 @@ class DiscordChannelInfoBlock(Block):}},test_credentials=TEST_CREDENTIALS,+ effect=BlockEffect.READ,)async def get_channel_info(@@ -1244,6 +1253,7 @@ class CreateDiscordThreadBlock(Block):},test_credentials=TEST_CREDENTIALS,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def create_thread(diff --git a/autogpt_platform/backend/backend/blocks/email_block.py b/autogpt_platform/backend/backend/blocks/email_block.pyindex f3fe3d2256..219dd90ed4 100644--- a/autogpt_platform/backend/backend/blocks/email_block.py+++ b/autogpt_platform/backend/backend/blocks/email_block.py@@ -10,6 +10,7 @@ from pydantic import BaseModel, ConfigDict, SecretStrfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -98,6 +99,7 @@ class SendEmailBlock(Block):test_output=[("status", "Email sent successfully")],test_mock={"send_email": lambda *args, **kwargs: "Email sent successfully"},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)ALLOWED_SMTP_PORTS = {25, 465, 587, 2525}diff --git a/autogpt_platform/backend/backend/blocks/encoder_block.py b/autogpt_platform/backend/backend/blocks/encoder_block.pyindex bfab8f4555..ff031ea55b 100644--- a/autogpt_platform/backend/backend/blocks/encoder_block.py+++ b/autogpt_platform/backend/backend/blocks/encoder_block.py@@ -5,6 +5,7 @@ import codecsfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -55,6 +56,7 @@ This is a "quoted" string.""""""Hello\\nWorld!\\nThis is a "quoted" string.""",)],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:diff --git a/autogpt_platform/backend/backend/blocks/enrichlayer/linkedin.py b/autogpt_platform/backend/backend/blocks/enrichlayer/linkedin.pyindex de06230c00..5f8107c336 100644--- a/autogpt_platform/backend/backend/blocks/enrichlayer/linkedin.py+++ b/autogpt_platform/backend/backend/blocks/enrichlayer/linkedin.py@@ -11,6 +11,7 @@ from typing import Optionalfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -139,6 +140,7 @@ class GetLinkedinProfileBlock(Block):],),},+ effect=BlockEffect.READ,)@staticmethod@@ -291,6 +293,7 @@ class LinkedinPersonLookupBlock(Block):location_similarity_score=0.20,)},+ effect=BlockEffect.READ,)@staticmethod@@ -405,6 +408,7 @@ class LinkedinRoleLookupBlock(Block):linkedin_profile_url="https://www.linkedin.com/in/williamhgates/",),},+ effect=BlockEffect.READ,)@staticmethod@@ -492,6 +496,7 @@ class GetLinkedinProfilePictureBlock(Block):test_mock={"_get_profile_picture": lambda *args, **kwargs: "https://media.licdn.com/dms/image/C4D03AQFj-xjuXrLFSQ/profile-displayphoto-shrink_800_800/0/1576881858598?e=1686787200&v=beta&t=zrQC76QwsfQQIWthfOnrKRBMZ5D-qIAvzLXLmWgYvTk",},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/exa/answers.py b/autogpt_platform/backend/backend/blocks/exa/answers.pyindex 1017346e05..106e0ef511 100644--- a/autogpt_platform/backend/backend/blocks/exa/answers.py+++ b/autogpt_platform/backend/backend/blocks/exa/answers.py@@ -8,6 +8,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -86,6 +87,7 @@ class ExaAnswerBlock(Block):categories={BlockCategory.SEARCH, BlockCategory.AI},input_schema=ExaAnswerBlock.Input,output_schema=ExaAnswerBlock.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/exa/contents.py b/autogpt_platform/backend/backend/blocks/exa/contents.pyindex 62b0185a38..1e8677ffc3 100644--- a/autogpt_platform/backend/backend/blocks/exa/contents.py+++ b/autogpt_platform/backend/backend/blocks/exa/contents.py@@ -8,6 +8,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -131,6 +132,7 @@ class ExaContentsBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaContentsBlock.Input,output_schema=ExaContentsBlock.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/exa/research.py b/autogpt_platform/backend/backend/blocks/exa/research.pyindex 91693bbe0d..008b6f20ec 100644--- a/autogpt_platform/backend/backend/blocks/exa/research.py+++ b/autogpt_platform/backend/backend/blocks/exa/research.py@@ -16,6 +16,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -313,6 +314,7 @@ class ExaGetResearchBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaGetResearchBlock.Input,output_schema=ExaGetResearchBlock.Output,+ effect=BlockEffect.READ,)async def run(@@ -492,6 +494,7 @@ class ExaListResearchBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaListResearchBlock.Input,output_schema=ExaListResearchBlock.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/exa/search.py b/autogpt_platform/backend/backend/blocks/exa/search.pyindex 4b17048707..4bbd219e1e 100644--- a/autogpt_platform/backend/backend/blocks/exa/search.py+++ b/autogpt_platform/backend/backend/blocks/exa/search.py@@ -8,6 +8,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -129,6 +130,7 @@ class ExaSearchBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaSearchBlock.Input,output_schema=ExaSearchBlock.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/exa/similar.py b/autogpt_platform/backend/backend/blocks/exa/similar.pyindex 9a162480b4..199f166587 100644--- a/autogpt_platform/backend/backend/blocks/exa/similar.py+++ b/autogpt_platform/backend/backend/blocks/exa/similar.py@@ -7,6 +7,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -101,6 +102,7 @@ class ExaFindSimilarBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaFindSimilarBlock.Input,output_schema=ExaFindSimilarBlock.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/exa/websets.py b/autogpt_platform/backend/backend/blocks/exa/websets.pyindex ed3fbf87fc..5d1d0b1435 100644--- a/autogpt_platform/backend/backend/blocks/exa/websets.py+++ b/autogpt_platform/backend/backend/blocks/exa/websets.py@@ -31,6 +31,7 @@ from backend.sdk import (BaseModel,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -617,6 +618,7 @@ class ExaListWebsetsBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaListWebsetsBlock.Input,output_schema=ExaListWebsetsBlock.Output,+ effect=BlockEffect.READ,)async def run(@@ -679,6 +681,7 @@ class ExaGetWebsetBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaGetWebsetBlock.Input,output_schema=ExaGetWebsetBlock.Output,+ effect=BlockEffect.READ,)async def run(@@ -753,6 +756,7 @@ class ExaDeleteWebsetBlock(Block):input_schema=ExaDeleteWebsetBlock.Input,output_schema=ExaDeleteWebsetBlock.Output,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(@@ -962,6 +966,7 @@ class ExaPreviewWebsetBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaPreviewWebsetBlock.Input,output_schema=ExaPreviewWebsetBlock.Output,+ effect=BlockEffect.READ,)async def run(@@ -1059,6 +1064,7 @@ class ExaWebsetStatusBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaWebsetStatusBlock.Input,output_schema=ExaWebsetStatusBlock.Output,+ effect=BlockEffect.READ,)async def run(@@ -1372,6 +1378,7 @@ class ExaWebsetReadyCheckBlock(Block):categories={BlockCategory.SEARCH, BlockCategory.LOGIC},input_schema=ExaWebsetReadyCheckBlock.Input,output_schema=ExaWebsetReadyCheckBlock.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/exa/websets_enrichment.py b/autogpt_platform/backend/backend/blocks/exa/websets_enrichment.pyindex b7c46f1353..498092c183 100644--- a/autogpt_platform/backend/backend/blocks/exa/websets_enrichment.py+++ b/autogpt_platform/backend/backend/blocks/exa/websets_enrichment.py@@ -16,6 +16,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -325,6 +326,7 @@ class ExaGetEnrichmentBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaGetEnrichmentBlock.Input,output_schema=ExaGetEnrichmentBlock.Output,+ effect=BlockEffect.READ,)async def run(@@ -473,6 +475,7 @@ class ExaDeleteEnrichmentBlock(Block):input_schema=ExaDeleteEnrichmentBlock.Input,output_schema=ExaDeleteEnrichmentBlock.Output,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/exa/websets_import_export.py b/autogpt_platform/backend/backend/blocks/exa/websets_import_export.pyindex 27fd593713..00c7e2c336 100644--- a/autogpt_platform/backend/backend/blocks/exa/websets_import_export.py+++ b/autogpt_platform/backend/backend/blocks/exa/websets_import_export.py@@ -20,6 +20,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -421,6 +422,7 @@ class ExaListImportsBlock(Block):categories={BlockCategory.DATA},input_schema=ExaListImportsBlock.Input,output_schema=ExaListImportsBlock.Output,+ effect=BlockEffect.READ,)async def run(@@ -471,6 +473,7 @@ class ExaDeleteImportBlock(Block):input_schema=ExaDeleteImportBlock.Input,output_schema=ExaDeleteImportBlock.Output,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/exa/websets_items.py b/autogpt_platform/backend/backend/blocks/exa/websets_items.pyindex 930d219fb9..0b8adb73ef 100644--- a/autogpt_platform/backend/backend/blocks/exa/websets_items.py+++ b/autogpt_platform/backend/backend/blocks/exa/websets_items.py@@ -22,6 +22,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -172,6 +173,7 @@ class ExaGetWebsetItemBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaGetWebsetItemBlock.Input,output_schema=ExaGetWebsetItemBlock.Output,+ effect=BlockEffect.READ,)async def run(@@ -255,6 +257,7 @@ class ExaListWebsetItemsBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaListWebsetItemsBlock.Input,output_schema=ExaListWebsetItemsBlock.Output,+ effect=BlockEffect.READ,)async def run(@@ -337,6 +340,7 @@ class ExaDeleteWebsetItemBlock(Block):input_schema=ExaDeleteWebsetItemBlock.Input,output_schema=ExaDeleteWebsetItemBlock.Output,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(@@ -568,6 +572,7 @@ class ExaGetNewItemsBlock(Block):categories={BlockCategory.SEARCH, BlockCategory.DATA},input_schema=ExaGetNewItemsBlock.Input,output_schema=ExaGetNewItemsBlock.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/exa/websets_monitor.py b/autogpt_platform/backend/backend/blocks/exa/websets_monitor.pyindex a4d724dd75..2b70676c65 100644--- a/autogpt_platform/backend/backend/blocks/exa/websets_monitor.py+++ b/autogpt_platform/backend/backend/blocks/exa/websets_monitor.py@@ -16,6 +16,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -378,6 +379,7 @@ class ExaGetMonitorBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaGetMonitorBlock.Input,output_schema=ExaGetMonitorBlock.Output,+ effect=BlockEffect.READ,)async def run(@@ -519,6 +521,7 @@ class ExaDeleteMonitorBlock(Block):input_schema=ExaDeleteMonitorBlock.Input,output_schema=ExaDeleteMonitorBlock.Output,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(@@ -579,6 +582,7 @@ class ExaListMonitorsBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaListMonitorsBlock.Input,output_schema=ExaListMonitorsBlock.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/exa/websets_polling.py b/autogpt_platform/backend/backend/blocks/exa/websets_polling.pyindex 07cdcb0cec..26a47b1350 100644--- a/autogpt_platform/backend/backend/blocks/exa/websets_polling.py+++ b/autogpt_platform/backend/backend/blocks/exa/websets_polling.py@@ -17,6 +17,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -335,6 +336,7 @@ class ExaWaitForSearchBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaWaitForSearchBlock.Input,output_schema=ExaWaitForSearchBlock.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/exa/websets_search.py b/autogpt_platform/backend/backend/blocks/exa/websets_search.pyindex 77ba59d98d..fb6b938d7f 100644--- a/autogpt_platform/backend/backend/blocks/exa/websets_search.py+++ b/autogpt_platform/backend/backend/blocks/exa/websets_search.py@@ -16,6 +16,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -437,6 +438,7 @@ class ExaGetWebsetSearchBlock(Block):categories={BlockCategory.SEARCH},input_schema=ExaGetWebsetSearchBlock.Input,output_schema=ExaGetWebsetSearchBlock.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/fal/ai_video_generator.py b/autogpt_platform/backend/backend/blocks/fal/ai_video_generator.pyindex 945e53578c..ec59d83295 100644--- a/autogpt_platform/backend/backend/blocks/fal/ai_video_generator.py+++ b/autogpt_platform/backend/backend/blocks/fal/ai_video_generator.py@@ -6,6 +6,7 @@ from typing import Anyfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -75,6 +76,7 @@ class AIVideoGeneratorBlock(Block):# Use data URI to avoid HTTP requests during tests"generate_video": lambda *args, **kwargs: "data:video/mp4;base64,AAAA"},+ effect=BlockEffect.WORKSPACE,)def _get_headers(self, api_key: str) -> dict[str, str]:diff --git a/autogpt_platform/backend/backend/blocks/firecrawl/crawl.py b/autogpt_platform/backend/backend/blocks/firecrawl/crawl.pyindex 0c88b85e59..45c6dbd315 100644--- a/autogpt_platform/backend/backend/blocks/firecrawl/crawl.py+++ b/autogpt_platform/backend/backend/blocks/firecrawl/crawl.py@@ -9,6 +9,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -69,6 +70,7 @@ class FirecrawlCrawlBlock(Block):categories={BlockCategory.SEARCH},input_schema=self.Input,output_schema=self.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/firecrawl/extract.py b/autogpt_platform/backend/backend/blocks/firecrawl/extract.pyindex c86feb1b09..0f6a1f0620 100755--- a/autogpt_platform/backend/backend/blocks/firecrawl/extract.py+++ b/autogpt_platform/backend/backend/blocks/firecrawl/extract.py@@ -7,6 +7,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -50,6 +51,7 @@ class FirecrawlExtractBlock(Block):categories={BlockCategory.SEARCH},input_schema=self.Input,output_schema=self.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/firecrawl/map.py b/autogpt_platform/backend/backend/blocks/firecrawl/map.pyindex 9d24da7237..bc99d198ab 100644--- a/autogpt_platform/backend/backend/blocks/firecrawl/map.py+++ b/autogpt_platform/backend/backend/blocks/firecrawl/map.py@@ -7,6 +7,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -40,6 +41,7 @@ class FirecrawlMapWebsiteBlock(Block):categories={BlockCategory.SEARCH},input_schema=self.Input,output_schema=self.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/firecrawl/scrape.py b/autogpt_platform/backend/backend/blocks/firecrawl/scrape.pyindex f7923cf07c..b800afbdd1 100644--- a/autogpt_platform/backend/backend/blocks/firecrawl/scrape.py+++ b/autogpt_platform/backend/backend/blocks/firecrawl/scrape.py@@ -8,6 +8,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -68,6 +69,7 @@ class FirecrawlScrapeBlock(Block):categories={BlockCategory.SEARCH},input_schema=self.Input,output_schema=self.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/firecrawl/search.py b/autogpt_platform/backend/backend/blocks/firecrawl/search.pyindex 3c14bcf905..052547dd32 100644--- a/autogpt_platform/backend/backend/blocks/firecrawl/search.py+++ b/autogpt_platform/backend/backend/blocks/firecrawl/search.py@@ -9,6 +9,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -52,6 +53,7 @@ class FirecrawlSearchBlock(Block):categories={BlockCategory.SEARCH},input_schema=self.Input,output_schema=self.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/flux_kontext.py b/autogpt_platform/backend/backend/blocks/flux_kontext.pyindex 7190cde8d6..2227e62e1d 100644--- a/autogpt_platform/backend/backend/blocks/flux_kontext.py+++ b/autogpt_platform/backend/backend/blocks/flux_kontext.py@@ -8,6 +8,7 @@ from replicate.helpers import FileOutputfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -144,6 +145,7 @@ class AIImageEditorBlock(Block):),},test_credentials=TEST_CREDENTIALS,+ effect=BlockEffect.WORKSPACE,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/github/ci.py b/autogpt_platform/backend/backend/blocks/github/ci.pyindex c717be96e7..8e76a8511f 100644--- a/autogpt_platform/backend/backend/blocks/github/ci.py+++ b/autogpt_platform/backend/backend/blocks/github/ci.py@@ -8,6 +8,7 @@ from typing_extensions import TypedDictfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -171,6 +172,7 @@ class GithubGetCIResultsBlock(Block):"total_count": 1,}},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/github/commits.py b/autogpt_platform/backend/backend/blocks/github/commits.pyindex d452ac3af4..b32375192c 100644--- a/autogpt_platform/backend/backend/blocks/github/commits.py+++ b/autogpt_platform/backend/backend/blocks/github/commits.py@@ -8,6 +8,7 @@ from typing_extensions import TypedDictfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -155,6 +156,7 @@ class GithubListCommitsBlock(Block):}]},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/github/issues.py b/autogpt_platform/backend/backend/blocks/github/issues.pyindex 789a8e6193..9045e06e4b 100644--- a/autogpt_platform/backend/backend/blocks/github/issues.py+++ b/autogpt_platform/backend/backend/blocks/github/issues.py@@ -7,6 +7,7 @@ from typing_extensions import TypedDictfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -85,6 +86,7 @@ class GithubCommentBlock(Block):)},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -305,6 +307,7 @@ class GithubListCommentsBlock(Block):}]},+ effect=BlockEffect.READ,)@staticmethod@@ -406,6 +409,7 @@ class GithubMakeIssueBlock(Block):)},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -476,6 +480,7 @@ class GithubReadIssueBlock(Block):"username",)},+ effect=BlockEffect.READ,)@staticmethod@@ -626,6 +631,7 @@ class GithubListIssuesBlock(Block):}]},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/github/notifications.py b/autogpt_platform/backend/backend/blocks/github/notifications.pyindex a008e73f5d..f6bc667fbf 100644--- a/autogpt_platform/backend/backend/blocks/github/notifications.py+++ b/autogpt_platform/backend/backend/blocks/github/notifications.py@@ -3,6 +3,7 @@ from typing_extensions import TypedDictfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -120,6 +121,7 @@ class GithubListNotificationsBlock(Block):test_mock={"list_notifications": lambda *args, **kwargs: [TEST_NOTIFICATION_ITEM]},+ effect=BlockEffect.READ,)@staticmethod@@ -222,6 +224,7 @@ class GithubGetNotificationThreadBlock(Block):test_mock={"get_thread": lambda *args, **kwargs: TEST_NOTIFICATION_ITEM,},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/github/pull_requests.py b/autogpt_platform/backend/backend/blocks/github/pull_requests.pyindex bf2b30142d..28dae8dec5 100644--- a/autogpt_platform/backend/backend/blocks/github/pull_requests.py+++ b/autogpt_platform/backend/backend/blocks/github/pull_requests.py@@ -6,6 +6,7 @@ from typing_extensions import TypedDictfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -117,6 +118,7 @@ class GithubListPullRequestsBlock(Block):}]},+ effect=BlockEffect.READ,)@staticmethod@@ -220,6 +222,7 @@ class GithubMakePullRequestBlock(Block):)},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -341,6 +344,7 @@ class GithubReadPullRequestBlock(Block):"read_pr": lambda *args, **kwargs: TEST_PR_PAYLOAD,"read_pr_changes": lambda *args, **kwargs: "List of changes made in the pull request.",},+ effect=BlockEffect.READ,)async def run(@@ -637,6 +641,7 @@ class GithubListPRReviewersBlock(Block):}]},+ effect=BlockEffect.READ,)@staticmethod@@ -757,6 +762,7 @@ class GithubMergePullRequestBlock(Block):)},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/github/repo.py b/autogpt_platform/backend/backend/blocks/github/repo.pyindex a7f930ba60..665fb150dc 100644--- a/autogpt_platform/backend/backend/blocks/github/repo.py+++ b/autogpt_platform/backend/backend/blocks/github/repo.py@@ -6,6 +6,7 @@ from typing_extensions import TypedDictfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -88,6 +89,7 @@ class GithubListTagsBlock(Block):}]},+ effect=BlockEffect.READ,)@staticmethod@@ -215,6 +217,7 @@ class GithubListDiscussionsBlock(Block):}]},+ effect=BlockEffect.READ,)@staticmethod@@ -435,6 +438,7 @@ class GithubListReleasesBlock(Block):}]},+ effect=BlockEffect.READ,)@staticmethod@@ -678,6 +682,7 @@ class GithubListStargazersBlock(Block):}]},+ effect=BlockEffect.READ,)@staticmethod@@ -774,6 +779,7 @@ class GithubGetRepositoryInfoBlock(Block):"open_issues_count": 3,}},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/github/repo_branches.py b/autogpt_platform/backend/backend/blocks/github/repo_branches.pyindex 9d407043b1..477b39554c 100644--- a/autogpt_platform/backend/backend/blocks/github/repo_branches.py+++ b/autogpt_platform/backend/backend/blocks/github/repo_branches.py@@ -6,6 +6,7 @@ from typing_extensions import TypedDictfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -109,6 +110,7 @@ class GithubListBranchesBlock(Block):}]},+ effect=BlockEffect.READ,)@staticmethod@@ -276,6 +278,7 @@ class GithubDeleteBranchBlock(Block):"delete_branch": lambda *args, **kwargs: "Branch deleted successfully"},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -410,6 +413,7 @@ class GithubCompareBranchesBlock(Block):],}},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/github/repo_files.py b/autogpt_platform/backend/backend/blocks/github/repo_files.pyindex 1bf5b178cd..278c89c29b 100644--- a/autogpt_platform/backend/backend/blocks/github/repo_files.py+++ b/autogpt_platform/backend/backend/blocks/github/repo_files.py@@ -6,6 +6,7 @@ from typing_extensions import TypedDictfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -69,6 +70,7 @@ class GithubReadFileBlock(Block):("size", 13),],test_mock={"read_file": lambda *args, **kwargs: ("RmlsZSBjb250ZW50", 13)},+ effect=BlockEffect.READ,)@staticmethod@@ -185,6 +187,7 @@ class GithubReadFolderBlock(Block):[{"name": "dir2", "path": "path/to/folder/dir2"}],)},+ effect=BlockEffect.READ,)@staticmethod@@ -302,6 +305,7 @@ class GithubCreateFileBlock(Block):"abc123",)},+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -401,6 +405,7 @@ class GithubUpdateFileBlock(Block):"def456",)},+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -541,6 +546,7 @@ class GithubSearchCodeBlock(Block):],)},+ effect=BlockEffect.READ,)@staticmethod@@ -673,6 +679,7 @@ class GithubGetRepositoryTreeBlock(Block):],)},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/github/reviews.py b/autogpt_platform/backend/backend/blocks/github/reviews.pyindex 313acbb701..d8c28ef2a0 100644--- a/autogpt_platform/backend/backend/blocks/github/reviews.py+++ b/autogpt_platform/backend/backend/blocks/github/reviews.py@@ -7,6 +7,7 @@ from typing_extensions import TypedDictfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -109,6 +110,7 @@ class GithubCreatePRReviewBlock(Block):)},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -303,6 +305,7 @@ class GithubListPRReviewsBlock(Block):}]},+ effect=BlockEffect.READ,)@staticmethod@@ -428,6 +431,7 @@ class GithubSubmitPendingReviewBlock(Block):)},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -736,6 +740,7 @@ class GithubGetPRReviewCommentsBlock(Block):}]},+ effect=BlockEffect.READ,)@staticmethod@@ -863,6 +868,7 @@ class GithubCreateCommentObjectBlock(Block):},),],+ effect=BlockEffect.NONE,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/github/users.py b/autogpt_platform/backend/backend/blocks/github/users.pyindex 9741cde359..06effe1cd3 100644--- a/autogpt_platform/backend/backend/blocks/github/users.py+++ b/autogpt_platform/backend/backend/blocks/github/users.py@@ -1,6 +1,7 @@from backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -69,6 +70,7 @@ class GithubGetUserInfoBlock(Block):("user", TEST_USER_PAYLOAD),],test_mock={"get_user": lambda *args, **kwargs: TEST_USER_PAYLOAD},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/google/calendar.py b/autogpt_platform/backend/backend/blocks/google/calendar.pyindex 3b45c1a89a..6d738c4a38 100644--- a/autogpt_platform/backend/backend/blocks/google/calendar.py+++ b/autogpt_platform/backend/backend/blocks/google/calendar.py@@ -11,6 +11,7 @@ from pydantic import BaseModelfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -172,6 +173,7 @@ class GoogleCalendarReadEventsBlock(Block):},"_format_events": lambda *args, **kwargs: [test_event_dict],},+ effect=BlockEffect.READ,)async def run(@@ -479,6 +481,7 @@ class GoogleCalendarCreateEventBlock(Block):}},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/google/docs.py b/autogpt_platform/backend/backend/blocks/google/docs.pyindex 42d5058d11..de4c5cb0fc 100644--- a/autogpt_platform/backend/backend/blocks/google/docs.py+++ b/autogpt_platform/backend/backend/blocks/google/docs.py@@ -10,6 +10,7 @@ from gravitas_md2gdocs import to_requestsfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -228,6 +229,7 @@ class GoogleDocsReadBlock(Block):"title": "Test Document",},},+ effect=BlockEffect.READ,)async def run(@@ -791,6 +793,7 @@ class GoogleDocsGetMetadataBlock(Block):"revision_id": "rev_123",},},+ effect=BlockEffect.READ,)async def run(@@ -1709,6 +1712,7 @@ class GoogleDocsShareBlock(Block):},},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(@@ -1843,6 +1847,7 @@ class GoogleDocsSetPublicAccessBlock(Block):},},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(@@ -2711,6 +2716,7 @@ class GoogleDocsGetStructureBlock(Block):"structure": {},},},+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/google/gmail.py b/autogpt_platform/backend/backend/blocks/google/gmail.pyindex 5d947da86f..9321ac518f 100644--- a/autogpt_platform/backend/backend/blocks/google/gmail.py+++ b/autogpt_platform/backend/backend/blocks/google/gmail.py@@ -18,6 +18,7 @@ from pydantic import BaseModel, Fieldfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -471,6 +472,7 @@ class GmailReadBlock(GmailBase):],"_send_email": lambda *args, **kwargs: {"id": "1", "status": "sent"},},+ effect=BlockEffect.READ,)async def run(@@ -623,6 +625,7 @@ class GmailSendBlock(GmailBase):"_send_email": lambda *args, **kwargs: {"id": "1", "status": "sent"},},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(@@ -811,6 +814,7 @@ class GmailListLabelsBlock(GmailBase):{"id": "Label_2", "name": "Work"},],},+ effect=BlockEffect.READ,)async def run(@@ -1075,6 +1079,7 @@ class GmailGetThreadBlock(GmailBase):"historyId": "645006",}},+ effect=BlockEffect.READ,)async def run(@@ -1351,6 +1356,7 @@ class GmailReplyBlock(GmailBase):}},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(@@ -1567,6 +1573,7 @@ class GmailGetProfileBlock(GmailBase):"historyId": "12345",},},+ effect=BlockEffect.READ,)async def run(@@ -1666,6 +1673,7 @@ class GmailForwardBlock(GmailBase):},},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/google/sheets.py b/autogpt_platform/backend/backend/blocks/google/sheets.pyindex 69d0aa1f04..1c0db6bf91 100644--- a/autogpt_platform/backend/backend/blocks/google/sheets.py+++ b/autogpt_platform/backend/backend/blocks/google/sheets.py@@ -10,6 +10,7 @@ from googleapiclient.discovery import buildfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -323,6 +324,7 @@ class GoogleSheetsReadBlock(Block):["Alice", "85"],],},+ effect=BlockEffect.READ,)async def run(@@ -1456,6 +1458,7 @@ class GoogleSheetsFindBlock(Block):"count": 3,},},+ effect=BlockEffect.READ,)async def run(@@ -2349,6 +2352,7 @@ class GoogleSheetsFilterRowsBlock(Block):"count": 2,},},+ effect=BlockEffect.READ,)async def run(@@ -2566,6 +2570,7 @@ class GoogleSheetsLookupRowBlock(Block):"found": True,},},+ effect=BlockEffect.READ,)async def run(@@ -2967,6 +2972,7 @@ class GoogleSheetsGetColumnBlock(Block):"column_index": 2,},},+ effect=BlockEffect.READ,)async def run(@@ -3411,6 +3417,7 @@ class GoogleSheetsGetUniqueValuesBlock(Block):"total_unique": 3,},},+ effect=BlockEffect.READ,)async def run(@@ -3970,6 +3977,7 @@ class GoogleSheetsGetRowCountBlock(Block):"column_count": 5,},},+ effect=BlockEffect.READ,)async def run(@@ -4590,6 +4598,7 @@ class GoogleSheetsGetRowBlock(Block):"row_dict": {"Name": "Alice", "Status": "Active", "Score": "85"},},},+ effect=BlockEffect.READ,)async def run(@@ -5081,6 +5090,7 @@ class GoogleSheetsListNamedRangesBlock(Block):"count": 2,},},+ effect=BlockEffect.READ,)async def run(@@ -6159,6 +6169,7 @@ class GoogleSheetsGetNotesBlock(Block):],},},+ effect=BlockEffect.READ,)async def run(@@ -6321,6 +6332,7 @@ class GoogleSheetsShareSpreadsheetBlock(Block):},},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(@@ -6468,6 +6480,7 @@ class GoogleSheetsSetPublicAccessBlock(Block):},},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/google_maps.py b/autogpt_platform/backend/backend/blocks/google_maps.pyindex 8b561d3bd1..a4d9adef4c 100644--- a/autogpt_platform/backend/backend/blocks/google_maps.py+++ b/autogpt_platform/backend/backend/blocks/google_maps.py@@ -6,6 +6,7 @@ from pydantic import BaseModel, SecretStrfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -107,6 +108,7 @@ class GoogleMapsSearchBlock(Block):]},test_credentials=TEST_CREDENTIALS,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/hubspot/engagement.py b/autogpt_platform/backend/backend/blocks/hubspot/engagement.pyindex e3ef2185b3..0a2b32d472 100644--- a/autogpt_platform/backend/backend/blocks/hubspot/engagement.py+++ b/autogpt_platform/backend/backend/blocks/hubspot/engagement.py@@ -3,6 +3,7 @@ from datetime import datetime, timedeltafrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -47,6 +48,7 @@ class HubSpotEngagementBlock(Block):input_schema=HubSpotEngagementBlock.Input,output_schema=HubSpotEngagementBlock.Output,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/ideogram.py b/autogpt_platform/backend/backend/blocks/ideogram.pyindex 5aed4aa5a9..6385ee9969 100644--- a/autogpt_platform/backend/backend/blocks/ideogram.py+++ b/autogpt_platform/backend/backend/blocks/ideogram.py@@ -6,6 +6,7 @@ from pydantic import SecretStrfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -199,6 +200,7 @@ class IdeogramModelBlock(Block):"upscale_image": lambda api_key, image_url: "https://ideogram.ai/api/images/test-upscaled-image-url.png",},test_credentials=TEST_CREDENTIALS,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/iteration.py b/autogpt_platform/backend/backend/blocks/iteration.pyindex a35bcac9c1..5dd81e37da 100644--- a/autogpt_platform/backend/backend/blocks/iteration.py+++ b/autogpt_platform/backend/backend/blocks/iteration.py@@ -3,6 +3,7 @@ from typing import Anyfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -57,6 +58,7 @@ class StepThroughItemsBlock(Block):("key", 3),],test_mock={},+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:diff --git a/autogpt_platform/backend/backend/blocks/jina/chunking.py b/autogpt_platform/backend/backend/blocks/jina/chunking.pyindex c248e3dd24..8c24ecfb69 100644--- a/autogpt_platform/backend/backend/blocks/jina/chunking.py+++ b/autogpt_platform/backend/backend/blocks/jina/chunking.py@@ -1,6 +1,7 @@from backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -39,6 +40,7 @@ class JinaChunkingBlock(Block):categories={BlockCategory.AI, BlockCategory.TEXT},input_schema=JinaChunkingBlock.Input,output_schema=JinaChunkingBlock.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/jina/embeddings.py b/autogpt_platform/backend/backend/blocks/jina/embeddings.pyindex 88f97f43fb..54dd437abc 100644--- a/autogpt_platform/backend/backend/blocks/jina/embeddings.py+++ b/autogpt_platform/backend/backend/blocks/jina/embeddings.py@@ -1,6 +1,7 @@from backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -33,6 +34,7 @@ class JinaEmbeddingBlock(Block):categories={BlockCategory.AI},input_schema=JinaEmbeddingBlock.Input,output_schema=JinaEmbeddingBlock.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/jina/fact_checker.py b/autogpt_platform/backend/backend/blocks/jina/fact_checker.pyindex df73ef94b1..a3d5852779 100644--- a/autogpt_platform/backend/backend/blocks/jina/fact_checker.py+++ b/autogpt_platform/backend/backend/blocks/jina/fact_checker.py@@ -6,6 +6,7 @@ from typing_extensions import TypedDictfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -50,6 +51,7 @@ class FactCheckerBlock(Block):categories={BlockCategory.SEARCH},input_schema=FactCheckerBlock.Input,output_schema=FactCheckerBlock.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/jina/search.py b/autogpt_platform/backend/backend/blocks/jina/search.pyindex 5c2ebfb39f..b590f2389a 100644--- a/autogpt_platform/backend/backend/blocks/jina/search.py+++ b/autogpt_platform/backend/backend/blocks/jina/search.py@@ -3,6 +3,7 @@ from urllib.parse import quotefrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -44,6 +45,7 @@ class SearchTheWebBlock(Block, GetRequest):test_credentials=TEST_CREDENTIALS,test_output=("results", "search content"),test_mock={"get_request": lambda *args, **kwargs: "search content"},+ effect=BlockEffect.READ,)async def run(@@ -112,6 +114,7 @@ class ExtractWebsiteContentBlock(Block, GetRequest):test_credentials=TEST_CREDENTIALS,test_output=("content", "scraped content"),test_mock={"get_request": lambda *args, **kwargs: "scraped content"},+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/json_blocks.py b/autogpt_platform/backend/backend/blocks/json_blocks.pyindex bb5f276168..3f65ee7cfa 100644--- a/autogpt_platform/backend/backend/blocks/json_blocks.py+++ b/autogpt_platform/backend/backend/blocks/json_blocks.py@@ -7,6 +7,7 @@ import orjsonfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -42,6 +43,7 @@ class JSONEncoderBlock(Block):test_output=[("json_str", '{"name":"AutoGPT","active":true}'),],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:@@ -79,6 +81,7 @@ class JSONDecoderBlock(Block):test_output=[("data", {"name": "AutoGPT", "active": True}),],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:diff --git a/autogpt_platform/backend/backend/blocks/linear/issues.py b/autogpt_platform/backend/backend/blocks/linear/issues.pyindex 165178f8ee..6b5741c005 100644--- a/autogpt_platform/backend/backend/blocks/linear/issues.py+++ b/autogpt_platform/backend/backend/blocks/linear/issues.py@@ -2,6 +2,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -195,6 +196,7 @@ class LinearSearchIssuesBlock(Block):)]},+ effect=BlockEffect.READ,)@staticmethod@@ -306,6 +308,7 @@ class LinearGetProjectIssuesBlock(Block):)]},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/linear/projects.py b/autogpt_platform/backend/backend/blocks/linear/projects.pyindex 841867b137..0f35a79b37 100644--- a/autogpt_platform/backend/backend/blocks/linear/projects.py+++ b/autogpt_platform/backend/backend/blocks/linear/projects.py@@ -2,6 +2,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -72,6 +73,7 @@ class LinearSearchProjectsBlock(Block):)]},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/llm.py b/autogpt_platform/backend/backend/blocks/llm.pyindex 0695045b62..de94536be0 100644--- a/autogpt_platform/backend/backend/blocks/llm.py+++ b/autogpt_platform/backend/backend/blocks/llm.py@@ -23,6 +23,7 @@ from pydantic_core import PydanticUndefinedfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -562,6 +563,7 @@ class AIStructuredResponseGeneratorBlock(AIBlockBase):),"get_collision_proof_output_tag_id": lambda *args: "test123456",},+ effect=BlockEffect.READ,)async def llm_call(@@ -1066,6 +1068,7 @@ class AITextGeneratorBlock(AIBlockBase):("prompt", list),],test_mock={"llm_call": lambda *args, **kwargs: "Response text"},+ effect=BlockEffect.READ,)async def llm_call(@@ -1180,6 +1183,7 @@ class AITextSummarizerBlock(AIBlockBase):else {"summary": "Summary of a chunk of text"})},+ effect=BlockEffect.READ,)async def run(@@ -1419,6 +1423,7 @@ class AIConversationBlock(AIBlockBase):response="The 2020 World Series was played at Globe Life Field in Arlington, Texas.")},+ effect=BlockEffect.READ,)async def llm_call(@@ -1576,6 +1581,7 @@ class AIListGeneratorBlock(AIBlockBase):]},},+ effect=BlockEffect.READ,)async def llm_call(diff --git a/autogpt_platform/backend/backend/blocks/maths.py b/autogpt_platform/backend/backend/blocks/maths.pyindex 0f94075277..90538dcaec 100644--- a/autogpt_platform/backend/backend/blocks/maths.py+++ b/autogpt_platform/backend/backend/blocks/maths.py@@ -5,6 +5,7 @@ from typing import Anyfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -56,6 +57,7 @@ class CalculatorBlock(Block):test_output=[("result", 15.0),],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:@@ -111,6 +113,7 @@ class CountItemsBlock(Block):test_output=[("count", 5),],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:diff --git a/autogpt_platform/backend/backend/blocks/medium.py b/autogpt_platform/backend/backend/blocks/medium.pyindex 38a9e01d87..7837e5200f 100644--- a/autogpt_platform/backend/backend/blocks/medium.py+++ b/autogpt_platform/backend/backend/blocks/medium.py@@ -6,6 +6,7 @@ from pydantic import SecretStrfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -135,6 +136,7 @@ class PublishToMediumBlock(Block):},test_credentials=TEST_CREDENTIALS,is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def create_post(diff --git a/autogpt_platform/backend/backend/blocks/mem0.py b/autogpt_platform/backend/backend/blocks/mem0.pyindex ba0bd24290..6e0e3ef4ab 100644--- a/autogpt_platform/backend/backend/blocks/mem0.py+++ b/autogpt_platform/backend/backend/blocks/mem0.py@@ -3,7 +3,13 @@ from typing import Any, Literal, Optional, Unionfrom mem0 import MemoryClientfrom pydantic import BaseModel, SecretStr-from backend.blocks._base import Block, BlockOutput, BlockSchemaInput, BlockSchemaOutput+from backend.blocks._base import (+ Block,+ BlockEffect,+ BlockOutput,+ BlockSchemaInput,+ BlockSchemaOutput,+)from backend.data.model import (APIKeyCredentials,CredentialsField,@@ -220,6 +226,7 @@ class SearchMemoryBlock(Block, Mem0Base):],test_credentials=TEST_CREDENTIALS,test_mock={"_get_client": lambda credentials: MockMemoryClient()},+ effect=BlockEffect.READ,)async def run(@@ -305,6 +312,7 @@ class GetAllMemoriesBlock(Block, Mem0Base):],test_credentials=TEST_CREDENTIALS,test_mock={"_get_client": lambda credentials: MockMemoryClient()},+ effect=BlockEffect.READ,)async def run(@@ -399,6 +407,7 @@ class GetLatestMemoryBlock(Block, Mem0Base):],test_credentials=TEST_CREDENTIALS,test_mock={"_get_client": lambda credentials: MockMemoryClient()},+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/nvidia/deepfake.py b/autogpt_platform/backend/backend/blocks/nvidia/deepfake.pyindex 06b05ebc50..0ad08c73b6 100644--- a/autogpt_platform/backend/backend/blocks/nvidia/deepfake.py+++ b/autogpt_platform/backend/backend/blocks/nvidia/deepfake.py@@ -1,6 +1,7 @@from backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -44,6 +45,7 @@ class NvidiaDeepfakeDetectBlock(Block):categories={BlockCategory.SAFETY},input_schema=NvidiaDeepfakeDetectBlock.Input,output_schema=NvidiaDeepfakeDetectBlock.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/perplexity.py b/autogpt_platform/backend/backend/blocks/perplexity.pyindex 0cdf29a3de..73c7538d41 100644--- a/autogpt_platform/backend/backend/blocks/perplexity.py+++ b/autogpt_platform/backend/backend/blocks/perplexity.py@@ -9,6 +9,7 @@ from pydantic import SecretStr, field_validatorfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -168,6 +169,7 @@ class PerplexityBlock(Block):],}},+ effect=BlockEffect.READ,)self.execution_stats = NodeExecutionStats()diff --git a/autogpt_platform/backend/backend/blocks/pinecone.py b/autogpt_platform/backend/backend/blocks/pinecone.pyindex 270d224ecf..13749fce1b 100644--- a/autogpt_platform/backend/backend/blocks/pinecone.py+++ b/autogpt_platform/backend/backend/blocks/pinecone.py@@ -6,6 +6,7 @@ from pinecone import Pinecone, ServerlessSpecfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -122,6 +123,7 @@ class PineconeQueryBlock(Block):categories={BlockCategory.LOGIC},input_schema=PineconeQueryBlock.Input,output_schema=PineconeQueryBlock.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/reddit.py b/autogpt_platform/backend/backend/blocks/reddit.pyindex d3693a0a81..2a6a0b05d1 100644--- a/autogpt_platform/backend/backend/blocks/reddit.py+++ b/autogpt_platform/backend/backend/blocks/reddit.py@@ -9,6 +9,7 @@ from pydantic import BaseModel, SecretStrfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -325,6 +326,7 @@ class PostRedditCommentBlock(Block):"reply_post": lambda creds, post_id, comment: "dummy_comment_id"},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -411,6 +413,7 @@ class CreateRedditPostBlock(Block):)},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -1794,6 +1797,7 @@ class ReplyToRedditCommentBlock(Block):"reply_to_comment": lambda creds, comment_id, reply_text: "new_reply_id"},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -2039,6 +2043,7 @@ class SendRedditMessageBlock(Block):],test_mock={"send_message": lambda creds, username, subject, message: True},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -2267,6 +2272,7 @@ class DeleteRedditPostBlock(Block):],test_mock={"delete_post": lambda creds, post_id: True},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -2326,6 +2332,7 @@ class DeleteRedditCommentBlock(Block):],test_mock={"delete_comment": lambda creds, comment_id: True},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/reddit_moderation.py b/autogpt_platform/backend/backend/blocks/reddit_moderation.pyindex 4bb6352b7f..330da98c26 100644--- a/autogpt_platform/backend/backend/blocks/reddit_moderation.py+++ b/autogpt_platform/backend/backend/blocks/reddit_moderation.py@@ -5,6 +5,7 @@ from praw.models import Comment, Submissionfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -256,6 +257,7 @@ class RemoveRedditPostBlock(Block):],test_mock={"remove_post": lambda creds, post_id, spam, mod_note: True},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -317,6 +319,7 @@ class ApproveRedditPostBlock(Block):],test_mock={"approve_post": lambda creds, post_id: True},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -370,6 +373,7 @@ class LockRedditPostBlock(Block):],test_mock={"set_lock": lambda creds, post_id, lock: lock},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -462,6 +466,7 @@ class BanSubredditUserBlock(Block):"ban_user": lambda creds, subreddit, username, duration, reason, mod_note, ban_message: True},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -542,6 +547,7 @@ class UnbanSubredditUserBlock(Block):],test_mock={"unban_user": lambda creds, subreddit, username: True},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -614,6 +620,7 @@ class SendModMailBlock(Block):"send_modmail": lambda creds, subreddit, to_username, subject, body: "mock_conv_id"},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/replicate/flux_advanced.py b/autogpt_platform/backend/backend/blocks/replicate/flux_advanced.pyindex e7a0a82cce..7c133a9e42 100644--- a/autogpt_platform/backend/backend/blocks/replicate/flux_advanced.py+++ b/autogpt_platform/backend/backend/blocks/replicate/flux_advanced.py@@ -7,6 +7,7 @@ from replicate.client import Client as ReplicateClientfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -144,6 +145,7 @@ class ReplicateFluxAdvancedModelBlock(Block):"run_model": lambda api_key, model_name, prompt, seed, steps, guidance, interval, aspect_ratio, output_format, output_quality, safety_tolerance: "https://replicate.com/output/generated-image-url.jpg",},test_credentials=TEST_CREDENTIALS,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/replicate/replicate_block.py b/autogpt_platform/backend/backend/blocks/replicate/replicate_block.pyindex f320ae32b5..8d900e6cea 100644--- a/autogpt_platform/backend/backend/blocks/replicate/replicate_block.py+++ b/autogpt_platform/backend/backend/blocks/replicate/replicate_block.py@@ -8,6 +8,7 @@ from replicate.client import Client as ReplicateClientfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -134,6 +135,7 @@ class ReplicateModelBlock(Block):"Mock response from Replicate model")},+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/rmfg/carts.py b/autogpt_platform/backend/backend/blocks/rmfg/carts.pyindex 9403cd9df3..3e24576da8 100644--- a/autogpt_platform/backend/backend/blocks/rmfg/carts.py+++ b/autogpt_platform/backend/backend/blocks/rmfg/carts.py@@ -9,6 +9,7 @@ from typing import Optionalfrom backend.sdk import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -208,6 +209,7 @@ class RMFGGetCartBlock(Block):test_credentials=TEST_CREDENTIALS,test_output=CART_TEST_OUTPUT,test_mock={"get_cart": lambda *args, **kwargs: TEST_CART},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/rmfg/catalog.py b/autogpt_platform/backend/backend/blocks/rmfg/catalog.pyindex e1b4f3b810..804ce40085 100644--- a/autogpt_platform/backend/backend/blocks/rmfg/catalog.py+++ b/autogpt_platform/backend/backend/blocks/rmfg/catalog.py@@ -5,6 +5,7 @@ from typing import Optionalfrom backend.sdk import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -61,6 +62,7 @@ class RMFGListMaterialsBlock(Block):("material_ids", [TEST_MATERIAL.id]),],test_mock={"list_materials": lambda *args, **kwargs: [TEST_MATERIAL]},+ effect=BlockEffect.READ,)@staticmethod@@ -108,6 +110,7 @@ class RMFGListTubeProfilesBlock(Block):test_mock={"list_tube_profiles": lambda *args, **kwargs: [TEST_TUBE_PROFILE]},+ effect=BlockEffect.READ,)@staticmethod@@ -159,6 +162,7 @@ class RMFGListFinishesBlock(Block):("finish_ids", [TEST_FINISH.id]),],test_mock={"list_finishes": lambda *args, **kwargs: [TEST_FINISH]},+ effect=BlockEffect.READ,)@staticmethod@@ -204,6 +208,7 @@ class RMFGListPowderCoatColorsBlock(Block):("color_ids", [TEST_POWDER_COAT_COLOR.id]),],test_mock={"list_colors": lambda *args, **kwargs: [TEST_POWDER_COAT_COLOR]},+ effect=BlockEffect.READ,)@staticmethod@@ -258,6 +263,7 @@ class RMFGListHardwareBlock(Block):("option_ids", [TEST_HARDWARE_OPTION.id]),],test_mock={"list_hardware": lambda *args, **kwargs: [TEST_HARDWARE_OPTION]},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/rmfg/designs.py b/autogpt_platform/backend/backend/blocks/rmfg/designs.pyindex 9cb7f62ccf..2d9121ecf4 100644--- a/autogpt_platform/backend/backend/blocks/rmfg/designs.py+++ b/autogpt_platform/backend/backend/blocks/rmfg/designs.py@@ -7,6 +7,7 @@ from backend.data.execution import ExecutionContextfrom backend.sdk import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -239,6 +240,7 @@ class RMFGGetDesignBlock(Block):("image_url", TEST_DESIGN.image_url),],test_mock={"get_design": lambda *args, **kwargs: TEST_DESIGN},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/rmfg/dfm.py b/autogpt_platform/backend/backend/blocks/rmfg/dfm.pyindex a6636247b4..06734000be 100644--- a/autogpt_platform/backend/backend/blocks/rmfg/dfm.py+++ b/autogpt_platform/backend/backend/blocks/rmfg/dfm.py@@ -5,6 +5,7 @@ from typing import Optionalfrom backend.sdk import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -203,6 +204,7 @@ class RMFGGetDFMReportBlock(Block):("review_url", TEST_DFM_REPORT.review_url),],test_mock={"get_report": lambda *args, **kwargs: TEST_DFM_REPORT},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/rmfg/images.py b/autogpt_platform/backend/backend/blocks/rmfg/images.pyindex 3f2e702fed..205f99c220 100644--- a/autogpt_platform/backend/backend/blocks/rmfg/images.py+++ b/autogpt_platform/backend/backend/blocks/rmfg/images.py@@ -11,6 +11,7 @@ from backend.data.execution import ExecutionContextfrom backend.sdk import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -89,6 +90,7 @@ class RMFGGetImageBlock(Block):"fetch_image": lambda *args, **kwargs: TEST_PNG_DATA_URI,"save_image": lambda *args, **kwargs: TEST_PNG_DATA_URI,},+ effect=BlockEffect.WORKSPACE,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/rmfg/orders.py b/autogpt_platform/backend/backend/blocks/rmfg/orders.pyindex 6a3f724b8b..f343461ab6 100644--- a/autogpt_platform/backend/backend/blocks/rmfg/orders.py+++ b/autogpt_platform/backend/backend/blocks/rmfg/orders.py@@ -5,6 +5,7 @@ from typing import Optionalfrom backend.sdk import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -140,6 +141,7 @@ class RMFGListOrdersBlock(Block):("next_cursor", ""),],test_mock={"list_orders": lambda *args, **kwargs: ([TEST_ORDER], None)},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/rmfg/pay_cart.py b/autogpt_platform/backend/backend/blocks/rmfg/pay_cart.pyindex bfa2155fc9..75546b83af 100644--- a/autogpt_platform/backend/backend/blocks/rmfg/pay_cart.py+++ b/autogpt_platform/backend/backend/blocks/rmfg/pay_cart.py@@ -6,6 +6,7 @@ so this is a sensitive action that the platform asks a person to approve.from backend.sdk import (Block,+ BlockEffect,BlockOutput,BlockSchemaInput,CredentialsMetaInput,@@ -95,6 +96,7 @@ class RMFGPayCartBlock(Block):("checked_out", True),],test_mock={"pay_cart": lambda *args, **kwargs: TEST_PAID_CART},+ effect=BlockEffect.EXTERNAL,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/rmfg/quotes.py b/autogpt_platform/backend/backend/blocks/rmfg/quotes.pyindex a5d0a4c91e..ffd34f8208 100644--- a/autogpt_platform/backend/backend/blocks/rmfg/quotes.py+++ b/autogpt_platform/backend/backend/blocks/rmfg/quotes.py@@ -5,6 +5,7 @@ from typing import Optionalfrom backend.sdk import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -225,6 +226,7 @@ class RMFGGetQuoteBlock(Block):("dfm_issues", [TEST_DFM_ISSUE]),],test_mock={"get_quote": lambda *args, **kwargs: TEST_QUOTE},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/rmfg/review_links.py b/autogpt_platform/backend/backend/blocks/rmfg/review_links.pyindex 68e6cfb667..2994fa187c 100644--- a/autogpt_platform/backend/backend/blocks/rmfg/review_links.py+++ b/autogpt_platform/backend/backend/blocks/rmfg/review_links.py@@ -3,6 +3,7 @@from backend.sdk import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -149,6 +150,7 @@ class RMFGGetReviewLinkBlock(Block):test_credentials=TEST_CREDENTIALS,test_output=LINK_TEST_OUTPUT,test_mock={"get_link": lambda *args, **kwargs: TEST_REVIEW_LINK},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/rss.py b/autogpt_platform/backend/backend/blocks/rss.pyindex 5d26bc592c..21e5ae0f64 100644--- a/autogpt_platform/backend/backend/blocks/rss.py+++ b/autogpt_platform/backend/backend/blocks/rss.py@@ -9,6 +9,7 @@ import pydanticfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -105,6 +106,7 @@ class ReadRSSFeedBlock(Block):]}},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/sampling.py b/autogpt_platform/backend/backend/blocks/sampling.pyindex eb5f47e80e..876d16fb48 100644--- a/autogpt_platform/backend/backend/blocks/sampling.py+++ b/autogpt_platform/backend/backend/blocks/sampling.py@@ -6,6 +6,7 @@ from typing import Any, Dict, List, Optional, Unionfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -96,6 +97,7 @@ class DataSamplingBlock(Block):),("sample_indices", [0, 1, 8]),],+ effect=BlockEffect.NONE,)self.accumulated_data = []diff --git a/autogpt_platform/backend/backend/blocks/screenshotone.py b/autogpt_platform/backend/backend/blocks/screenshotone.pyindex 1ce133af83..d26088a58c 100644--- a/autogpt_platform/backend/backend/blocks/screenshotone.py+++ b/autogpt_platform/backend/backend/blocks/screenshotone.py@@ -7,6 +7,7 @@ from pydantic import SecretStrfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -108,6 +109,7 @@ class ScreenshotWebPageBlock(Block):"image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAB5JREFUOE9jZPjP8J+BAsA4agDDaBgwjIYBw7AIAwCV5B/xAsMbygAAAABJRU5ErkJggg==",}},+ effect=BlockEffect.WORKSPACE,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/search.py b/autogpt_platform/backend/backend/blocks/search.pyindex 61acb2108e..3bdc3bc4c0 100644--- a/autogpt_platform/backend/backend/blocks/search.py+++ b/autogpt_platform/backend/backend/blocks/search.py@@ -6,6 +6,7 @@ from pydantic import SecretStrfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -43,6 +44,7 @@ class GetWikipediaSummaryBlock(Block, GetRequest):test_mock={"get_request": lambda url, headers, json: {"extract": "summary content"}},+ effect=BlockEffect.READ,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:@@ -134,6 +136,7 @@ class GetWeatherInformationBlock(Block, GetRequest):}},test_credentials=TEST_CREDENTIALS,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/slack/blocks.py b/autogpt_platform/backend/backend/blocks/slack/blocks.pyindex fb728d8ee1..9b3910de1f 100644--- a/autogpt_platform/backend/backend/blocks/slack/blocks.py+++ b/autogpt_platform/backend/backend/blocks/slack/blocks.py@@ -8,6 +8,7 @@ from typing import Optionalfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -101,6 +102,7 @@ class SendSlackMessageBlock(Block):)},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/slant3d/order.py b/autogpt_platform/backend/backend/blocks/slant3d/order.pyindex 1d7bcdb507..8d64cabd4a 100644--- a/autogpt_platform/backend/backend/blocks/slant3d/order.py+++ b/autogpt_platform/backend/backend/blocks/slant3d/order.py@@ -1,4 +1,4 @@-from backend.blocks._base import BlockOutput, BlockSchemaOutput+from backend.blocks._base import BlockEffect, BlockOutput, BlockSchemaOutputfrom backend.data.execution import ExecutionContextfrom backend.data.model import APIKeyCredentials, SchemaField@@ -35,6 +35,7 @@ class Slant3DCreateOrderBlock(Slant3DBlockBase):},},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/slant3d/order_status.py b/autogpt_platform/backend/backend/blocks/slant3d/order_status.pyindex ce51b8b4ae..520dbc3995 100644--- a/autogpt_platform/backend/backend/blocks/slant3d/order_status.py+++ b/autogpt_platform/backend/backend/blocks/slant3d/order_status.py@@ -1,6 +1,11 @@from urllib.parse import quote-from backend.blocks._base import BlockOutput, BlockSchemaInput, BlockSchemaOutput+from backend.blocks._base import (+ BlockEffect,+ BlockOutput,+ BlockSchemaInput,+ BlockSchemaOutput,+)from backend.data.model import APIKeyCredentials, SchemaFieldfrom backend.util.settings import BehaveAs, Settings@@ -40,6 +45,7 @@ class Slant3DGetOrdersBlock(Slant3DBlockBase):"pagination": {"totalPages": 1},}},+ effect=BlockEffect.READ,)async def run(@@ -136,6 +142,7 @@ class Slant3DCancelOrderBlock(Slant3DBlockBase):}},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(@@ -181,6 +188,7 @@ class Slant3DProcessOrderBlock(Slant3DBlockBase):}},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/smartlead/campaign.py b/autogpt_platform/backend/backend/blocks/smartlead/campaign.pyindex 5ce8307e79..55107afbdb 100644--- a/autogpt_platform/backend/backend/blocks/smartlead/campaign.py+++ b/autogpt_platform/backend/backend/blocks/smartlead/campaign.py@@ -1,6 +1,7 @@from backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -197,6 +198,7 @@ class AddLeadToCampaignBlock(Block):)},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/spreadsheet.py b/autogpt_platform/backend/backend/blocks/spreadsheet.pyindex bc71ec782c..8e0feb2889 100644--- a/autogpt_platform/backend/backend/blocks/spreadsheet.py+++ b/autogpt_platform/backend/backend/blocks/spreadsheet.py@@ -3,6 +3,7 @@ from pathlib import Pathfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -100,6 +101,7 @@ class ReadSpreadsheetBlock(Block):("row", {"a": "1", "b": "2", "c": "3"}),("row", {"a": "4", "b": "5", "c": "6"}),],+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/stripe_link/mpp.py b/autogpt_platform/backend/backend/blocks/stripe_link/mpp.pyindex 8c1408fd05..bc2203abb2 100644--- a/autogpt_platform/backend/backend/blocks/stripe_link/mpp.py+++ b/autogpt_platform/backend/backend/blocks/stripe_link/mpp.py@@ -21,6 +21,7 @@ from urllib.parse import quotefrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -381,6 +382,7 @@ class StripeLinkMPPPayBlock(Block):"_pay_with_token": lambda *args, **kwargs: (200, {"ok": True}, True),},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/stripe_link/profile.py b/autogpt_platform/backend/backend/blocks/stripe_link/profile.pyindex 033c648ddc..b0a24631b4 100644--- a/autogpt_platform/backend/backend/blocks/stripe_link/profile.py+++ b/autogpt_platform/backend/backend/blocks/stripe_link/profile.py@@ -10,6 +10,7 @@ from typing import Anyfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -76,6 +77,7 @@ class StripeLinkGetUserInfoBlock(Block):"phone": "+15551234567",}},+ effect=BlockEffect.READ,)async def run(@@ -150,6 +152,7 @@ class StripeLinkGetShippingAddressBlock(Block):"shipping_addresses": [example]}},+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/stripe_link/spend_request.py b/autogpt_platform/backend/backend/blocks/stripe_link/spend_request.pyindex a2d8247e2b..3a1f1900f8 100644--- a/autogpt_platform/backend/backend/blocks/stripe_link/spend_request.py+++ b/autogpt_platform/backend/backend/blocks/stripe_link/spend_request.py@@ -16,6 +16,7 @@ from pydantic import field_validator, model_validatorfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -197,6 +198,7 @@ class StripeLinkListPaymentMethodsBlock(Block):]}},+ effect=BlockEffect.READ,)async def run(@@ -678,6 +680,7 @@ class StripeLinkGetSpendRequestStatusBlock(Block):test_mock={"_link_api_request": lambda *args, **kwargs: {"status": "approved"}},+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/system/library_operations.py b/autogpt_platform/backend/backend/blocks/system/library_operations.pyindex b2433ce220..a7bc5da4b0 100644--- a/autogpt_platform/backend/backend/blocks/system/library_operations.py+++ b/autogpt_platform/backend/backend/blocks/system/library_operations.py@@ -6,6 +6,7 @@ from pydantic import BaseModelfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -86,6 +87,7 @@ class AddToLibraryFromStoreBlock(Block):agent_name="Test Agent",)},+ effect=BlockEffect.PLATFORM,)async def run(@@ -223,6 +225,7 @@ class ListLibraryAgentsBlock(Block):"total_pages": 1,}},+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/talking_head.py b/autogpt_platform/backend/backend/blocks/talking_head.pyindex f199d030ff..6954d67f72 100644--- a/autogpt_platform/backend/backend/blocks/talking_head.py+++ b/autogpt_platform/backend/backend/blocks/talking_head.py@@ -6,6 +6,7 @@ from pydantic import SecretStrfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -120,6 +121,7 @@ class CreateTalkingAvatarVideoBlock(Block):},},test_credentials=TEST_CREDENTIALS,+ effect=BlockEffect.WORKSPACE,)async def create_clip(self, api_key: SecretStr, payload: dict) -> dict:diff --git a/autogpt_platform/backend/backend/blocks/tavily/crawl.py b/autogpt_platform/backend/backend/blocks/tavily/crawl.pyindex 58ef80aa89..32278ae417 100644--- a/autogpt_platform/backend/backend/blocks/tavily/crawl.py+++ b/autogpt_platform/backend/backend/blocks/tavily/crawl.py@@ -8,6 +8,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -103,6 +104,7 @@ class TavilyCrawlBlock(Block):"usage": {"credits": 2},}},+ effect=BlockEffect.READ,)async def _crawl(self, credentials: APIKeyCredentials, **kwargs) -> dict[str, Any]:diff --git a/autogpt_platform/backend/backend/blocks/tavily/extract.py b/autogpt_platform/backend/backend/blocks/tavily/extract.pyindex e5ed892872..c7293040fb 100644--- a/autogpt_platform/backend/backend/blocks/tavily/extract.py+++ b/autogpt_platform/backend/backend/blocks/tavily/extract.py@@ -8,6 +8,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -88,6 +89,7 @@ class TavilyExtractBlock(Block):"usage": {"credits": 1},}},+ effect=BlockEffect.READ,)async def _extract(diff --git a/autogpt_platform/backend/backend/blocks/tavily/map.py b/autogpt_platform/backend/backend/blocks/tavily/map.pyindex 9a506ca17d..05fa30b46f 100644--- a/autogpt_platform/backend/backend/blocks/tavily/map.py+++ b/autogpt_platform/backend/backend/blocks/tavily/map.py@@ -8,6 +8,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -74,6 +75,7 @@ class TavilyMapBlock(Block):"usage": {"credits": 1},}},+ effect=BlockEffect.READ,)async def _map(self, credentials: APIKeyCredentials, **kwargs) -> dict[str, Any]:diff --git a/autogpt_platform/backend/backend/blocks/tavily/search.py b/autogpt_platform/backend/backend/blocks/tavily/search.pyindex 1145f9389c..cda2cfaeb7 100644--- a/autogpt_platform/backend/backend/blocks/tavily/search.py+++ b/autogpt_platform/backend/backend/blocks/tavily/search.py@@ -7,6 +7,7 @@ from backend.sdk import (APIKeyCredentials,Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -122,6 +123,7 @@ class TavilySearchBlock(Block):"usage": {"credits": 1},}},+ effect=BlockEffect.READ,)async def _search(self, credentials: APIKeyCredentials, **kwargs) -> dict[str, Any]:diff --git a/autogpt_platform/backend/backend/blocks/telegram/blocks.py b/autogpt_platform/backend/backend/blocks/telegram/blocks.pyindex d66d9e3764..79fe8392e5 100644--- a/autogpt_platform/backend/backend/blocks/telegram/blocks.py+++ b/autogpt_platform/backend/backend/blocks/telegram/blocks.py@@ -12,6 +12,7 @@ from typing import Any, Optionalfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -101,6 +102,7 @@ class SendTelegramMessageBlock(Block):)},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(@@ -196,6 +198,7 @@ class SendTelegramPhotoBlock(Block):)},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(@@ -355,6 +358,7 @@ class SendTelegramVoiceBlock(Block):)},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(@@ -500,6 +504,7 @@ class ReplyToTelegramMessageBlock(Block):)},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(@@ -571,6 +576,7 @@ class GetTelegramFileBlock(Block):("status", "File downloaded"),],test_mock={"_download_file": lambda *args, **kwargs: b"test"},+ effect=BlockEffect.WORKSPACE,)async def run(@@ -645,6 +651,7 @@ class DeleteTelegramMessageBlock(Block):],test_mock={"_delete_message": lambda *args, **kwargs: True},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(@@ -819,6 +826,7 @@ class SendTelegramAudioBlock(Block):)},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(@@ -994,6 +1002,7 @@ class SendTelegramDocumentBlock(Block):)},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(@@ -1154,6 +1163,7 @@ class SendTelegramVideoBlock(Block):)},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/test/test_block.py b/autogpt_platform/backend/backend/blocks/test/test_block.pyindex 326efb63e9..127749c8c9 100644--- a/autogpt_platform/backend/backend/blocks/test/test_block.py+++ b/autogpt_platform/backend/backend/blocks/test/test_block.py@@ -3,8 +3,10 @@ from typing import Any, Typeimport pytestfrom backend.blocks import get_blocks-from backend.blocks._base import Block, BlockSchemaInput+from backend.blocks._base import Block, BlockEffect, BlockSchemaInput, BlockTypefrom backend.blocks.io import AgentDropdownInputBlock, AgentInputBlock+from backend.copilot.gate.effects import STRUCTURAL_TYPES, UNREADABLE_BLOCKS+from backend.data.block_cost_config import BLOCK_COSTSfrom backend.data.execution import ExecutionContextfrom backend.data.graph import BaseGraphfrom backend.data.model import SchemaField@@ -48,6 +50,157 @@ async def test_available_blocks(block: Type[Block]):await execute_block_test(block_instance)+# Blocks that predate the ``effect`` declaration and are not classified yet.+# An undeclared block asks before it runs, so an entry costs friction, never+# safety. MAY ONLY SHRINK: a new block declares its effect, and a follow-up that+# classifies a provider family deletes its rows.+_EFFECT_UNCLASSIFIED: frozenset[str] = frozenset(+ """+ AddAudioToVideoBlock AddMemoryBlock AgentMailCreateDraftBlock+ AgentMailCreateInboxBlock AgentMailCreatePodBlock AgentMailCreatePodInboxBlock+ AgentMailUpdateDraftBlock AgentMailUpdateInboxBlock AgentMailUpdateMessageBlock+ AirtableCreateBaseBlock AirtableCreateFieldBlock AirtableCreateRecordsBlock+ AirtableCreateTableBlock AirtableUpdateFieldBlock AirtableUpdateRecordsBlock+ AirtableUpdateTableBlock AllQuietUpdateIncidentBlock BaasBotLeaveMeetingBlock+ BlockInstallationBlock CompanyEnrichmentBlock CreateCampaignBlock+ DataForSeoKeywordSuggestionsBlock DataForSeoRelatedKeywordsBlock+ DiscordGetCurrentUserBlock EditRedditPostBlock EditTelegramMessageBlock+ ExaBulkWebsetItemsBlock ExaCancelEnrichmentBlock ExaCancelWebsetBlock+ ExaCancelWebsetSearchBlock ExaCodeContextBlock ExaCreateEnrichmentBlock+ ExaCreateImportBlock ExaCreateMonitorBlock ExaCreateOrFindWebsetBlock+ ExaCreateResearchBlock ExaCreateWebsetBlock ExaCreateWebsetSearchBlock+ ExaExportWebsetBlock ExaFindOrCreateSearchBlock ExaGetImportBlock+ ExaUpdateEnrichmentBlock ExaUpdateMonitorBlock ExaUpdateWebsetBlock+ ExaWaitForEnrichmentBlock ExaWaitForResearchBlock ExaWaitForWebsetBlock+ ExaWebsetItemsSummaryBlock ExaWebsetSummaryBlock FileStoreBlock+ GetRedditCommentBlock GetRedditCommentRepliesBlock GetRedditInboxBlock+ GetRedditPostBlock GetRedditPostCommentsBlock GetRedditPostsBlock+ GetRedditUserInfoBlock GetStoreAgentDetailsBlock GetSubredditFlairsBlock+ GetSubredditInfoBlock GetSubredditRulesBlock GetUserPostsBlock+ GithubAddLabelBlock GithubAssignIssueBlock GithubAssignPRReviewerBlock+ GithubCreateCheckRunBlock GithubCreateRepositoryBlock GithubCreateStatusBlock+ GithubForkRepositoryBlock GithubMakeBranchBlock+ GithubMarkNotificationThreadAsDoneBlock GithubMarkNotificationThreadAsReadBlock+ GithubMarkNotificationsAsReadBlock GithubMultiFileCommitBlock+ GithubRemoveLabelBlock GithubResolveReviewDiscussionBlock+ GithubStarRepositoryBlock GithubUnassignIssueBlock GithubUnassignPRReviewerBlock+ GithubUnsubscribeNotificationThreadBlock GithubUpdateCheckRunBlock+ GithubUpdateCommentBlock GmailAddLabelBlock GmailCreateDraftBlock+ GmailDraftReplyBlock GmailRemoveLabelBlock GoogleDocsAppendMarkdownBlock+ GoogleDocsAppendPlainTextBlock GoogleDocsCreateBlock+ GoogleDocsDeleteContentBlock GoogleDocsExportBlock+ GoogleDocsFindReplacePlainTextBlock GoogleDocsFormatTextBlock+ GoogleDocsInsertMarkdownAtBlock GoogleDocsInsertPageBreakBlock+ GoogleDocsInsertPlainTextBlock GoogleDocsInsertTableBlock+ GoogleDocsReplaceAllWithMarkdownBlock GoogleDocsReplaceContentWithMarkdownBlock+ GoogleDocsReplaceRangeWithMarkdownBlock GoogleSheetsAddColumnBlock+ GoogleSheetsAddDropdownBlock GoogleSheetsAddNoteBlock GoogleSheetsAppendRowBlock+ GoogleSheetsBatchOperationsBlock GoogleSheetsClearBlock+ GoogleSheetsCopyToSpreadsheetBlock GoogleSheetsCreateNamedRangeBlock+ GoogleSheetsCreateSpreadsheetBlock GoogleSheetsDeleteColumnBlock+ GoogleSheetsDeleteRowsBlock GoogleSheetsExportCsvBlock+ GoogleSheetsFindReplaceBlock GoogleSheetsFormatBlock GoogleSheetsImportCsvBlock+ GoogleSheetsInsertRowBlock GoogleSheetsManageSheetBlock+ GoogleSheetsMetadataBlock GoogleSheetsProtectRangeBlock+ GoogleSheetsRemoveDuplicatesBlock GoogleSheetsSortBlock+ GoogleSheetsUpdateCellBlock GoogleSheetsUpdateRowBlock GoogleSheetsWriteBlock+ HubSpotCompanyBlock HubSpotContactBlock JevAskManyBlock JevChoiceBlock+ JevFilterBlock JevPickBestBlock JevRouteBlock JevScoreBlock JevYesNoBlock+ LinearCreateCommentBlock LinearCreateIssueBlock LoopVideoBlock+ MediaDurationBlock ModQueueBlock NotionCreatePageBlock NotionReadDatabaseBlock+ NotionReadPageBlock NotionReadPageMarkdownBlock NotionSearchBlock+ PersistInformationBlock PineconeInitBlock PineconeInsertBlock+ ProfileEnrichmentBlock RMFGAnalyzeDesignBlock RMFGCreateCartBlock+ RMFGCreateDFMReportBlock RMFGCreateQuoteBlock RMFGCreateReviewLinkBlock+ RMFGGetOrderBlock RMFGUpdateCartBlock RedditGetMyPostsBlock+ RetrieveInformationBlock SaveCampaignSequencesBlock SearchRedditBlock+ SearchStoreAgentsBlock Slant3DEstimateOrderBlock Slant3DEstimateShippingBlock+ Slant3DFilamentBlock Slant3DSlicerBlock Slant3DTrackingBlock StagehandActBlock+ StagehandExtractBlock StagehandObserveBlock+ StripeLinkCreateCardSpendRequestBlock StripeLinkCreateTokenSpendRequestBlock+ StripeLinkGetPaymentChallengeBlock StripeLinkRetrieveCardBlock+ TodoistCloseTaskBlock TodoistCreateCommentBlock TodoistCreateLabelBlock+ TodoistCreateProjectBlock TodoistCreateTaskBlock TodoistGetCommentBlock+ TodoistGetCommentsBlock TodoistGetLabelBlock TodoistGetProjectBlock+ TodoistGetSectionBlock TodoistGetSharedLabelsBlock TodoistGetTaskBlock+ TodoistGetTasksBlock TodoistListCollaboratorsBlock TodoistListLabelsBlock+ TodoistListProjectsBlock TodoistListSectionsBlock TodoistRenameSharedLabelsBlock+ TodoistReopenTaskBlock TodoistUpdateCommentBlock TodoistUpdateLabelBlock+ TodoistUpdateProjectBlock TodoistUpdateTaskBlock TwitterAddListMemberBlock+ TwitterBookmarkTweetBlock TwitterCreateListBlock TwitterFollowListBlock+ TwitterFollowUserBlock TwitterGetBlockedUsersBlock+ TwitterGetBookmarkedTweetsBlock TwitterGetFollowersBlock+ TwitterGetFollowingBlock TwitterGetHomeTimelineBlock TwitterGetLikedTweetsBlock+ TwitterGetLikingUsersBlock TwitterGetListBlock TwitterGetListMembersBlock+ TwitterGetListMembershipsBlock TwitterGetListTweetsBlock+ TwitterGetMutedUsersBlock TwitterGetOwnedListsBlock TwitterGetPinnedListsBlock+ TwitterGetQuoteTweetsBlock TwitterGetRetweetersBlock TwitterGetSpaceBuyersBlock+ TwitterGetSpaceByIdBlock TwitterGetSpaceTweetsBlock TwitterGetSpacesBlock+ TwitterGetTweetBlock TwitterGetTweetsBlock TwitterGetUserBlock+ TwitterGetUserMentionsBlock TwitterGetUserTweetsBlock TwitterGetUsersBlock+ TwitterHideReplyBlock TwitterLikeTweetBlock TwitterMuteUserBlock+ TwitterPinListBlock TwitterRemoveBookmarkTweetBlock TwitterRemoveListMemberBlock+ TwitterRemoveRetweetBlock TwitterSearchRecentTweetsBlock+ TwitterSearchSpacesBlock TwitterUnfollowListBlock TwitterUnfollowUserBlock+ TwitterUnhideReplyBlock TwitterUnlikeTweetBlock TwitterUnmuteUserBlock+ TwitterUnpinListBlock TwitterUpdateListBlock VideoClipBlock VideoConcatBlock+ VideoDownloadBlock VideoNarrationBlock VideoTextOverlayBlock+ """.split()+)++[email protected]("block", get_blocks().values(), ids=lambda b: b().name)+def test_block_declares_an_effect(block: Type[Block]):+ instance = block()+ name = block.__name__+ if instance.effect is not None:+ assert name not in _EFFECT_UNCLASSIFIED, (+ f"{name} declares an effect, so delete it from _EFFECT_UNCLASSIFIED "+ f"— that list may only shrink."+ )+ assert name not in UNREADABLE_BLOCKS, (+ f"{name} is unreadable by construction; a declaration would let it "+ f"run without asking."+ )+ return+ if instance.block_type in STRUCTURAL_TYPES or name in UNREADABLE_BLOCKS:+ return+ assert name in _EFFECT_UNCLASSIFIED, (+ f"{name} declares no effect. Pass effect=BlockEffect.NONE, READ, "+ f"WORKSPACE, PLATFORM or EXTERNAL (see BlockEffect). Do not add it to "+ f"_EFFECT_UNCLASSIFIED."+ )++[email protected]("block", get_blocks().values(), ids=lambda b: b().name)+def test_effect_none_blocks_have_no_io_surface(block: Type[Block]):+ """NONE claims pure computation, and a mock exists only to stub I/O out."""+ instance = block()+ if instance.effect is not BlockEffect.NONE:+ return+ name = instance.name+ assert not instance.test_mock, f"{name} is effect=NONE but mocks I/O in tests."+ assert (+ not instance.input_schema.get_credentials_fields()+ ), f"{name} is effect=NONE but takes credentials."+ assert instance.webhook_config is None, f"{name} is effect=NONE but has a webhook."+ assert (+ instance.block_type is BlockType.STANDARD+ ), f"{name} is effect=NONE but is a {instance.block_type.name} block."+ assert instance.id not in BLOCK_COSTS, f"{name} is effect=NONE but costs money."++[email protected]("block", get_blocks().values(), ids=lambda b: b().name)+def test_irreversible_blocks_are_external(block: Type[Block]):+ instance = block()+ if not instance.is_irreversible_action:+ return+ assert instance.effect is BlockEffect.EXTERNAL, (+ f"{instance.name} is irreversible, so its effect must be EXTERNAL, not "+ f"{instance.effect.name if instance.effect else 'undeclared'}."+ )++@pytest.mark.parametrize("block", get_blocks().values(), ids=lambda b: b().name)def test_irreversible_action_blocks_have_no_data_input(block: Type[Block]):"""An irreversible-action block's whole input dict becomes the review payload.diff --git a/autogpt_platform/backend/backend/blocks/text.py b/autogpt_platform/backend/backend/blocks/text.pyindex e71967d2a4..b77a8e151d 100644--- a/autogpt_platform/backend/backend/blocks/text.py+++ b/autogpt_platform/backend/backend/blocks/text.py@@ -7,6 +7,7 @@ import regex # Has built-in timeout supportfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -53,6 +54,7 @@ class MatchTextPatternBlock(Block):("positive", "Z"),("negative", "Z"),],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:@@ -143,6 +145,7 @@ class ExtractTextInformationBlock(Block):("matched_results", ["World!!", "Earth!!"]),("matched_count", 2),],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:@@ -286,6 +289,7 @@ class FillTextTemplateBlock(Block):("output", "Hello World!"),("output", "Hello, World! Alice"),],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:@@ -320,6 +324,7 @@ class CombineTextsBlock(Block):("output", "Hello world I like cake and to go for walks"),("output", "This is a test! Hi!"),],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:@@ -355,6 +360,7 @@ class TextSplitBlock(Block):("texts", ["Hello", "World!"]),("texts", ["Hello", " World!"]),],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:@@ -389,6 +395,7 @@ class TextReplaceBlock(Block):test_output=[("output", "Hi, World!"),],+ effect=BlockEffect.NONE,)async def run(self, input_data: Input, **kwargs) -> BlockOutput:@@ -444,6 +451,7 @@ class FileReadBlock(Block):test_output=[("content", "Hello World"),],+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/text_to_speech_block.py b/autogpt_platform/backend/backend/blocks/text_to_speech_block.pyindex db39625da1..81fd8f520f 100644--- a/autogpt_platform/backend/backend/blocks/text_to_speech_block.py+++ b/autogpt_platform/backend/backend/blocks/text_to_speech_block.py@@ -5,6 +5,7 @@ from pydantic import SecretStrfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -74,6 +75,7 @@ class UnrealTextToSpeechBlock(Block):}},test_credentials=TEST_CREDENTIALS,+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/time_blocks.py b/autogpt_platform/backend/backend/blocks/time_blocks.pyindex a7fadedbb6..1ba993f53b 100644--- a/autogpt_platform/backend/backend/blocks/time_blocks.py+++ b/autogpt_platform/backend/backend/blocks/time_blocks.py@@ -10,6 +10,7 @@ from pydantic import BaseModelfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -185,6 +186,7 @@ class GetCurrentTimeBlock(Block):lambda t: "T" in t and ("+" in t or "Z" in t),), # Check for ISO format with timezone],+ effect=BlockEffect.NONE,)async def run(@@ -295,6 +297,7 @@ class GetCurrentDateBlock(Block):and t[7] == "-", # ISO date format YYYY-MM-DD),],+ effect=BlockEffect.NONE,)async def run(@@ -401,6 +404,7 @@ class GetCurrentDateAndTimeBlock(Block):< timedelta(seconds=10), # 10 seconds error margin for ISO format.),],+ effect=BlockEffect.NONE,)async def run(@@ -476,6 +480,7 @@ class CountdownTimerBlock(Block):("output_message", "timer finished"),("output_message", "Custom message"),],+ effect=BlockEffect.NONE,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/todoist/comments.py b/autogpt_platform/backend/backend/blocks/todoist/comments.pyindex 3f78342b1b..4b5a16e335 100644--- a/autogpt_platform/backend/backend/blocks/todoist/comments.py+++ b/autogpt_platform/backend/backend/blocks/todoist/comments.py@@ -7,6 +7,7 @@ from typing_extensions import Optionalfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -417,6 +418,7 @@ class TodoistDeleteCommentBlock(Block):test_output=[("success", True)],test_mock={"delete_comment": lambda credentials, comment_id: True},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/todoist/labels.py b/autogpt_platform/backend/backend/blocks/todoist/labels.pyindex 78c209a858..4947aeb007 100644--- a/autogpt_platform/backend/backend/blocks/todoist/labels.py+++ b/autogpt_platform/backend/backend/blocks/todoist/labels.py@@ -4,6 +4,7 @@ from typing_extensions import Optionalfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -378,6 +379,7 @@ class TodoistDeleteLabelBlock(Block):test_output=[("success", True)],test_mock={"delete_label": lambda *args, **kwargs: True},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethod@@ -538,6 +540,7 @@ class TodoistRemoveSharedLabelsBlock(Block):test_output=[("success", True)],test_mock={"remove_shared_label": lambda *args, **kwargs: True},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/todoist/projects.py b/autogpt_platform/backend/backend/blocks/todoist/projects.pyindex 1d9c7f135d..5c1ab2f045 100644--- a/autogpt_platform/backend/backend/blocks/todoist/projects.py+++ b/autogpt_platform/backend/backend/blocks/todoist/projects.py@@ -4,6 +4,7 @@ from typing_extensions import Optionalfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -428,6 +429,7 @@ class TodoistDeleteProjectBlock(Block):test_output=[("success", True)],test_mock={"delete_project": lambda *args, **kwargs: (True)},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/todoist/sections.py b/autogpt_platform/backend/backend/blocks/todoist/sections.pyindex c8f75063ed..dce92f18ed 100644--- a/autogpt_platform/backend/backend/blocks/todoist/sections.py+++ b/autogpt_platform/backend/backend/blocks/todoist/sections.py@@ -4,6 +4,7 @@ from typing_extensions import Optionalfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -287,6 +288,7 @@ class TodoistDeleteSectionBlock(Block):test_output=[("success", True)],test_mock={"delete_section": lambda *args, **kwargs: (True)},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/todoist/tasks.py b/autogpt_platform/backend/backend/blocks/todoist/tasks.pyindex e6438d01cc..7488da4cba 100644--- a/autogpt_platform/backend/backend/blocks/todoist/tasks.py+++ b/autogpt_platform/backend/backend/blocks/todoist/tasks.py@@ -7,6 +7,7 @@ from typing_extensions import Optionalfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -634,6 +635,7 @@ class TodoistDeleteTaskBlock(Block):],test_mock={"delete_task": lambda *args, **kwargs: (True)},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/twitter/lists/manage_lists.py b/autogpt_platform/backend/backend/blocks/twitter/lists/manage_lists.pyindex 9b973a835d..acd0dbeba4 100644--- a/autogpt_platform/backend/backend/blocks/twitter/lists/manage_lists.py+++ b/autogpt_platform/backend/backend/blocks/twitter/lists/manage_lists.py@@ -6,6 +6,7 @@ from tweepy.client import Responsefrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -53,6 +54,7 @@ class TwitterDeleteListBlock(Block):test_output=[("success", True)],test_mock={"delete_list": lambda *args, **kwargs: True},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/twitter/tweets/manage.py b/autogpt_platform/backend/backend/blocks/twitter/tweets/manage.pyindex ef213714a5..355f6c758f 100644--- a/autogpt_platform/backend/backend/blocks/twitter/tweets/manage.py+++ b/autogpt_platform/backend/backend/blocks/twitter/tweets/manage.py@@ -8,6 +8,7 @@ from tweepy.client import Responsefrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -162,6 +163,7 @@ class TwitterPostTweetBlock(Block):)},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)def post_tweet(@@ -281,6 +283,7 @@ class TwitterDeleteTweetBlock(Block):test_output=[("success", True)],test_mock={"delete_tweet": lambda *args, **kwargs: True},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/twitter/tweets/retweet.py b/autogpt_platform/backend/backend/blocks/twitter/tweets/retweet.pyindex c008118cbb..3317a9430d 100644--- a/autogpt_platform/backend/backend/blocks/twitter/tweets/retweet.py+++ b/autogpt_platform/backend/backend/blocks/twitter/tweets/retweet.py@@ -6,6 +6,7 @@ from tweepy.client import Responsefrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -69,6 +70,7 @@ class TwitterRetweetBlock(Block):],test_mock={"retweet": lambda *args, **kwargs: True},is_irreversible_action=True,+ effect=BlockEffect.EXTERNAL,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/wolfram/llm_api.py b/autogpt_platform/backend/backend/blocks/wolfram/llm_api.pyindex c7bc7ef9b4..47c4581070 100644--- a/autogpt_platform/backend/backend/blocks/wolfram/llm_api.py+++ b/autogpt_platform/backend/backend/blocks/wolfram/llm_api.py@@ -3,6 +3,7 @@ from backend.sdk import (Block,BlockCategory,BlockCostType,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -43,6 +44,7 @@ class AskWolframBlock(Block):categories={BlockCategory.SEARCH},input_schema=self.Input,output_schema=self.Output,+ effect=BlockEffect.READ,)async def run(diff --git a/autogpt_platform/backend/backend/blocks/xml_parser.py b/autogpt_platform/backend/backend/blocks/xml_parser.pyindex d50bfe9f0f..63119de2e8 100644--- a/autogpt_platform/backend/backend/blocks/xml_parser.py+++ b/autogpt_platform/backend/backend/blocks/xml_parser.py@@ -1,7 +1,13 @@from gravitasml.parser import Parserfrom gravitasml.token import Token, tokenize-from backend.blocks._base import Block, BlockOutput, BlockSchemaInput, BlockSchemaOutput+from backend.blocks._base import (+ Block,+ BlockEffect,+ BlockOutput,+ BlockSchemaInput,+ BlockSchemaOutput,+)from backend.data.model import SchemaField@@ -23,6 +29,7 @@ class XMLParserBlock(Block):test_output=[("parsed_xml", {"tag1": {"tag2": "content"}}),],+ effect=BlockEffect.NONE,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/youtube.py b/autogpt_platform/backend/backend/blocks/youtube.pyindex 6ce705e4f5..8b64ed997f 100644--- a/autogpt_platform/backend/backend/blocks/youtube.py+++ b/autogpt_platform/backend/backend/blocks/youtube.py@@ -12,6 +12,7 @@ from youtube_transcript_api.proxies import WebshareProxyConfigfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -96,6 +97,7 @@ class TranscribeYoutubeVideoBlock(Block):],"format_transcript": lambda transcript: "Never gonna give you up\nNever gonna let you down",},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/blocks/zerobounce/validate_emails.py b/autogpt_platform/backend/backend/blocks/zerobounce/validate_emails.pyindex 57c0ed3ef7..db13c11149 100644--- a/autogpt_platform/backend/backend/blocks/zerobounce/validate_emails.py+++ b/autogpt_platform/backend/backend/blocks/zerobounce/validate_emails.py@@ -10,6 +10,7 @@ from zerobouncesdk.zb_validate_response import (from backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockOutput,BlockSchemaInput,BlockSchemaOutput,@@ -158,6 +159,7 @@ class ValidateEmailsBlock(Block):))},+ effect=BlockEffect.READ,)@staticmethoddiff --git a/autogpt_platform/backend/backend/copilot/gate/__init__.py b/autogpt_platform/backend/backend/copilot/gate/__init__.pyindex d1fff49c02..364902b543 100644--- a/autogpt_platform/backend/backend/copilot/gate/__init__.py+++ b/autogpt_platform/backend/backend/copilot/gate/__init__.py@@ -5,14 +5,16 @@ Ordering is the design, cheapest and most certain first:1. gate inactive -> ALLOW (today's behaviour)2. an approval for exactly these args -> ALLOW, consumed single-use3. the user rejected this tool in chat -> ASK, in every mode-4. the mode's verdict for the tool's effect: run, ask, or the supervisor+4. what the call acts on: a block or workflow's own effect, or the tool's;+ a call that runs nothing never asks+5. the mode's verdict for that effect: run, ask, or the supervisorThe supervisor is last because it is the least trusted step: it can only turna run into a question, never the reverse."""import logging-from typing import Any+from typing import Any, Awaitable, Callablefrom prisma.enums import ReviewStatusfrom pydantic import BaseModel, ConfigDict@@ -29,8 +31,9 @@ from .policy import (Effect,Verdict,effect_for,- verdict_for,+ verdict_for_effect,)+from .subject import Subjectlogger = logging.getLogger(__name__)@@ -61,6 +64,10 @@ class Decision(BaseModel):allowed: boolreason: str = ""review_id: str | None = None+ # The user approved this exact call on a card, so nothing downstream asks again.+ approved: bool = False+ # The block or workflow the card names, so the chain row names it too.+ subject_name: str | None = NoneALLOW = Decision(allowed=True)@@ -91,7 +98,10 @@ async def check_action(user_id: str | None,session: ChatSession,tool_call_id: str = "",+ subject_of: Callable[[], Awaitable[Subject | None]] | None = None,) -> Decision:+ """``subject_of`` resolves what the call acts on; it runs only once no+ approval answers the call, so an approved call is never re-derived."""if not await gate_active(user_id, session):return ALLOWassert user_id is not None@@ -104,27 +114,40 @@ async def check_action(session_id = session.session_idreview_id = review_store.review_id_for(session_id, user_id, tool_name, args)- status = await review_store.find_decision(review_id, user_id, session_id)- if status == ReviewStatus.APPROVED:+ review = await review_store.find_review(review_id, user_id, session_id)+ if review is not None and review.status == ReviewStatus.APPROVED:if await review_store.consume(review_id, user_id):- return ALLOW+ return Decision(allowed=True, approved=True)return Decision(allowed=False, reason=_CONSUMED)- if status == ReviewStatus.REJECTED:+ if review is not None and review.status == ReviewStatus.REJECTED:await review_store.consume(review_id, user_id)- await chat_rules.set_ask(session_id, tool_name)+ await chat_rules.set_ask(+ session_id, await held.rule_key(session_id, review_id, tool_name)+ )return Decision(allowed=False, reason=_REJECTED)- if status == ReviewStatus.WAITING:+ if review is not None and review.status == ReviewStatus.WAITING:# The first call's card and stored call stand; re-storing would# re-point the late result at the retry's tool call id.return Decision(allowed=False, reason=_ALREADY_HELD, review_id=review_id)+ subject = await subject_of() if subject_of is not None else None+ effect = subject.effect if subject is not None else effect_for(tool_name)+ if effect is Effect.UNGATED:+ return ALLOW+ rule_key = subject.key if subject is not None else tool_namemode = resolve_mode(session)- verdict = verdict_for(mode, tool_name)+ verdict = verdict_for_effect(mode, effect)reason_kind: review_store.ReasonKind- if rule_reason := await chat_rules.ask_reason(session_id, tool_name):+ # A block or workflow that only reads can never have been parked, though+ # the tool calling it can, so it skips the Redis round trip too.+ if effect in _PARKABLE and (+ rule_reason := await chat_rules.ask_reason(session_id, rule_key)+ ):reason, reason_kind = rule_reason, "rule"elif verdict is Verdict.RUN:return ALLOW+ elif verdict is Verdict.ASK and subject is not None and subject.reason:+ reason, reason_kind = subject.reason, "subject"elif verdict is Verdict.ASK:reason = _ASK_FIRST if mode == "ask_first" else _OUTWARDreason_kind = "mode"@@ -138,9 +161,13 @@ async def check_action(if allowed:return ALLOWcall = held.HeldCall(- review_id=review_id, tool_name=tool_name, tool_call_id=tool_call_id, args=args+ review_id=review_id,+ tool_name=tool_name,+ tool_call_id=tool_call_id,+ args=args,+ rule_key=rule_key,)- return await _park(call, user_id, session, reason, reason_kind)+ return await _park(call, user_id, session, reason, reason_kind, subject)async def _park(@@ -149,6 +176,7 @@ async def _park(session: ChatSession,reason: str,reason_kind: review_store.ReasonKind,+ subject: Subject | None,) -> Decision:"""Cards queue per chat: the call is kept so its answer can finish it."""if not await held.remember(session.session_id, call):@@ -160,12 +188,18 @@ async def _park(call.tool_name,call.args,reason,+ subject,reason_kind=reason_kind,tool_call_id=call.tool_call_id,):await held.forget(session.session_id, call.review_id)return Decision(allowed=False, reason=_UNRECORDABLE)- return Decision(allowed=False, reason=reason, review_id=call.review_id)+ return Decision(+ allowed=False,+ reason=reason,+ review_id=call.review_id,+ subject_name=subject.name if subject is not None else None,+ )def refusal_message(reason: str, review_id: str | None) -> str:diff --git a/autogpt_platform/backend/backend/copilot/gate/card_fixture_test.py b/autogpt_platform/backend/backend/copilot/gate/card_fixture_test.pynew file mode 100644index 0000000000..f0d4e879c4--- /dev/null+++ b/autogpt_platform/backend/backend/copilot/gate/card_fixture_test.py@@ -0,0 +1,196 @@+"""The approval cards the frontend's stories and tests render are built here,+by the real payload builder from real registry blocks, so they cannot drift.++Regenerate with ``UPDATE_CARD_FIXTURE=1``.+"""++import json+import os+from datetime import UTC, datetime+from pathlib import Path+from typing import Any++from backend.blocks.ayrshare.post_to_x import PostToXBlock+from backend.blocks.code_executor import ExecuteCodeStepBlock+from backend.blocks.google.gmail import GmailSendBlock+from backend.blocks.google.sheets import GoogleSheetsUpdateRowBlock+from backend.blocks.http import SendWebRequestBlock+from backend.copilot.gate.policy import Effect+from backend.copilot.gate.review import review_id_for, review_payload+from backend.copilot.gate.subject import block_subject, workflow_subject+from backend.data.graph import GraphModel, NodeModel++FIXTURE = (+ Path(__file__).parents[4]+ / "frontend/src/app/(platform)/copilot/components/ApprovalQueue/__tests__"+ / "realCards.json"+)+_BODY = (+ "Hi Dana,\n\nThe Q3 invoice pack is in the shared Invoices folder. Three of "+ "them are still missing a PO number:\n\n- INV-2041\n- INV-2044\n- INV-2051\n\n"+ "Could you look before Friday?\n\nThanks,\nOtto"+)+_BLOCKS: list[tuple[str, Any, dict[str, Any]]] = [+ (+ "Gmail Send",+ GmailSendBlock(),+ {+ "to": ["[email protected]"],+ "cc": ["[email protected]"],+ "subject": "Q3 invoices missing PO numbers",+ "body": _BODY,+ },+ ),+ (+ "Google Sheets Update Row",+ GoogleSheetsUpdateRowBlock(),+ {+ "spreadsheet": {+ "id": "1x9QwErTyUiOp",+ "name": "Q3 invoices",+ "mimeType": "application/vnd.google-apps.spreadsheet",+ "url": "https://docs.google.com/spreadsheets/d/1x9QwErTyUiOp",+ },+ "sheet_name": "October",+ "row_index": 7,+ "values": ["INV-2044", "4,210.00", "Paid"],+ },+ ),+ (+ "Execute Code Step",+ ExecuteCodeStepBlock(),+ {+ "sandbox_id": "sbx-q3",+ "language": "python",+ "step_code": (+ "import pandas as pd\n\n"+ "df = pd.read_csv('invoices.csv')\n"+ "missing = df[df.po_number.isna()]\n"+ "print(missing[['id', 'amount']].to_markdown())\n"+ ),+ },+ ),+ (+ "Send Web Request",+ SendWebRequestBlock(),+ {+ "url": "https://api.acme.com/v2/invoices/2044/status",+ "method": "POST",+ "headers": {+ "Content-Type": "application/json",+ "Authorization": "Bearer sk-live-9f2",+ },+ "body": {"status": "paid", "paid_at": "2026-09-24", "lines": [1, 2, 3]},+ },+ ),+ (+ "Post To X",+ PostToXBlock(),+ {+ "post": "Q3 is closed. Thanks to everyone who got their invoices in on time.",+ "media_urls": ["https://cdn.acme.com/q3-chart.png"],+ "alt_text": ["Bar chart of Q3 revenue by month"],+ "shorten_links": True,+ },+ ),+]+++def build_cards() -> list[dict[str, Any]]:+ cards = [_block_card(*entry) for entry in _BLOCKS]+ cards.append(_workflow_card())+ return json.loads(json.dumps(cards, default=str))+++def test_the_frontend_card_fixture_is_what_the_builder_makes():+ cards = build_cards()+ if os.environ.get("UPDATE_CARD_FIXTURE"):+ FIXTURE.write_text(json.dumps(cards, indent=2, ensure_ascii=False) + "\n")+ assert (+ json.loads(FIXTURE.read_text()) == cards+ ), "the approval-card fixture is stale; rerun with UPDATE_CARD_FIXTURE=1"+++# What the supervisor might say of the code block's step; the builder cannot+# call the model, so this stands in for its verdict.+_SUPERVISOR = "it reads a local file of invoices and prints what it finds."+++def _block_card(story: str, block: Any, inputs: dict[str, Any]) -> dict[str, Any]:+ subject = block_subject(block, inputs)+ args = {"id": block.id, "input": inputs}+ judged = subject.effect is Effect.SHELL+ return {+ "story": story,+ "review": _row(+ "run_capability",+ args,+ subject,+ reason=_SUPERVISOR if judged else subject.reason,+ reason_kind="supervisor" if judged else None,+ ),+ "schema": block.input_schema.jsonschema(),+ }+++def _workflow_card() -> dict[str, Any]:+ send = GmailSendBlock()+ graph = GraphModel(+ id="g-digest",+ version=1,+ name="Morning digest",+ description="",+ user_id="user-1",+ created_at=datetime(2026, 9, 24, tzinfo=UTC),+ nodes=[+ NodeModel(+ id="send",+ block_id=send.id,+ input_default={},+ graph_id="g-digest",+ graph_version=1,+ )+ ],+ links=[],+ sub_graphs=[],+ )+ args = {"library_agent_id": "lib-7", "inputs": {"topic": "Q3 invoices"}}+ return {+ "story": "Workflow",+ "review": _row("run_agent", args, workflow_subject(graph)),+ "schema": None,+ }+++def _row(+ tool: str,+ args: dict[str, Any],+ subject: Any,+ reason: str | None = None,+ reason_kind: str | None = None,+) -> dict[str, Any]:+ reason = subject.reason if reason is None else reason+ review_id = review_id_for("session-1", "user-1", tool, args)+ node_id = review_id.split(":")[0]+ return {+ "node_exec_id": review_id,+ "node_id": node_id,+ "user_id": "user-1",+ "session_id": "s1",+ "graph_exec_id": None,+ "graph_id": None,+ "graph_version": None,+ "payload": review_payload(+ tool,+ args,+ subject,+ reason=reason,+ reason_kind=reason_kind or ("subject" if reason else "mode"),+ mode="auto",+ tool_call_id=f"call-{tool}",+ turn=1,+ ),+ "instructions": subject.name,+ "editable": False,+ "status": "WAITING",+ }diff --git a/autogpt_platform/backend/backend/copilot/gate/effects.py b/autogpt_platform/backend/backend/copilot/gate/effects.pynew file mode 100644index 0000000000..8245a57327--- /dev/null+++ b/autogpt_platform/backend/backend/copilot/gate/effects.py@@ -0,0 +1,173 @@+"""What a block or a workflow run would do, for the gate to decide on.++``None`` is the answer whenever the effect cannot be read — an undeclared+block, an input another node supplies, a sub-graph that is not there — and+every caller treats it as EXTERNAL.+"""++from typing import TYPE_CHECKING, Any, Callable, Iterable, NamedTuple++from backend.blocks._base import Block, BlockEffect, BlockType++if TYPE_CHECKING:+ from backend.data.graph import BaseGraph, GraphModel++BlockInputs = dict[str, Any]+++class Resolved(NamedTuple):+ effect: BlockEffect | None+ # The block that decided it: the worst node, or the one nobody can read.+ decided_by: Block | None = None+ # A node nobody can read, kept even where an irreversible one decided.+ unreadable: Block | None = None+++def block_effect(+ block: Block, inputs: BlockInputs, linked_inputs: Iterable[str] = ()+) -> BlockEffect | None:+ """``linked_inputs`` are the input names another node supplies at run time."""+ if block.block_type in _STRUCTURAL:+ return _STRUCTURAL[block.block_type]+ resolve = _INPUT_DECIDED.get(type(block).__name__)+ if resolve is not None:+ return resolve(inputs, frozenset(linked_inputs))+ return block.effect+++def graph_effect(graph: "GraphModel") -> Resolved:+ """The worst effect of any node across a graph and its sub-graphs.++ A write iterated N times is still a write, so the loop structure is+ irrelevant; one node nobody can read makes the whole run unreadable. The+ walk never stops early: an irreversible node anywhere names the run, since+ approving the card lifts the pause that would otherwise have caught it.+ """+ graphs: list["BaseGraph"] = [graph, *graph.sub_graphs]+ present = {g.id for g in graphs}+ worst = Resolved(BlockEffect.NONE)+ unreadable: Block | None = None+ for each in graphs:+ linked = _linked_input_names(each)+ for node in each.nodes:+ block = node.block+ if block.block_type is BlockType.AGENT:+ # Its nodes are counted where the sub-graph itself is walked.+ if node.input_default.get("graph_id") not in present:+ unreadable = unreadable or block+ continue+ effect = block_effect(+ block, node.input_default, linked.get(node.id, frozenset())+ )+ if effect is None:+ unreadable = unreadable or block+ elif _worse(effect, block, worst):+ worst = Resolved(effect, block)+ if unreadable is None or _irreversible(worst):+ return worst._replace(unreadable=unreadable)+ return Resolved(None, unreadable, unreadable)+++RANK = {effect: rank for rank, effect in enumerate(BlockEffect)}+++def _worse(effect: BlockEffect, block: Block, than: Resolved) -> bool:+ """Among equals an irreversible node names the run: it is what the card warns of."""+ current = than.effect or BlockEffect.NONE+ if RANK[effect] != RANK[current]:+ return RANK[effect] > RANK[current]+ return block.is_irreversible_action and not _irreversible(than)+++def _irreversible(resolved: Resolved) -> bool:+ return (+ resolved.decided_by is not None and resolved.decided_by.is_irreversible_action+ )+++# Input, output, note and human-in-the-loop nodes do nothing; a trigger receives.+# A nested workflow (AGENT) is resolved through its sub-graph instead.+_STRUCTURAL: dict[BlockType, BlockEffect] = {+ BlockType.INPUT: BlockEffect.NONE,+ BlockType.OUTPUT: BlockEffect.NONE,+ BlockType.NOTE: BlockEffect.NONE,+ BlockType.HUMAN_IN_THE_LOOP: BlockEffect.NONE,+ BlockType.WEBHOOK: BlockEffect.READ,+ BlockType.WEBHOOK_MANUAL: BlockEffect.READ,+}+STRUCTURAL_TYPES = frozenset(_STRUCTURAL) | {BlockType.AGENT}++# Exfiltration by GET stays possible, the same accepted limit ``web_fetch``+# carries; the fix is egress control, not a narrower method list.+_SAFE_HTTP_METHODS = frozenset({"GET", "HEAD", "OPTIONS"})+++def _web_request_effect(+ inputs: BlockInputs, linked: frozenset[str]+) -> BlockEffect | None:+ if "method" in linked:+ return None+ method = inputs.get("method", "POST") # SendWebRequestBlock.Input default+ name = getattr(method, "value", method)+ if not isinstance(name, str):+ return None+ if name.upper() in _SAFE_HTTP_METHODS:+ return BlockEffect.READ+ return BlockEffect.EXTERNAL+++def _sql_query_effect(+ inputs: BlockInputs, linked: frozenset[str]+) -> BlockEffect | None:+ if "read_only" in linked:+ return None+ read_only = inputs.get("read_only", True) # SQLQueryBlock.Input default+ if not isinstance(read_only, bool):+ return None+ return BlockEffect.READ if read_only else BlockEffect.EXTERNAL+++_INPUT_DECIDED: dict[+ str, Callable[[BlockInputs, frozenset[str]], BlockEffect | None]+] = {+ "SendWebRequestBlock": _web_request_effect,+ "SendAuthenticatedWebRequestBlock": _web_request_effect,+ "SQLQueryBlock": _sql_query_effect,+}++# Unreadable by construction: what they do lives in code the caller supplies,+# on a remote server, or in another model's choices. The input-decided three+# are here too because a declaration on them would bypass their input.+UNREADABLE_BLOCKS = frozenset(+ {+ "AutoPilotBlock",+ "ClaudeCodeBlock",+ "CodeGenerationBlock",+ "ExecuteCodeBlock",+ "ExecuteCodeStepBlock",+ "InstantiateCodeSandboxBlock",+ "MCPToolBlock",+ "OrchestratorBlock",+ *_INPUT_DECIDED,+ }+)+++# Unreadable blocks whose effect is the code the call itself carries: the+# supervisor reads that code, as it reads a bash_exec command. Add a block here+# only when everything it does is in its own input.+JUDGED_BLOCKS = frozenset(+ {+ "ClaudeCodeBlock",+ "ExecuteCodeBlock",+ "ExecuteCodeStepBlock",+ "InstantiateCodeSandboxBlock",+ }+)+++def _linked_input_names(graph: "BaseGraph") -> dict[str, frozenset[str]]:+ by_node: dict[str, set[str]] = {}+ for link in graph.links:+ by_node.setdefault(link.sink_id, set()).add(link.sink_name)+ return {node_id: frozenset(names) for node_id, names in by_node.items()}diff --git a/autogpt_platform/backend/backend/copilot/gate/gate_test.py b/autogpt_platform/backend/backend/copilot/gate/gate_test.pyindex 11dfb63a01..616efcb9ec 100644--- a/autogpt_platform/backend/backend/copilot/gate/gate_test.py+++ b/autogpt_platform/backend/backend/copilot/gate/gate_test.py@@ -6,6 +6,7 @@ it should break these."""from datetime import UTC, datetime+from types import SimpleNamespacefrom unittest.mock import AsyncMock, patchimport pytest@@ -41,6 +42,10 @@ def _session()+def _row(status: ReviewStatus, payload: dict | None = None) -> SimpleNamespace:+ return SimpleNamespace(status=status, payload=payload or {})++@pytest.fixturedef gate_on():with patch(f"{_GATE}.is_feature_enabled", AsyncMock(return_value=True)):@@ -51,8 +56,9 @@ def gate_on():def clean_session_state():"""No prior approval and nothing rejected in this chat."""with (- patch(f"{_GATE}.review_store.find_decision", AsyncMock(return_value=None)),+ patch(f"{_GATE}.review_store.find_review", AsyncMock(return_value=None)),patch(f"{_GATE}.held.remember", AsyncMock(return_value=True)),+ patch(f"{_GATE}.held._held", AsyncMock(return_value={})),patch(f"{_GATE}.review_store.open_review", AsyncMock(return_value=True)),patch(f"{_GATE}.chat_rules.ask_reason", AsyncMock(return_value=None)),patch(f"{_GATE}.chat_rules.set_ask", AsyncMock()),@@ -77,7 +83,7 @@ async def test_a_session_nobody_is_watching_is_inert_in_every_mode(gate_on, mode, origin):find = AsyncMock()- with patch(f"{_GATE}.review_store.find_decision", find):+ with patch(f"{_GATE}.review_store.find_review", find):decision = await check_action("post_to_chat_platform", {}, "u", _session(mode, origin=origin))@@ -97,8 +103,8 @@ async def test_an_approval_is_consulted_before_the_effect(gate_on, clean_session"""Otherwise an approved outward call would park a second card forever."""with (patch(- f"{_GATE}.review_store.find_decision",- AsyncMock(return_value=ReviewStatus.APPROVED),+ f"{_GATE}.review_store.find_review",+ AsyncMock(return_value=_row(ReviewStatus.APPROVED)),),patch(f"{_GATE}.review_store.consume", AsyncMock(return_value=True)),):@@ -155,9 +161,9 @@ async def test_unsupervised_runs_outward_actions(gate_on, clean_session_state):async def test_approval_is_bound_to_these_arguments(gate_on, clean_session_state):"""An approval means 'you may do this', not 'you may use this tool'."""- approved = AsyncMock(return_value=ReviewStatus.APPROVED)+ approved = AsyncMock(return_value=_row(ReviewStatus.APPROVED))with (- patch(f"{_GATE}.review_store.find_decision", approved),+ patch(f"{_GATE}.review_store.find_review", approved),patch(f"{_GATE}.review_store.consume", AsyncMock(return_value=True)),):decision = await check_action("bash_exec", {"command": "ls"}, "u", _session())@@ -166,7 +172,7 @@ async def test_approval_is_bound_to_these_arguments(gate_on, clean_session_statewith (patch(- f"{_GATE}.review_store.find_decision", AsyncMock(return_value=None)+ f"{_GATE}.review_store.find_review", AsyncMock(return_value=None)) as other,patch(f"{_GATE}.classify", AsyncMock(return_value=(False, "ask"))),):@@ -177,8 +183,8 @@ async def test_approval_is_bound_to_these_arguments(gate_on, clean_session_stateasync def test_a_lost_consume_race_does_not_execute(gate_on, clean_session_state):with (patch(- f"{_GATE}.review_store.find_decision",- AsyncMock(return_value=ReviewStatus.APPROVED),+ f"{_GATE}.review_store.find_review",+ AsyncMock(return_value=_row(ReviewStatus.APPROVED)),),patch(f"{_GATE}.review_store.consume", AsyncMock(return_value=False)),):@@ -193,8 +199,8 @@ async def test_a_rejection_makes_the_tool_ask_for_the_rest_of_the_chat(set_ask = AsyncMock()with (patch(- f"{_GATE}.review_store.find_decision",- AsyncMock(return_value=ReviewStatus.REJECTED),+ f"{_GATE}.review_store.find_review",+ AsyncMock(return_value=_row(ReviewStatus.REJECTED)),),patch(f"{_GATE}.review_store.consume", AsyncMock(return_value=True)),patch(f"{_GATE}.chat_rules.set_ask", set_ask),diff --git a/autogpt_platform/backend/backend/copilot/gate/headline.py b/autogpt_platform/backend/backend/copilot/gate/headline.pyindex 181b97b737..e8ce08f7c2 100644--- a/autogpt_platform/backend/backend/copilot/gate/headline.py+++ b/autogpt_platform/backend/backend/copilot/gate/headline.py@@ -48,6 +48,9 @@ _ASK: dict[str, tuple[str, tuple[str, ...]]] = {"delete_skill": ("Delete skill", ("name",)),"delete_workspace_file": ("Delete file", ("path",)),"memory_forget_confirm": ("Forget memories", ()),+ # The card names the block or workflow from the call's subject instead.+ "run_capability": ("Run a block", ()),+ "run_agent": ("Run a workflow", ()),}_MAX_OBJECT_CHARS = 60diff --git a/autogpt_platform/backend/backend/copilot/gate/held.py b/autogpt_platform/backend/backend/copilot/gate/held.pyindex e7e0311d5c..d1b63e2ac5 100644--- a/autogpt_platform/backend/backend/copilot/gate/held.py+++ b/autogpt_platform/backend/backend/copilot/gate/held.py@@ -65,6 +65,8 @@ class HeldCall(BaseModel):tool_name: strtool_call_id: strargs: dict[str, Any]+ # What a rejection sets to ask for the rest of the chat; the tool when None.+ rule_key: str | None = Noneheld_at: datetime = Field(default_factory=lambda: datetime.now(UTC))# Rebuilt from a card whose stored copy of the arguments no longer binds.lost: bool = False@@ -92,6 +94,12 @@ async def remember(session_id: str, call: HeldCall) -> bool:return False+async def rule_key(session_id: str, review_id: str, tool_name: str) -> str:+ """What a rejection of this card sets to ask: its subject, else its tool."""+ call = (await _held(session_id)).get(review_id)+ return (call.rule_key if call else None) or tool_name++async def forget(session_id: str, review_id: str) -> None:"""Drop a call whose card was never opened; nothing can answer it."""await _claim(session_id, review_id)@@ -308,7 +316,7 @@ async def _outcome(return await answered_read(user_id, row)if row.status == ReviewStatus.REJECTED:await review_store.consume(call.review_id, user_id)- await chat_rules.set_ask(session.session_id, call.tool_name)+ await chat_rules.set_ask(session.session_id, call.rule_key or call.tool_name)return "rejected", ("Nothing ran: the user declined this action. Do not retry it or ""reach the same effect another way."diff --git a/autogpt_platform/backend/backend/copilot/gate/policy.py b/autogpt_platform/backend/backend/copilot/gate/policy.pyindex 6ed6057390..5cf20e5aa9 100644--- a/autogpt_platform/backend/backend/copilot/gate/policy.py+++ b/autogpt_platform/backend/backend/copilot/gate/policy.py@@ -19,8 +19,7 @@ class Effect(str, Enum):PLATFORM = "platform"EXTERNAL = "external"# Never gated: the call is itself a question to the user, finishes a- # review that is already open, or answers to L1's irreversible-action pause- # until it can name its subject.+ # review that is already open, or runs nothing.UNGATED = "ungated"@@ -136,11 +135,13 @@ _UNGATED = frozenset("connect_integration","request_credential_grant","resume_capability",- "run_agent",- "run_capability",})+# Decided by the block or workflow they run (``gate_subject``); without one+# they cannot be read, and unreadable asks.+_BY_SUBJECT = frozenset({"run_agent", "run_capability"})+# Registered straight onto the MCP server by ``create_copilot_mcp_server``, so# the second seam in ``sdk/tool_adapter.py`` is the only gate they reach.MCP_FILE_WRITE_TOOLS = frozenset({"Edit", "Write", "edit_file", "write_file"})@@ -153,7 +154,7 @@ _EFFECTS: dict[str, Effect] = {**{name: Effect.WORKSPACE for name in _WORKSPACE | MCP_FILE_WRITE_TOOLS},"bash_exec": Effect.SHELL,**{name: Effect.PLATFORM for name in _PLATFORM},- **{name: Effect.EXTERNAL for name in _EXTERNAL},+ **{name: Effect.EXTERNAL for name in _EXTERNAL | _BY_SUBJECT},**{name: Effect.UNGATED for name in _UNGATED},}@@ -194,7 +195,10 @@ def effect_for(tool_name: str) -> Effect:def verdict_for(mode: AutopilotMode, tool_name: str) -> Verdict:- effect = effect_for(tool_name)+ return verdict_for_effect(mode, effect_for(tool_name))+++def verdict_for_effect(mode: AutopilotMode, effect: Effect) -> Verdict:if effect is Effect.UNGATED:return Verdict.RUNreturn _MODE_VERDICTS[mode][effect]diff --git a/autogpt_platform/backend/backend/copilot/gate/policy_test.py b/autogpt_platform/backend/backend/copilot/gate/policy_test.pyindex 73a8713e13..9d298f65cd 100644--- a/autogpt_platform/backend/backend/copilot/gate/policy_test.py+++ b/autogpt_platform/backend/backend/copilot/gate/policy_test.py@@ -33,7 +33,6 @@ def test_the_table_names_no_tool_that_does_not_exist():("bash_exec", Verdict.ASK, Verdict.JUDGE, Verdict.RUN),("delete_folder", Verdict.ASK, Verdict.JUDGE, Verdict.RUN),("post_to_chat_platform", Verdict.ASK, Verdict.ASK, Verdict.RUN),- ("run_agent", Verdict.RUN, Verdict.RUN, Verdict.RUN),],)def test_each_modes_column(tool, ask_first, auto, unsupervised):@@ -57,10 +56,9 @@ def test_questions_to_the_user_and_completions_are_never_gated(tool):@pytest.mark.parametrize("tool", ["run_capability", "run_agent"])-def test_capability_and_workflow_runs_stay_on_the_irreversible_pause(tool):- """They get a subject the mode can decide on in L5a; until then the- irreversible-action pause is their gate."""- assert effect_for(tool) is Effect.UNGATED+def test_a_run_without_a_subject_is_unreadable(tool):+ """Their subject decides; if resolving it is ever skipped, they ask."""+ assert effect_for(tool) is Effect.EXTERNALdef test_retired_tool_names_are_gone():diff --git a/autogpt_platform/backend/backend/copilot/gate/review.py b/autogpt_platform/backend/backend/copilot/gate/review.pyindex e6643fd12b..2a495d1bca 100644--- a/autogpt_platform/backend/backend/copilot/gate/review.py+++ b/autogpt_platform/backend/backend/copilot/gate/review.py@@ -11,7 +11,7 @@ import hashlibimport jsonimport loggingfrom datetime import UTC, datetime, timedelta-from typing import Any, Literal+from typing import TYPE_CHECKING, Any, Literalfrom prisma.enums import ReviewStatusfrom pydantic import BaseModel@@ -31,6 +31,9 @@ from backend.data.db_accessors import review_dbfrom .headline import Headline, headline_forfrom .policy import DEFAULT_MODE, effect_for, is_irreversible+if TYPE_CHECKING:+ from .subject import Subject as GateSubject+logger = logging.getLogger(__name__)# Keep the stored payload small: @@agptfile: references are expanded before the@@ -48,6 +51,8 @@ class Subject(BaseModel):name: streffect: strirreversible: bool = False+ # A block's fields are labelled from its own input schema.+ block_id: str | None = Noneclass FieldLabel(BaseModel):@@ -103,6 +108,7 @@ def review_id_for(def review_payload(tool_name: str,args: dict[str, Any],+ subject: "GateSubject | None" = None,*,reason: str = "",reason_kind: ReasonKind = "mode",@@ -110,6 +116,12 @@ def review_payload(tool_call_id: str = "",turn: int = 0,) -> dict[str, Any]:+ """The subject is kept as decided when the card opened: what the user saw,+ not a recomputation over a tree that may have moved since."""+ # A block's card lists the block's own inputs, each clipped on its own.+ if subject is not None and subject.key.startswith("block:"):+ block_input = args.get("input")+ args = block_input if isinstance(block_input, dict) else {}redacted = _redact_secret_keys(args)# Per value, never the whole blob: a long first argument must not push# the one that matters off the card while the approval still binds it.@@ -123,15 +135,14 @@ def review_payload(tool_call_id=tool_call_id,turn=turn,mode=mode,- subject=Subject(- key=tool_name,- name=_label(tool_name),- effect=effect_for(tool_name).value,- irreversible=is_irreversible(tool_name, args),- ),+ subject=_payload_subject(tool_name, args, subject),reason=" ".join(reason.split())[:300],reason_kind=reason_kind,- headline=headline_for(tool_name, args),+ headline=(+ Headline(ask="Run", object=subject.name)+ if subject is not None+ else headline_for(tool_name, args)+ ),).model_dump()@@ -194,6 +205,7 @@ async def open_review(tool_name: str,args: dict[str, Any],reason: str,+ subject: "GateSubject | None" = None,reason_kind: ReasonKind = "mode",tool_call_id: str = "",) -> bool:@@ -201,6 +213,7 @@ async def open_review(payload = review_payload(tool_name,args,+ subject,reason=reason,reason_kind=reason_kind,mode=session.metadata.autopilot_mode or DEFAULT_MODE,@@ -208,7 +221,7 @@ async def open_review(turn=turn_of(session),)return await open_review_row(- review_id, user_id, session, payload, headline_for(tool_name, args).text+ review_id, user_id, session, payload, payload_headline(payload))@@ -244,6 +257,32 @@ def turn_of(session: ChatSession) -> int:return sum(1 for m in session.messages if m.role == "user")+def payload_headline(payload: dict[str, Any]) -> str:+ return Headline.model_validate(payload["headline"]).text+++def _payload_subject(+ tool_name: str, args: dict[str, Any], subject: "GateSubject | None"+) -> Subject:+ if subject is None:+ return Subject(+ key=tool_name,+ name=_label(tool_name),+ effect=effect_for(tool_name).value,+ irreversible=is_irreversible(tool_name, args),+ )+ # ``block:<id>`` or ``workflow:<graph id>``.+ kind, _, ident = subject.key.partition(":")+ return Subject(+ kind=kind or "tool",+ key=subject.key,+ name=subject.name,+ effect=subject.effect.value,+ irreversible=subject.irreversible,+ block_id=ident if kind == "block" else None,+ )++def _label(tool_name: str) -> str:label = tool_name.replace("_", " ")return label[:1].upper() + label[1:]diff --git a/autogpt_platform/backend/backend/copilot/gate/review_test.py b/autogpt_platform/backend/backend/copilot/gate/review_test.pyindex ca6afa4939..f33147d738 100644--- a/autogpt_platform/backend/backend/copilot/gate/review_test.py+++ b/autogpt_platform/backend/backend/copilot/gate/review_test.py@@ -7,6 +7,7 @@ from unittest.mock import AsyncMock, MagicMock, patchimport pytestfrom prisma.enums import ReviewStatus+from backend.blocks.google.gmail import GmailSendBlockfrom backend.copilot.gate.headline import gated_tools, headline_forfrom backend.copilot.gate.policy import Effect, classified_tools, effect_forfrom backend.copilot.gate.review import (@@ -15,6 +16,7 @@ from backend.copilot.gate.review import (review_id_for,review_payload,)+from backend.copilot.gate.subject import block_subjectdef test_the_same_call_is_the_same_approval():@@ -151,7 +153,7 @@ def test_the_reason_and_its_kind_travel_together(kind):assert payload["reason_kind"] == kind-def test_the_subject_is_the_tool_until_l5a_names_one():+def test_a_bare_tool_is_its_own_subject():payload = review_payload("post_to_chat_platform", {}, mode="auto")assert payload["subject"] == {"kind": "tool",@@ -159,6 +161,7 @@ def test_the_subject_is_the_tool_until_l5a_names_one():"name": "Post to chat platform","effect": "external","irreversible": False,+ "block_id": None,}assert payload["mode"] == "auto"@@ -193,6 +196,29 @@ async def test_an_approval_nobody_came_back_for_expires(status, age, expected):assert db.delete_review_by_node_exec_id.await_count == (expected is None)+def test_a_block_subject_names_the_card_marks_it_and_labels_its_fields():+ block = GmailSendBlock()+ payload = review_payload(+ "run_capability",+ {"id": block.id, "input": {"to": ["[email protected]"]}},+ block_subject(block, {}),+ reason="Runs Gmail Send, which reaches outside the platform.",+ reason_kind="subject",+ )+ assert payload["subject"] == {+ "kind": "block",+ "key": f"block:{block.id}",+ "name": "Gmail Send",+ "effect": "external",+ "irreversible": True,+ "block_id": block.id,+ }+ assert payload["headline"]["ask"] == "Run"+ assert payload["headline"]["object"] == "Gmail Send"+ assert payload["reason_kind"] == "subject"+ assert payload["arguments"] == {"to": ["[email protected]"]}++@pytest.mark.parametrize("path", ["a" * 100 + ".md", "two spaces.md", "line\nbreak.md"])diff --git a/autogpt_platform/backend/backend/copilot/gate/subject.py b/autogpt_platform/backend/backend/copilot/gate/subject.pynew file mode 100644index 0000000000..fa716d4cdf--- /dev/null+++ b/autogpt_platform/backend/backend/copilot/gate/subject.py@@ -0,0 +1,167 @@+"""What a call acts on, when the tool's name alone does not say.++``run_capability`` and ``run_agent`` run a block or a workflow; the gate+decides on that subject's effect, and the card's headline names it.+"""++import re+from typing import TYPE_CHECKING, Any++from pydantic import BaseModel, ConfigDict++from backend.blocks._base import Block, BlockEffect+from backend.copilot.constants import AUTOPILOT_NAME++from .effects import JUDGED_BLOCKS, block_effect, graph_effect+from .policy import Effect++if TYPE_CHECKING:+ from backend.data.graph import GraphModel+++class Subject(BaseModel):+ model_config = ConfigDict(frozen=True)++ # What a chat rule names: ``block:<id>`` or ``workflow:<graph id>``.+ key: str+ name: str+ effect: Effect+ # The line the card shows under the name; empty where nothing asks.+ reason: str = ""+ # A judge rule still asks: the supervisor may not wave through what+ # cannot be taken back.+ irreversible: bool = False+++# A schema lookup, ``validate_only``, a dry run, or a trigger workflow's details:+# nothing runs, so nothing asks, whatever the mode.+NO_OP = Subject(key="", name="", effect=Effect.UNGATED)+# An MCP call keeps its own review until MCP servers carry effect maps.+OWN_REVIEW = Subject(key="", name="", effect=Effect.UNGATED)+++def block_subject(block: Block, inputs: dict[str, Any]) -> Subject:+ effect = block_effect(block, inputs)+ name = display_name(block)+ if type(block).__name__ in JUDGED_BLOCKS:+ # Judged like the shell: the supervisor's verdict is the reason.+ return Subject(key=f"block:{block.id}", name=name, effect=Effect.SHELL)+ return Subject(+ key=f"block:{block.id}",+ name=name,+ effect=_gate_effect(effect),+ reason=_reason(effect, name, culprit=None),+ irreversible=_irreversible(effect, block),+ )+++def workflow_subject(+ graph: "GraphModel", *, schedules: bool = False, saves_preset: bool = False+) -> Subject:+ """``schedules`` and ``saves_preset``: the call also creates a platform+ object, so a read workflow is at least a platform edit."""+ effect, decided_by, unreadable = graph_effect(graph)+ name = graph.name or "Untitled workflow"+ subject = Subject(+ key=f"workflow:{graph.id}",+ name=name,+ effect=_gate_effect(effect),+ reason=_reason(effect, name, culprit=decided_by),+ irreversible=_irreversible(effect, decided_by),+ )+ steps = _irreversible_steps(graph)+ if unreadable is not None and steps:+ # The unknown step leads: nothing else on the card can warn of it.+ subject = subject.model_copy(+ update={+ "irreversible": True,+ "reason": f"{_reason(None, name, unreadable).removesuffix('.')}; "+ f"it also has {_steps(steps)} that can't be undone: "+ f"{_listed(steps)}.",+ }+ )+ elif subject.effect is Effect.EXTERNAL and len(steps) > 1:+ # The approval covers the whole run, so the card names every step it covers.+ subject = subject.model_copy(+ update={+ "irreversible": True,+ "reason": f"Runs {name}; its steps {_listed(steps)} reach "+ "outside the platform.",+ }+ )+ creates = (+ f"Runs {name} and creates a schedule."+ if schedules+ else f"Runs {name} and saves a preset."+ )+ if (schedules or saves_preset) and subject.effect in (+ Effect.READ,+ Effect.WORKSPACE,+ ):+ return subject.model_copy(update={"effect": Effect.PLATFORM, "reason": creates})+ return subject+++def display_name(block: Block) -> str:+ """``GmailSendBlock`` -> ``Gmail Send``; the card drops any headline+ containing "Block", so the suffix must go."""+ bare = block.name.removesuffix("Block")+ return re.sub(r"(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])", " ", bare)+++_EFFECTS = {+ BlockEffect.NONE: Effect.READ,+ BlockEffect.READ: Effect.READ,+ BlockEffect.WORKSPACE: Effect.WORKSPACE,+ BlockEffect.PLATFORM: Effect.PLATFORM,+ BlockEffect.EXTERNAL: Effect.EXTERNAL,+}+++def _gate_effect(effect: BlockEffect | None) -> Effect:+ # Unreadable is treated as external: it asks wherever an outward act asks.+ return Effect.EXTERNAL if effect is None else _EFFECTS[effect]+++def _reason(effect: BlockEffect | None, name: str, culprit: Block | None) -> str:+ """The card's reason line: ``culprit`` is the workflow step that decided."""+ if effect is None:+ step = display_name(culprit) if culprit is not None else name+ return f"{AUTOPILOT_NAME} does not know what {step} does, so he asks."+ does = {+ BlockEffect.EXTERNAL: "reaches outside the platform",+ BlockEffect.PLATFORM: "changes your platform objects",+ }.get(effect)+ if does is None:+ return ""+ if culprit is not None:+ return f"Runs {name}; its step {display_name(culprit)} {does}."+ return f"Runs {name}, which {does}."+++def _irreversible_steps(graph: "GraphModel") -> list[str]:+ names: list[str] = []+ for each in (graph, *graph.sub_graphs):+ for node in each.nodes:+ name = display_name(node.block)+ if node.block.is_irreversible_action and name not in names:+ names.append(name)+ return names+++def _listed(names: list[str]) -> str:+ if len(names) == 1:+ return names[0]+ return ", ".join(names[:-1]) + f" and {names[-1]}"+++def _steps(names: list[str]) -> str:+ return "1 step" if len(names) == 1 else f"{len(names)} steps"+++def _irreversible(effect: BlockEffect | None, block: Block | None) -> bool:+ return (+ effect is BlockEffect.EXTERNAL+ and block is not None+ and block.is_irreversible_action+ )diff --git a/autogpt_platform/backend/backend/copilot/prompting.py b/autogpt_platform/backend/backend/copilot/prompting.pyindex f8a5cf113c..e6f707aa87 100644--- a/autogpt_platform/backend/backend/copilot/prompting.py+++ b/autogpt_platform/backend/backend/copilot/prompting.py@@ -472,6 +472,8 @@ not depend on it; a call that needs its result waits. When nothing is leftthat does not, tell the user what is waiting on them and stop. If theyapprove, its result reaches you later in a `<held_call_result>` naming thecall; pick up from there.+Blocks and workflows that only read or work in your workspace run without+asking. A held call's review id is never for `resume_capability`."""_MODE_SUPPLEMENTS = {diff --git a/autogpt_platform/backend/backend/copilot/tools/base.py b/autogpt_platform/backend/backend/copilot/tools/base.pyindex b0341ced43..55f62f03db 100644--- a/autogpt_platform/backend/backend/copilot/tools/base.py+++ b/autogpt_platform/backend/backend/copilot/tools/base.py@@ -3,7 +3,7 @@import jsonimport loggingfrom collections import deque-from typing import Any+from typing import TYPE_CHECKING, Anyfrom openai.types.chat import ChatCompletionToolParam@@ -23,6 +23,9 @@ from .models import (ToolResponseBase,)+if TYPE_CHECKING:+ from backend.copilot.gate.subject import Subject+logger = logging.getLogger(__name__)# Persist full tool output to workspace when it exceeds this threshold.@@ -305,12 +308,20 @@ async def _record_activity()+# Passed to ``_execute`` of a tool with a gate subject when the user approved+# this exact call; stripped from the model's own arguments so it cannot be forged.+GATE_APPROVED = "_gate_approved"++class BaseTool:"""Base class for all chat tools."""# Opt-in for the digest: an outline is only readable back in windows, so a# tool whose bulk is one long text (a guide, a docs page) must not set it.digest_large_output: bool = False+ # True where ``gate_subject`` is implemented; ``_execute`` then accepts+ # GATE_APPROVED.+ has_gate_subject: bool = False@propertydef name(self) -> str:@@ -358,6 +369,16 @@ class BaseTool:"""return None+ async def gate_subject(+ self, user_id: str, session: ChatSession, args: dict[str, Any]+ ) -> "Subject | None":+ """What this call acts on, where the tool's name alone does not say.++ None leaves the decision to the tool's own effect; a tool that runs a+ block or a workflow names it, so the gate decides on its effect.+ """+ return None+def as_openai_tool(self) -> ChatCompletionToolParam:"""Convert to OpenAI tool format."""return ChatCompletionToolParam(@@ -387,6 +408,7 @@ class BaseTool:Pydantic response object"""+ kwargs.pop(GATE_APPROVED, None)if self.requires_auth and not user_id:logger.warning("Attempted tool call for %s but user not authenticated",@@ -449,9 +471,12 @@ class BaseTool:# ``_execute_tool_sync`` — so there is one place to add, not two.# Must stay AFTER the envelope and name gates: a call the envelope refuses can# never run, so approving it would spend a user's decision on nothing.- gated = await self._gate(user_id, session, tool_call_id, kwargs)+ gated, approved = await self._gate(user_id, session, tool_call_id, kwargs)if gated is not None:return gated+ run_kwargs = kwargs+ if approved and self.has_gate_subject:+ run_kwargs = {**kwargs, GATE_APPROVED: True}# After the gates, so a refused call never looks to a turn-scoped gate# like the tool having run, and before the await, because the gates ask@@ -459,7 +484,7 @@ class BaseTool:session.announce_inflight_tool_call(self.name, kwargs)try:- result = await self._execute(user_id, session, **kwargs)+ result = await self._execute(user_id, session, **run_kwargs)if user_id:await _record_activity(self, user_id, session, result, kwargs)raw_output = result.model_dump_json(exclude_none=True)@@ -500,36 +525,52 @@ class BaseTool:session: ChatSession,tool_call_id: str,kwargs: dict[str, Any],- ) -> StreamToolOutputAvailable | None:- """Refusal to return instead of running, or None to proceed.+ ) -> tuple[StreamToolOutputAvailable | None, bool]:+ """A refusal to return instead of running (or None to proceed), and+ whether the user approved this exact call.A gate that crashes must not become a gate that passes, so anunexpected failure here refuses the call rather than falling through."""from backend.copilot.gate import check_action+ async def subject_of() -> "Subject | None":+ return await self.gate_subject(user_id or "", session, kwargs)+try:decision = await check_action(- self.name, kwargs, user_id, session, tool_call_id+ self.name,+ kwargs,+ user_id,+ session,+ tool_call_id,+ subject_of=subject_of if self.has_gate_subject else None,)except Exception:logger.warning(f"Action gate failed for {self.name}", exc_info=True)- return self._refusal(- tool_call_id,- session,- "This action could not be checked against your approval "- "settings, so nothing ran. Tell the user and stop.",- args=kwargs,+ return (+ self._refusal(+ tool_call_id,+ session,+ "This action could not be checked against your approval "+ "settings, so nothing ran. Tell the user and stop.",+ args=kwargs,+ ),+ False,)if decision.allowed:- return None- return self._refusal(- tool_call_id,- session,- decision.reason,- review_id=decision.review_id,- args=kwargs,+ return None, decision.approved+ return (+ self._refusal(+ tool_call_id,+ session,+ decision.reason,+ review_id=decision.review_id,+ args=kwargs,+ subject_name=decision.subject_name,+ ),+ False,)async def _released_read(@@ -604,11 +645,16 @@ class BaseTool:reason: str,review_id: str | None = None,args: dict[str, Any] | None = None,+ subject_name: str | None = None,) -> StreamToolOutputAvailable:from backend.copilot.gate import refusal_message- from backend.copilot.gate.headline import headline_for+ from backend.copilot.gate.headline import Headline, headline_for- headline = headline_for(self.name, args or {})+ headline = (+ Headline(ask="Run", object=subject_name)+ if subject_name+ else headline_for(self.name, args or {})+ )return StreamToolOutputAvailable(toolCallId=tool_call_id,toolName=self.name,diff --git a/autogpt_platform/backend/backend/copilot/tools/gate_subject_test.py b/autogpt_platform/backend/backend/copilot/tools/gate_subject_test.pynew file mode 100644index 0000000000..ad4f51b837--- /dev/null+++ b/autogpt_platform/backend/backend/copilot/tools/gate_subject_test.py@@ -0,0 +1,679 @@+"""The gate decides a block or workflow run on what it runs, not on the tool.++Driven through ``BaseTool.execute`` so the subject hook, the gate and the+approval handed to the run are the ones the engines call.+"""++import json+from datetime import UTC, datetime+from types import SimpleNamespace+from typing import Any+from unittest.mock import AsyncMock, MagicMock, patch++import pytest+from prisma.enums import ReviewStatus++from backend.blocks._base import BlockEffect+from backend.blocks.agent import AgentExecutorBlock+from backend.blocks.ai_image_generator_block import AIImageGeneratorBlock+from backend.blocks.basic import StoreValueBlock+from backend.blocks.code_executor import ExecuteCodeStepBlock+from backend.blocks.discord.bot_blocks import SendDiscordMessageBlock+from backend.blocks.generic_webhook.triggers import GenericWebhookTriggerBlock+from backend.blocks.github.issues import GithubAddLabelBlock+from backend.blocks.github.repo_files import GithubCreateFileBlock+from backend.blocks.google.gmail import GmailSendBlock+from backend.blocks.http import SendWebRequestBlock+from backend.blocks.io import AgentInputBlock, AgentOutputBlock+from backend.blocks.search import GetWikipediaSummaryBlock+from backend.blocks.sql_query_block import SQLQueryBlock+from backend.copilot.gate.effects import block_effect, graph_effect+from backend.copilot.gate.policy import Effect+from backend.copilot.gate.subject import workflow_subject+from backend.copilot.model import AutopilotMode, ChatSession, ChatSessionMetadata+from backend.copilot.tools.models import BlockOutputResponse, ErrorResponse+from backend.copilot.tools.run_agent import RunAgentTool+from backend.copilot.tools.run_capability import RunCapabilityTool+from backend.data.graph import BaseGraph, GraphModel, Link, Node, NodeModel++_GATE = "backend.copilot.gate"+_CAP = "backend.copilot.tools.run_capability"+_AGENT_GRAPH = "backend.copilot.tools.run_agent._agent_graph"+++def _session(mode: AutopilotMode = "auto") -> ChatSession:+ return ChatSession(+ session_id="session-1",+ user_id="user-1",+ usage=[],+ started_at=datetime.now(UTC),+ updated_at=datetime.now(UTC),+ metadata=ChatSessionMetadata(origin="interactive", autopilot_mode=mode),+ messages=[],+ )+++def gate():+ """The gate on, no approval on record, nothing rejected in this chat."""+ store = SimpleNamespace(+ find_review=AsyncMock(return_value=None),+ open_review=AsyncMock(return_value=True),+ consume=AsyncMock(return_value=True),+ )+ with (+ patch(f"{_GATE}.is_feature_enabled", AsyncMock(return_value=True)),+ patch(f"{_GATE}.review_store.find_review", store.find_review),+ patch(f"{_GATE}.review_store.open_review", store.open_review),+ patch(f"{_GATE}.review_store.consume", store.consume),+ patch(f"{_GATE}.held.remember", AsyncMock(return_value=True)),+ patch(f"{_GATE}.chat_rules.ask_reason", AsyncMock(return_value=None)),+ patch(f"{_GATE}.chat_rules.set_ask", AsyncMock()),+ patch(f"{_GATE}.reads.release_held_read", AsyncMock(return_value=None)),+ patch(f"{_GATE}.reads.screen_read", AsyncMock(return_value=None)),+ ):+ yield store+++def ran():+ """What reached the block run, if anything did."""+ run = AsyncMock(+ return_value=BlockOutputResponse(+ message="ran",+ block_id="b",+ block_name="b",+ outputs={},+ success=True,+ session_id="session-1",+ )+ )+ with patch(f"{_CAP}._run_block", run):+ yield run+++async def _run_capability(+ session: ChatSession, block_id: str, payload: dict[str, Any], **extra: Any+):+ return await RunCapabilityTool().execute(+ "user-1", session, "call-1", id=block_id, input=payload, **extra+ )+++def _is_held(result) -> bool:+ return "approval_required" in str(result.output)+++# ---- blocks through run_capability -----------------------------------------++[email protected]("mode", ["ask_first", "auto"])+async def test_a_read_block_runs_without_a_card(gate, ran, mode):+ result = await _run_capability(+ _session(mode), GetWikipediaSummaryBlock().id, {"topic": "Otters"}+ )+ assert not _is_held(result)+ ran.assert_awaited_once()+ gate.open_review.assert_not_awaited()++[email protected]("mode", ["ask_first", "auto"])+async def test_a_workspace_block_runs_without_a_card(gate, ran, mode):+ result = await _run_capability(+ _session(mode), AIImageGeneratorBlock().id, {"prompt": "an otter"}+ )+ assert not _is_held(result)+ ran.assert_awaited_once()+++ "payload, extra",+ [+ ({}, {}),+ ({"channel_name": "general", "message_content": "hi"}, {"validate_only": True}),+ ],+ ids=["schema lookup", "validate_only"],+)+async def test_a_call_that_runs_nothing_never_asks(gate, ran, payload, extra):+ result = await _run_capability(+ _session("ask_first"), SendDiscordMessageBlock().id, payload, **extra+ )+ assert not _is_held(result)+ gate.open_review.assert_not_awaited()+++async def test_an_external_block_asks_and_the_card_names_it(gate, ran):+ result = await _run_capability(+ _session(),+ SendDiscordMessageBlock().id,+ {"channel_name": "general", "message_content": "hi"},+ )+ assert _is_held(result)+ ran.assert_not_awaited()+ args = gate.open_review.await_args.args+ reason, subject = args[5], args[6]+ assert subject.name == "Send Discord Message"+ assert subject.key == f"block:{SendDiscordMessageBlock().id}"+ assert reason == "Runs Send Discord Message, which reaches outside the platform."+ assert subject.irreversible+++async def test_the_chain_row_names_the_block_the_card_names(gate, ran):+ result = await _run_capability(+ _session(),+ SendDiscordMessageBlock().id,+ {"channel_name": "general", "message_content": "hi"},+ )+ output = json.loads(result.output)+ assert (output["ask"], output["object"]) == ("Run", "Send Discord Message")+++async def test_an_unclassified_block_asks(gate, ran):+ result = await _run_capability(+ _session(),+ GithubAddLabelBlock().id,+ {"issue_url": "https://github.com/o/r/issues/1", "label": "bug"},+ )+ assert _is_held(result)+ assert (+ gate.open_review.await_args.args[5]+ == "Otto does not know what Github Add Label does, so he asks."+ )+++async def test_an_approved_irreversible_block_asks_once(gate):+ """The card was the question; the irreversible-action pause must not be a second."""+ gate.find_review.return_value = SimpleNamespace(+ status=ReviewStatus.APPROVED, payload={}+ )+ prep = MagicMock(+ synthetic_node_id="node",+ input_data={"channel_name": "general", "message_content": "hi"},+ required_non_credential_keys=set(),+ provided_input_keys=set(),+ )+ hitl = AsyncMock(return_value=("exec-id", prep.input_data))+ execute = AsyncMock(return_value=MagicMock(type="block_output"))+ with (+ patch(+ "backend.copilot.tools.run_block.prepare_block_for_execution",+ AsyncMock(return_value=prep),+ ),+ patch(+ "backend.copilot.tools.run_block.get_current_permissions",+ return_value=None,+ ),+ patch(+ "backend.copilot.tools.run_block.check_spend_approval",+ AsyncMock(return_value=None),+ ),+ patch("backend.copilot.tools.run_block.check_hitl_review", hitl),+ patch("backend.copilot.tools.run_block.execute_block", execute),+ ):+ await _run_capability(_session(), SendDiscordMessageBlock().id, prep.input_data)+ hitl.assert_not_awaited()+ execute.assert_awaited_once()+ gate.open_review.assert_not_awaited()+++async def test_the_model_cannot_forge_an_approval(gate, ran):+ await _run_capability(+ _session("unsupervised"),+ SendDiscordMessageBlock().id,+ {"channel_name": "general", "message_content": "hi"},+ _gate_approved=True,+ )+ assert ran.await_args.args[5] is False+++async def test_a_rejection_asks_for_the_subject_not_the_tool(gate, ran):+ gate.find_review.return_value = SimpleNamespace(+ status=ReviewStatus.REJECTED, payload={}+ )+ call = SimpleNamespace(rule_key="block:abc")+ with (+ patch(f"{_GATE}.chat_rules.set_ask", AsyncMock()) as set_ask,+ patch(f"{_GATE}.held._held", AsyncMock(return_value={"x": call})),+ patch(f"{_GATE}.review_store.review_id_for", return_value="x"),+ ):+ await _run_capability(_session(), GetWikipediaSummaryBlock().id, {"topic": "x"})+ set_ask.assert_awaited_once_with("session-1", "block:abc")+++async def test_the_gate_off_resolves_no_subject():+ """Flag off: no subject lookup, so no extra graph or registry work."""+ subject = AsyncMock()+ with (+ patch(f"{_GATE}.is_feature_enabled", AsyncMock(return_value=False)),+ patch.object(RunAgentTool, "gate_subject", subject),+ patch.object(RunAgentTool, "_execute", AsyncMock(return_value=_answer())),+ patch(f"{_GATE}.reads.screen_read", AsyncMock(return_value=None)),+ patch(f"{_GATE}.reads.release_held_read", AsyncMock(return_value=None)),+ ):+ await RunAgentTool().execute(+ "user-1", _session(), "call-1", library_agent_id="lib-1"+ )+ subject.assert_not_awaited()+++# ---- workflows --------------------------------------------------------------+++def test_a_read_workflow_with_structure_and_a_nested_run_reads():+ graph = _graph(+ [+ _node("in", AgentInputBlock(), {"name": "topic"}),+ _node("nested", AgentExecutorBlock(), {"graph_id": "sub"}),+ _node("read", GetWikipediaSummaryBlock(), {}),+ _node("out", AgentOutputBlock(), {"name": "summary"}),+ ],+ sub_graphs=[_sub("sub", [_node("s1", StoreValueBlock(), {})])],+ )+ assert workflow_subject(graph).effect is Effect.READ+++def test_a_write_inside_a_sub_graph_names_it():+ graph = _graph(+ [+ _node("read", GetWikipediaSummaryBlock(), {}),+ _node("nested", AgentExecutorBlock(), {"graph_id": "sub"}),+ ],+ sub_graphs=[_sub("sub", [_node("send", GmailSendBlock(), {})])],+ )+ subject = workflow_subject(graph)+ assert subject.effect is Effect.EXTERNAL+ assert (+ subject.reason+ == "Runs Morning digest; its step Gmail Send reaches outside the platform."+ )+ assert subject.name == "Morning digest"+++def test_a_nested_run_whose_sub_graph_is_missing_is_unreadable():+ graph = _graph([_node("nested", AgentExecutorBlock(), {"graph_id": "gone"})])+ assert graph_effect(graph).effect is None+++ "linked, effect", [(False, Effect.READ), (True, Effect.EXTERNAL)]+)+def test_a_linked_method_makes_a_web_request_unreadable(linked, effect):+ links = [_link("in", "result", "req", "method")] if linked else []+ graph = _graph(+ [+ _node("in", AgentInputBlock(), {"name": "method"}),+ _node("req", SendWebRequestBlock(), {"url": "u", "method": "GET"}),+ ],+ links=links,+ )+ subject = workflow_subject(graph)+ assert subject.effect is effect+ assert subject.reason == (+ "Otto does not know what Send Web Request does, so he asks." if linked else ""+ )+++def test_a_schedule_of_a_read_workflow_is_a_platform_edit():+ graph = _graph([_node("read", GetWikipediaSummaryBlock(), {})])+ assert workflow_subject(graph, schedules=True).effect is Effect.PLATFORM+++async def test_a_trigger_workflow_shows_no_card(gate):+ graph = _graph(+ [+ _node("hook", GenericWebhookTriggerBlock(), {}),+ _node("send", GmailSendBlock(), {}),+ ]+ )+ details = _answer()+ with (+ patch(_AGENT_GRAPH, AsyncMock(return_value=(graph, None))),+ patch.object(RunAgentTool, "_execute", AsyncMock(return_value=details)),+ ):+ result = await RunAgentTool().execute(+ "user-1", _session(), "call-1", library_agent_id="lib-1"+ )+ assert not _is_held(result)+ gate.open_review.assert_not_awaited()+++async def test_an_external_workflow_asks_naming_it(gate):+ graph = _graph([_node("send", GmailSendBlock(), {})])+ run = AsyncMock(return_value=_answer())+ with (+ patch(_AGENT_GRAPH, AsyncMock(return_value=(graph, None))),+ patch.object(RunAgentTool, "_execute", run),+ ):+ result = await RunAgentTool().execute(+ "user-1", _session(), "call-1", library_agent_id="lib-1"+ )+ assert _is_held(result)+ run.assert_not_awaited()+ assert gate.open_review.await_args.args[6].name == "Morning digest"++[email protected]("approved", [True, False])+async def test_only_an_approved_run_skips_the_irreversible_pause(gate, approved):+ if approved:+ gate.find_review.return_value = SimpleNamespace(+ status=ReviewStatus.APPROVED, payload={}+ )+ graph = _graph([_node("send", GmailSendBlock(), {})])+ run = AsyncMock(return_value=_answer())+ with (+ patch(_AGENT_GRAPH, AsyncMock(return_value=(graph, MagicMock(id="lib-1")))),+ patch.object(RunAgentTool, "_run_agent", run),+ patch.object(+ RunAgentTool, "_check_prerequisites", AsyncMock(return_value=({}, None))+ ),+ patch(+ "backend.copilot.tools.run_agent.require_installed_workflow",+ AsyncMock(return_value=None),+ ),+ ):+ await RunAgentTool().execute(+ "user-1", _session("unsupervised"), "call-1", library_agent_id="lib-1"+ )+ assert run.await_args.kwargs["gate_approved"] is approved++[email protected]("gate_on", [True, False])+async def test_a_run_looks_its_graph_up_once(gate, gate_on):+ """Kills: ``_execute`` ignoring the graph the gate already resolved."""+ graph = _graph([_node("send", GmailSendBlock(), {})])+ lookup = AsyncMock(return_value=(graph, MagicMock(id="lib-1")))+ with (+ patch(f"{_GATE}.is_feature_enabled", AsyncMock(return_value=gate_on)),+ patch(_AGENT_GRAPH, lookup),+ patch.object(RunAgentTool, "_run_agent", AsyncMock(return_value=_answer())),+ patch.object(+ RunAgentTool, "_check_prerequisites", AsyncMock(return_value=({}, None))+ ),+ patch(+ "backend.copilot.tools.run_agent.require_installed_workflow",+ AsyncMock(return_value=None),+ ),+ ):+ await RunAgentTool().execute(+ "user-1", _session("unsupervised"), "call-1", library_agent_id="lib-1"+ )+ assert lookup.await_count == 1++[email protected]("unreadable_first", [True, False])[email protected]("kind", ["undeclared block", "linked web request"])+def test_an_unreadable_node_never_hides_an_irreversible_one(unreadable_first, kind):+ """Approving the card lifts the pause, so the card must show the send."""+ unreadable = (+ _node("label", GithubAddLabelBlock(), {})+ if kind == "undeclared block"+ else _node("req", SendWebRequestBlock(), {"url": "u", "method": "GET"})+ )+ send = _node("send", GmailSendBlock(), {})+ nodes = [unreadable, send] if unreadable_first else [send, unreadable]+ links = [_link("in", "result", "req", "method")]+ subject = workflow_subject(+ _graph([_node("in", AgentInputBlock(), {"name": "m"}), *nodes], links=links)+ )+ assert subject.effect is Effect.EXTERNAL+ assert subject.irreversible+ step = "Github Add Label" if kind == "undeclared block" else "Send Web Request"+ assert subject.reason == (+ f"Otto does not know what {step} does, so he asks; it also has 1 step "+ "that can't be undone: Gmail Send."+ )+++def test_an_unknown_step_leads_a_workflow_with_irreversible_steps():+ """Kills: the steps list replacing the only warning about the unknown block."""+ subject = workflow_subject(+ _graph(+ [+ _node("send", GmailSendBlock(), {}),+ _node("label", GithubAddLabelBlock(), {}),+ _node("post", SendDiscordMessageBlock(), {}),+ ]+ )+ )+ assert subject.reason == (+ "Otto does not know what Github Add Label does, so he asks; it also has "+ "2 steps that can't be undone: Gmail Send and Send Discord Message."+ )++[email protected]("send_first", [True, False])+def test_an_irreversible_node_names_an_external_workflow(send_first):+ nodes = [+ _node("send", GmailSendBlock(), {}),+ _node("file", GithubCreateFileBlock(), {}),+ ]+ subject = workflow_subject(_graph(nodes if send_first else nodes[::-1]))+ assert (+ subject.reason+ == "Runs Morning digest; its step Gmail Send reaches outside the platform."+ )+++ "block, inputs, linked, effect",+ [+ (SendWebRequestBlock(), {}, (), BlockEffect.EXTERNAL),+ (SendWebRequestBlock(), {"method": "POST"}, (), BlockEffect.EXTERNAL),+ (SendWebRequestBlock(), {"method": "HEAD"}, (), BlockEffect.READ),+ (SQLQueryBlock(), {}, (), BlockEffect.READ),+ (SQLQueryBlock(), {"read_only": False}, (), BlockEffect.EXTERNAL),+ (SQLQueryBlock(), {"read_only": True}, ("read_only",), None),+ ],+ ids=["no method", "POST", "HEAD", "SQL default", "SQL write", "SQL linked"],+)+def test_input_decided_blocks_follow_their_input(block, inputs, linked, effect):+ assert block_effect(block, inputs, linked) is effect+++async def test_a_workflow_the_lookup_misses_asks(gate):+ """The tool's own effect is external, so a miss asks rather than runs."""+ run = AsyncMock(return_value=_answer())+ with (+ patch(_AGENT_GRAPH, AsyncMock(return_value=(None, None))),+ patch.object(RunAgentTool, "_execute", run),+ ):+ result = await RunAgentTool().execute(+ "user-1", _session(), "call-1", library_agent_id="lib-1"+ )+ assert _is_held(result)+ run.assert_not_awaited()+++async def test_saving_a_preset_of_a_read_workflow_is_a_platform_edit(gate):+ graph = _graph([_node("read", GetWikipediaSummaryBlock(), {})])+ with (+ patch(_AGENT_GRAPH, AsyncMock(return_value=(graph, None))),+ patch.object(RunAgentTool, "_execute", AsyncMock(return_value=_answer())),+ ):+ result = await RunAgentTool().execute(+ "user-1",+ _session("ask_first"),+ "call-1",+ library_agent_id="lib-1",+ save_as_preset=True,+ preset_name="otters",+ )+ assert _is_held(result)+ assert (+ gate.open_review.await_args.args[5] == "Runs Morning digest and saves a preset."+ )+++async def test_a_graph_only_block_is_never_carded(gate, ran):+ """``run_block`` refuses it and the registry does not list it, so nothing runs."""+ result = await _run_capability(+ _session(), AgentExecutorBlock().id, {"graph_id": "x"}+ )+ assert not _is_held(result)+ gate.open_review.assert_not_awaited()+++def _answer() -> ErrorResponse:+ return ErrorResponse(message="answered", session_id="session-1")+++def _graph(+ nodes: list[NodeModel],+ links: list[Link] | None = None,+ sub_graphs: list[BaseGraph] | None = None,+) -> GraphModel:+ return GraphModel(+ id="main",+ version=1,+ name="Morning digest",+ description="",+ user_id="user-1",+ created_at=datetime.now(UTC),+ nodes=nodes,+ links=links or [],+ sub_graphs=sub_graphs or [],+ )+++def _sub(graph_id: str, nodes: list[NodeModel]) -> BaseGraph:+ return BaseGraph(+ id=graph_id,+ version=1,+ name=graph_id,+ description="",+ nodes=[+ Node(**node.model_dump(include={"id", "block_id", "input_default"}))+ for node in nodes+ ],+ )+++def _node(node_id: str, block, input_default: dict[str, Any]) -> NodeModel:+ return NodeModel(+ id=node_id,+ block_id=block.id,+ input_default=input_default,+ graph_id="main",+ graph_version=1,+ )+++def _link(source: str, source_name: str, sink: str, sink_name: str) -> Link:+ return Link(+ source_id=source, source_name=source_name, sink_id=sink, sink_name=sink_name+ )+++async def test_a_preset_this_chat_cannot_use_raises_no_card(gate):+ """Another expert's preset, or a missing one: the run refuses, so asking is noise."""+ run = AsyncMock(return_value=_answer())+ with (+ patch(+ "backend.copilot.tools.run_agent._preset_graph",+ AsyncMock(return_value=(None, None)),+ ),+ patch.object(RunAgentTool, "_execute", run),+ ):+ await RunAgentTool().execute(+ "user-1", _session("ask_first"), "call-1", preset_id="p-1"+ )+ gate.open_review.assert_not_awaited()+ run.assert_awaited_once()+++# Execute Code itself resolves to bash_exec; this one is reached as a block.+_CODE = {+ "sandbox_id": "sbx-1",+ "language": "python",+ "step_code": "print(open('invoices.csv').read())",+}+++async def test_a_code_block_in_auto_goes_to_the_supervisor_and_runs_on_a_vouch(+ gate, ran+):+ """Its effect is the code the call carries, so the check reads that code."""+ classify = AsyncMock(return_value=(True, ""))+ with patch(f"{_GATE}.classify", classify):+ result = await _run_capability(+ _session("auto"), ExecuteCodeStepBlock().id, dict(_CODE)+ )+ assert not _is_held(result)+ ran.assert_awaited_once()+ assert (+ classify.await_args.kwargs["args"]["input"]["step_code"] == _CODE["step_code"]+ )+++async def test_a_code_block_the_supervisor_cannot_vouch_for_asks_with_its_reason(+ gate, ran+):+ classify = AsyncMock(return_value=(False, "it reads a local file of invoices"))+ with patch(f"{_GATE}.classify", classify):+ result = await _run_capability(+ _session("auto"), ExecuteCodeStepBlock().id, dict(_CODE)+ )+ assert _is_held(result)+ ran.assert_not_awaited()+ args, kwargs = gate.open_review.await_args+ assert args[5] == "it reads a local file of invoices"+ assert kwargs["reason_kind"] == "supervisor"+++async def test_a_code_block_in_ask_first_asks_without_the_supervisor(gate, ran):+ classify = AsyncMock(return_value=(True, ""))+ with patch(f"{_GATE}.classify", classify):+ result = await _run_capability(+ _session("ask_first"), ExecuteCodeStepBlock().id, dict(_CODE)+ )+ assert _is_held(result)+ classify.assert_not_awaited()+++async def test_the_reason_names_otto_as_he_even_in_an_experts_chat(gate, ran):+ """Otto is the supervisor in every chat, an expert's included."""+ session = _session().model_copy(update={"expert_id": "maria"})+ await _run_capability(+ session,+ GithubAddLabelBlock().id,+ {"issue_url": "https://github.com/o/r/issues/1", "label": "bug"},+ )+ reason = gate.open_review.await_args.args[5]+ assert reason == "Otto does not know what Github Add Label does, so he asks."+++def test_a_workflow_with_two_irreversible_steps_names_both():+ """Approving the run covers every step, so the card names every one it covers."""+ subject = workflow_subject(+ _graph(+ [+ _node("send", GmailSendBlock(), {}),+ _node("post", SendDiscordMessageBlock(), {}),+ ]+ )+ )+ assert subject.irreversible+ assert subject.reason == (+ "Runs Morning digest; its steps Gmail Send and Send Discord Message "+ "reach outside the platform."+ )+++async def test_a_workflow_called_without_its_inputs_asks_nothing(gate):+ """The run answers with the inputs it needs, so a card first is noise."""+ graph = _graph(+ [+ _node("in", AgentInputBlock(), {"name": "topic"}),+ _node("send", GmailSendBlock(), {}),+ ]+ )+ run = AsyncMock(return_value=_answer())+ with (+ patch(_AGENT_GRAPH, AsyncMock(return_value=(graph, None))),+ patch.object(RunAgentTool, "_execute", run),+ ):+ await RunAgentTool().execute(+ "user-1", _session("ask_first"), "call-1", library_agent_id="lib-1"+ )+ gate.open_review.assert_not_awaited()+ run.assert_awaited_once()diff --git a/autogpt_platform/backend/backend/copilot/tools/helpers.py b/autogpt_platform/backend/backend/copilot/tools/helpers.pyindex 3ce46a99c8..59a065868c 100644--- a/autogpt_platform/backend/backend/copilot/tools/helpers.py+++ b/autogpt_platform/backend/backend/copilot/tools/helpers.py@@ -885,8 +885,7 @@ async def prepare_block_for_execution()credentials_fields = set(block.input_schema.get_credentials_fields().keys())- required_keys = set(input_schema.get("required", []))- required_non_credential_keys = required_keys - credentials_fields+ required_non_credential_keys = required_input_keys(block)provided_input_keys = set(input_data.keys()) - credentials_fields# Picker-backed required fields that the caller hasn't filled surface the@@ -987,6 +986,13 @@ async def prepare_block_for_execution()+def required_input_keys(block: AnyBlockSchema) -> set[str]:+ """Inputs a block needs from its caller; without them ``run_block`` answers+ with the schema and runs nothing. Credentials resolve on their own."""+ credentials = set(block.input_schema.get_credentials_fields())+ return set(block.input_schema.jsonschema().get("required", [])) - credentials++async def check_hitl_review(prep: BlockPreparation,user_id: str,diff --git a/autogpt_platform/backend/backend/copilot/tools/run_agent.py b/autogpt_platform/backend/backend/copilot/tools/run_agent.pyindex 3ca37b7407..94e058e330 100644--- a/autogpt_platform/backend/backend/copilot/tools/run_agent.py+++ b/autogpt_platform/backend/backend/copilot/tools/run_agent.py@@ -1,13 +1,19 @@"""Unified tool for agent operations with automatic state detection."""import logging+from contextvars import ContextVarfrom typing import Any-from pydantic import BaseModel, Field, field_validator+from pydantic import BaseModel, Field, ValidationError, field_validator-from backend.api.features.library.model import LibraryAgentPresetCreatable+from backend.api.features.library.model import (+ LibraryAgent,+ LibraryAgentPreset,+ LibraryAgentPresetCreatable,+)from backend.copilot.config import ChatConfigfrom backend.copilot.constants import MAX_TOOL_WAIT_SECONDS+from backend.copilot.gate.subject import NO_OP, Subject, workflow_subjectfrom backend.copilot.model import ChatSessionfrom backend.copilot.tool_display import emit_tool_display_namefrom backend.copilot.tracking import track_agent_run_success, track_agent_scheduled@@ -35,7 +41,7 @@ from backend.util.timezone_utils import (validate_timezone,)-from .base import BaseTool+from .base import GATE_APPROVED, BaseToolfrom .execution_utils import (NodeFailureSummary,build_run_health_warning,@@ -75,6 +81,11 @@ from .utils import (logger = logging.getLogger(__name__)config = ChatConfig()+# The graph the gate resolved for this call, so ``_execute`` fetches it only once.+_GATE_RESOLVED: ContextVar[+ tuple[tuple[str, str, str], str, GraphModel | None, LibraryAgent | None] | None+] = ContextVar("run_agent_gate_resolved", default=None)+async def _safe_link_to_chat_share(session_id: str, execution_id: str) -> None:"""Best-effort client-side wrapper around the chat-share auto-link hook.@@ -163,10 +174,49 @@ class RunAgentTool(BaseTool):The response tells the caller what's missing or confirms execution."""+ has_gate_subject = True+@propertydef name(self) -> str:return "run_agent"+ async def gate_subject(+ self, user_id: str, session: ChatSession, args: dict[str, Any]+ ) -> Subject | None:+ """The workflow this call runs, with its sub-graphs; NO_OP where nothing+ runs: a dry run, a trigger workflow (which only returns its trigger+ details), or a call ``_execute`` refuses before looking anything up."""+ try:+ params = RunAgentInput(**args)+ except ValidationError:+ return NO_OP+ if params.dry_run or session.dry_run:+ return NO_OP+ if params.preset_id:+ preset, graph = await _preset_graph(user_id, session, params.preset_id)+ # No such preset for this chat: the run refuses, so nothing asks.+ if preset is None:+ return NO_OP+ else:+ key = _call_key(user_id, params)+ await _bind_builder_graph(user_id, session, params)+ if not _names_an_agent(params):+ return NO_OP+ graph, library_agent = await _agent_graph(user_id, params)+ _GATE_RESOLVED.set((key, params.library_agent_id, graph, library_agent))+ if graph is None:+ # A miss must not run ungated; the tool's own effect asks.+ return None+ if graph.has_external_trigger:+ return NO_OP+ if not params.preset_id and _asks_for_inputs(graph, params):+ return NO_OP # the run answers with the inputs it needs+ return workflow_subject(+ graph,+ schedules=bool(params.schedule_name or params.cron),+ saves_preset=params.save_as_preset,+ )+@propertydef description(self) -> str:return (@@ -258,6 +308,7 @@ class RunAgentTool(BaseTool):validation because the parameter set is complex with cross-fieldvalidators defined in the Pydantic model."""+ approved = bool(kwargs.pop(GATE_APPROVED, False))params = RunAgentInput(**kwargs)# Session-level dry_run forces all runs to be dry. In normal sessions# the LLM may still request dry_run=True on individual calls.@@ -269,24 +320,20 @@ class RunAgentTool(BaseTool):# graph + inputs + credentials). Handle it before agent-identifier# resolution below.if params.preset_id:- return await self._handle_preset_run(user_id, session, params)-- # Validate at least one identifier is provided- has_slug = params.username_agent_slug and "/" in params.username_agent_slug- has_library_id = bool(params.library_agent_id)-- # Builder-bound sessions can omit the identifier — default to the- # bound graph so the LLM doesn't have to pass IDs the user never sees.+ return await self._handle_preset_run(user_id, session, params, approved)++ resolved = _GATE_RESOLVED.get()+ _GATE_RESOLVED.set(None)+ if resolved is None or resolved[0] != _call_key(user_id or "", params):+ resolved = None+ if user_id:+ await _bind_builder_graph(user_id, session, params)+ elif resolved[1]:+ params.library_agent_id = resolved[1]builder_graph_id = session.metadata.builder_graph_id- if builder_graph_id and user_id and not has_slug and not has_library_id:- library_agent = await library_db().get_library_agent_by_graph_id(- user_id, builder_graph_id- )- if library_agent:- params.library_agent_id = library_agent.id- has_library_id = True+ has_library_id = bool(params.library_agent_id)- if not has_slug and not has_library_id:+ if not _names_an_agent(params):return ErrorResponse(message=("Please provide either a username_agent_slug "@@ -319,41 +366,14 @@ class RunAgentTool(BaseTool):try:# Step 1: Fetch agent details- graph: GraphModel | None = None- library_agent = None-- # Priority: library_agent_id if provided- if has_library_id:- try:- library_agent = await library_db().get_library_agent(- params.library_agent_id, user_id- )- except NotFoundError:- # get_library_agent raises rather than returning None, so- # the graph-id fallback this tool documents is only- # reachable from here.- library_agent = None- if not library_agent:- library_agent = await library_db().get_library_agent_by_graph_id(- user_id, params.library_agent_id- )- if not library_agent:- return ErrorResponse(- message=f"Library agent '{params.library_agent_id}' not found",- session_id=session_id,- )- # Sub-graphs are needed to aggregate the full set of required credentials.- graph = await graph_db().get_graph(- library_agent.graph_id,- library_agent.graph_version,- user_id=user_id,- include_subgraphs=True,+ graph, library_agent = (+ resolved[2:] if resolved else await _agent_graph(user_id, params)+ )+ if has_library_id and library_agent is None:+ return ErrorResponse(+ message=f"Library agent '{params.library_agent_id}' not found",+ session_id=session_id,)- else:- # Fetch from marketplace slug- username, agent_name = params.username_agent_slug.split("/", 1)- graph, _ = await fetch_graph_from_store_slug(username, agent_name)-if not graph:identifier = (params.library_agent_id@@ -444,6 +464,7 @@ class RunAgentTool(BaseTool):inputs=params.inputs,wait_for_result=params.wait_for_result,dry_run=params.dry_run,+ gate_approved=approved,)# Step 4: persist the validated config as a reusable preset — only@@ -778,6 +799,7 @@ class RunAgentTool(BaseTool):user_id: str | None,session: ChatSession,params: RunAgentInput,+ approved: bool = False,) -> ToolResponseBase:"""Run a saved preset by id (mirrors POST /presets/{id}/execute)."""session_id = session.session_id@@ -810,27 +832,13 @@ class RunAgentTool(BaseTool):session_id=session_id,)- preset = await library_db().get_preset(- user_id=user_id, preset_id=params.preset_id- )+ preset, graph = await _preset_graph(user_id, session, params.preset_id)if not preset:return ErrorResponse(message=f"Preset '{params.preset_id}' not found.",error="preset_not_found",session_id=session_id,)- if preset.expert_id != session.expert_id:- return ErrorResponse(- message=f"Preset '{params.preset_id}' not found.",- error="preset_not_found",- session_id=session_id,- )- graph = await graph_db().get_graph(- preset.graph_id,- preset.graph_version,- user_id=user_id,- include_subgraphs=True, # needed for full credentials aggregation- )if not graph:return ErrorResponse(message=(@@ -884,6 +892,7 @@ class RunAgentTool(BaseTool):wait_for_result=params.wait_for_result,dry_run=params.dry_run,preset_id=preset.id,+ gate_approved=approved,)async def _maybe_save_preset(@@ -926,8 +935,13 @@ class RunAgentTool(BaseTool):dry_run: bool,wait_for_result: int = 0,preset_id: str | None = None,+ gate_approved: bool = False,) -> ToolResponseBase:- """Execute an agent immediately, optionally waiting for completion."""+ """Execute an agent immediately, optionally waiting for completion.++ ``gate_approved``: the user approved this run on a card, so it runs+ under the graph's own safe-mode setting rather than pausing again.+ """session_id = session.session_id# Check rate limits (dry runs don't count against the session limit)@@ -975,7 +989,9 @@ class RunAgentTool(BaseTool):trigger=ExecutionTrigger.COPILOT,trigger_ref=session_id,pause_irreversible_actions=(- not dry_run and session.metadata.pauses_irreversible_actions+ not dry_run+ and not gate_approved+ and session.metadata.pauses_irreversible_actions),)except GraphValidationError as e:@@ -1353,3 +1369,87 @@ class RunAgentTool(BaseTool):library_agent_link=library_agent_link,status=SCHEDULED_STATUS,)+++# One lookup for the run and for the gate: were they two, a drift between+# them would gate one graph and run another.+async def _agent_graph(+ user_id: str, params: RunAgentInput+) -> tuple[GraphModel | None, LibraryAgent | None]:+ if params.library_agent_id:+ try:+ library_agent = await library_db().get_library_agent(+ params.library_agent_id, user_id+ )+ except NotFoundError:+ # get_library_agent raises rather than returning None, so the+ # graph-id fallback this tool documents is only reachable here.+ library_agent = None+ library_agent = library_agent or (+ await library_db().get_library_agent_by_graph_id(+ user_id, params.library_agent_id+ )+ )+ if library_agent is None:+ return None, None+ # Sub-graphs are needed to aggregate the full set of required credentials.+ graph = await graph_db().get_graph(+ library_agent.graph_id,+ library_agent.graph_version,+ user_id=user_id,+ include_subgraphs=True,+ )+ return graph, library_agent+ username, agent_name = params.username_agent_slug.split("/", 1)+ graph, _ = await fetch_graph_from_store_slug(username, agent_name)+ return graph, None+++async def _preset_graph(+ user_id: str, session: ChatSession, preset_id: str+) -> tuple[LibraryAgentPreset | None, GraphModel | None]:+ preset = await library_db().get_preset(user_id=user_id, preset_id=preset_id)+ if preset is None or preset.expert_id != session.expert_id:+ return None, None+ graph = await graph_db().get_graph(+ preset.graph_id,+ preset.graph_version,+ user_id=user_id,+ include_subgraphs=True, # needed for full credentials aggregation+ )+ return preset, graph+++async def _bind_builder_graph(+ user_id: str, session: ChatSession, params: RunAgentInput+) -> None:+ """Builder-bound sessions can omit the identifier: default to the bound+ graph so the LLM doesn't have to pass ids the user never sees."""+ builder_graph_id = session.metadata.builder_graph_id+ if not builder_graph_id or _names_an_agent(params):+ return+ library_agent = await library_db().get_library_agent_by_graph_id(+ user_id, builder_graph_id+ )+ if library_agent:+ params.library_agent_id = library_agent.id+++def _call_key(user_id: str, params: RunAgentInput) -> tuple[str, str, str]:+ return (user_id, params.library_agent_id or "", params.username_agent_slug)+++def _names_an_agent(params: RunAgentInput) -> bool:+ return bool(params.library_agent_id) or "/" in params.username_agent_slug+++def _asks_for_inputs(graph: GraphModel, params: RunAgentInput) -> bool:+ """The input gates of ``_check_prerequisites``: the call runs nothing."""+ properties = graph.input_schema.get("properties", {})+ provided = set(params.inputs)+ if provided - set(properties):+ return True+ if params.use_defaults:+ return False+ required = set(graph.input_schema.get("required", []))+ return bool(properties and not provided) or bool(required - provided)diff --git a/autogpt_platform/backend/backend/copilot/tools/run_agent_test.py b/autogpt_platform/backend/backend/copilot/tools/run_agent_test.pyindex 80a1af095d..b468303ba8 100644--- a/autogpt_platform/backend/backend/copilot/tools/run_agent_test.py+++ b/autogpt_platform/backend/backend/copilot/tools/run_agent_test.py@@ -1237,16 +1237,18 @@ async def test_run_agent_attributes_execution_to_session_org(mocker, expert_id):@pytest.mark.asyncio(loop_scope="session")@pytest.mark.parametrize(- "origin, dry_run, expected",+ "origin, dry_run, gate_approved, expected",[- ("interactive", False, True),- (None, False, True),- ("automation", False, False),- ("interactive", True, False),+ ("interactive", False, False, True),+ (None, False, False, True),+ ("automation", False, False, False),+ ("interactive", True, False, False),+ # The card was the question; the run keeps the graph's own setting.+ ("interactive", False, True, False),],)async def test_run_agent_pauses_irreversible_actions_for_attended_chats(- mocker, origin, dry_run, expected+ mocker, origin, dry_run, gate_approved, expected):from backend.copilot.model import ChatSessionMetadata@@ -1279,6 +1281,7 @@ async def test_run_agent_pauses_irreversible_actions_for_attended_chats(graph_credentials={},inputs={},dry_run=dry_run,+ gate_approved=gate_approved,)assert add.await_args.kwargs["pause_irreversible_actions"] is expecteddiff --git a/autogpt_platform/backend/backend/copilot/tools/run_block.py b/autogpt_platform/backend/backend/copilot/tools/run_block.pyindex 8bf3fed157..6fcab54bac 100644--- a/autogpt_platform/backend/backend/copilot/tools/run_block.py+++ b/autogpt_platform/backend/backend/copilot/tools/run_block.py@@ -114,6 +114,7 @@ class RunBlockTool(BaseTool):block_id: str = "",input_data: dict | None = None,validate_only: bool = False,+ gate_approved: bool = False,**kwargs, # dry_run is intentionally not accepted; read from session.dry_run) -> ToolResponseBase:"""Execute a block with the given input data.@@ -123,6 +124,8 @@ class RunBlockTool(BaseTool):session: Chat sessionblock_id: Block UUID to executeinput_data: Input values for the block+ gate_approved: The user approved this exact call on a card, so the+ irreversible-action pause would ask the same question twice.Returns:BlockOutputResponse: Block execution outputs@@ -283,16 +286,24 @@ class RunBlockTool(BaseTool):if spend_gate is not None:return spend_gate- hitl_or_err = await check_hitl_review(- prep,- user_id,- session_id,- organization_id=session.organization_id,- team_id=session.team_id,- )- if isinstance(hitl_or_err, ToolResponseBase):- return hitl_or_err- synthetic_node_exec_id, input_data = hitl_or_err+ if gate_approved:+ synthetic_node_exec_id = (+ f"{prep.synthetic_node_id}"+ f"{COPILOT_NODE_EXEC_ID_SEPARATOR}"+ f"{uuid.uuid4().hex[:8]}"+ )+ input_data = prep.input_data+ else:+ hitl_or_err = await check_hitl_review(+ prep,+ user_id,+ session_id,+ organization_id=session.organization_id,+ team_id=session.team_id,+ )+ if isinstance(hitl_or_err, ToolResponseBase):+ return hitl_or_err+ synthetic_node_exec_id, input_data = hitl_or_errreturn await execute_block(block=prep.block,diff --git a/autogpt_platform/backend/backend/copilot/tools/run_capability.py b/autogpt_platform/backend/backend/copilot/tools/run_capability.pyindex b3dc3039c1..b17d4d1890 100644--- a/autogpt_platform/backend/backend/copilot/tools/run_capability.py+++ b/autogpt_platform/backend/backend/copilot/tools/run_capability.py@@ -12,6 +12,7 @@ import loggingfrom typing import Anyfrom urllib.parse import urlsplit+from backend.blocks import get_blockfrom backend.copilot.capabilities.mcp_review import (MCPReviewPayload,needs_review,@@ -20,15 +21,18 @@ from backend.copilot.capabilities.mcp_review import (from backend.copilot.capabilities.models import SKILL_TOOL, CapabilityEntryfrom backend.copilot.capabilities.registry import configured_tool, get_registryfrom backend.copilot.capabilities.resolve import resolve_entry+from backend.copilot.capabilities.sources import skill_namefrom backend.copilot.capabilities.sources.mcp_catalog import setup_hint+from backend.copilot.gate.subject import NO_OP, OWN_REVIEW, Subject, block_subjectfrom backend.copilot.model import ChatSessionfrom backend.copilot.permissions import BLOCK_GATE, MCP_GATEfrom backend.copilot.tool_display import emit_tool_display_namefrom backend.data.activity_event import ActivityEventDraft-from .base import BaseTool+from .base import GATE_APPROVED, BaseToolfrom .capability_gates import gate_denied, gate_denied_errorfrom .describe_capability import MCP_RUN_PARAMETERS, UNKNOWN_ID_HINT, describe_skill+from .helpers import required_input_keysfrom .models import (CapabilityDetailsResponse,ErrorResponse,@@ -45,6 +49,7 @@ logger = logging.getLogger(__name__)class RunCapabilityTool(BaseTool):digest_large_output = True+ has_gate_subject = True@propertydef name(self) -> str:@@ -88,6 +93,35 @@ class RunCapabilityTool(BaseTool):def requires_auth(self) -> bool:return True+ async def gate_subject(+ self, user_id: str, session: ChatSession, args: dict[str, Any]+ ) -> Subject | None:+ """The block this call runs, or NO_OP where nothing would run."""+ capability_id = str(args.get("id") or "")+ payload = args.get("input")+ if args.get("validate_only") or session.dry_run:+ return NO_OP+ if skill_name(capability_id) is not None or not isinstance(payload or {}, dict):+ return NO_OP+ entry = await resolve_session_entry(user_id, session, capability_id)+ if entry is None and capability_id.strip().lower().startswith("https://"):+ return OWN_REVIEW+ if entry is None:+ return NO_OP+ if entry.kind == "mcp_server":+ return OWN_REVIEW+ if entry.kind != "block":+ return NO_OP+ block_id = next(+ (impl.ref for impl in entry.implementations if impl.kind == "block"), ""+ )+ block = get_block(block_id)+ if block is None:+ return NO_OP+ if not required_input_keys(block) <= set(payload or {}):+ return NO_OP # a schema lookup: run_block answers with the schema+ return block_subject(block, payload or {})+def activity_event(self, session: ChatSession, result: ToolResponseBase, **kwargs) -> ActivityEventDraft | None:@@ -111,6 +145,7 @@ class RunCapabilityTool(BaseTool):validate_only: bool = False,**kwargs,) -> ToolResponseBase:+ approved = bool(kwargs.pop(GATE_APPROVED, False))session_id = session.session_idif not user_id:return ErrorResponse(@@ -142,7 +177,9 @@ class RunCapabilityTool(BaseTool):if entry is None:return ErrorResponse(message=UNKNOWN_ID_HINT, session_id=session_id)if entry.kind == "block":- return await _run_block(entry, user_id, session, payload, validate_only)+ return await _run_block(+ entry, user_id, session, payload, validate_only, approved+ )if entry.kind == "tool":return await _describe_tool(entry, session)if entry.kind == "skill":@@ -169,6 +206,7 @@ async def _run_block(session: ChatSession,payload: dict[str, Any],validate_only: bool,+ approved: bool,) -> ToolResponseBase:if gate_denied(BLOCK_GATE):return gate_denied_error("blocks", session.session_id)@@ -181,6 +219,7 @@ async def _run_block(block_id=block_id,input_data=payload,validate_only=validate_only,+ gate_approved=approved,)diff --git a/autogpt_platform/backend/backend/sdk/__init__.py b/autogpt_platform/backend/backend/sdk/__init__.pyindex 5aab1bd22b..86a5b55bc8 100644--- a/autogpt_platform/backend/backend/sdk/__init__.py+++ b/autogpt_platform/backend/backend/sdk/__init__.py@@ -20,6 +20,7 @@ from pydantic import BaseModel, Field, SecretStrfrom backend.blocks._base import (Block,BlockCategory,+ BlockEffect,BlockManualWebhookConfig,BlockOutput,BlockSchema,@@ -123,6 +124,7 @@ __all__ = [# Core Block System"Block","BlockCategory",+ "BlockEffect","BlockOutput","BlockSchema","BlockSchemaInput",diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ApprovalQueue/ApprovalQueue.stories.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ApprovalQueue/ApprovalQueue.stories.tsxindex cc2d5b72c6..3939314187 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ApprovalQueue/ApprovalQueue.stories.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ApprovalQueue/ApprovalQueue.stories.tsx@@ -16,7 +16,10 @@ import {heldRead,heldReview,mail,+ realCardSchemaHandler,+ realCards,shell,+ workflow,} from "./__tests__/fixtures";function answerAfter(ms: number, status = 200) {@@ -60,7 +63,56 @@ export const TwoOnTheSameSubject: Story = {args: queueOf([folder("a", "Q3 reports", 6), folder("b", "Invoices", 5)]),};-export const IrreversibleWithInputs: Story = { args: queueOf([mail()]) };+const GMAIL_SCHEMA = http.get("*/api/builder/blocks/batch", () =>+ HttpResponse.json([+ {+ id: "b-gmail",+ name: "GmailSendBlock",+ inputSchema: {+ type: "object",+ required: ["to", "subject"],+ properties: {+ to: { type: "array", title: "To" },+ subject: { type: "string", title: "Subject" },+ body: { type: "string", title: "Body" },+ },+ },+ },+ ]),+);++export const IrreversibleWithInputs: Story = {+ args: queueOf([mail()]),+ parameters: { msw: { handlers: [GMAIL_SCHEMA, answerAfter(600_000)] } },+};++// As the server sends it: no chat rule is offered for a block yet.+export const BlockCard: Story = {+ args: queueOf([mail("mail", [])]),+ parameters: { msw: { handlers: [GMAIL_SCHEMA, answerAfter(600_000)] } },+};++export const WorkflowRun: Story = { args: queueOf([workflow()]) };++export const BlockChainRow: StoryObj = {+ render: () => {+ const part = {+ type: "tool-run_capability",+ state: "output-available",+ toolCallId: "call-gmail",+ input: { id: "b-gmail", input: { to: ["[email protected]"] } },+ output: {+ type: "approval_required",+ tool_name: "run_capability",+ review_id: "copilot-node-gate-run_capability:gmail",+ ask: "Run",+ object: "Gmail Send",+ },+ } as MessagePart;+ const row = applyHeldOutcome(toChainRow(part, 0)!, new Map());+ return <ChainRowView row={row} isLast />;+ },+};export const SupervisorCouldNotVouch: Story = { args: queueOf([shell()]) };@@ -278,3 +330,23 @@ export const HomeRowAfter: StoryObj = {{ ask: "Create folder", object: "Q3 reports" },),};++// Real registry blocks, their payloads built by the server's own builder and+// their real input schemas served as the API serves them.+function realStory(name: string): Story {+ const cards = realCards();+ const card = cards.find((c) => c.story === name)!;+ return {+ args: queueOf([card.review]),+ parameters: {+ msw: { handlers: [realCardSchemaHandler(cards), answerAfter(600_000)] },+ },+ };+}++export const RealGmailSend = realStory("Gmail Send");+export const RealGoogleSheetsUpdateRow = realStory("Google Sheets Update Row");+export const RealExecuteCodeStep = realStory("Execute Code Step");+export const RealSendWebRequest = realStory("Send Web Request");+export const RealPostToX = realStory("Post To X");+export const RealWorkflow = realStory("Workflow");diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ApprovalQueue/__tests__/blockCard.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ApprovalQueue/__tests__/blockCard.test.tsxnew file mode 100644index 0000000000..7ed1dfcd49--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ApprovalQueue/__tests__/blockCard.test.tsx@@ -0,0 +1,54 @@+import { http, HttpResponse } from "msw";+import { expect, test, vi } from "vitest";+import { server } from "@/mocks/mock-server";+import { render, screen } from "@/tests/integrations/test-utils";+import { CopilotChatActionsProvider } from "../../CopilotChatActionsProvider/CopilotChatActionsProvider";+import { CopilotPendingReviews } from "../../CopilotPendingReviews/CopilotPendingReviews";+import { mail, CHAT_SESSION } from "./fixtures";++function serve(schemaCalls: string[]) {+ server.use(+ http.get(`*/api/review/session/${CHAT_SESSION}`, () =>+ HttpResponse.json([mail()]),+ ),+ http.get("*/api/builder/blocks/batch", ({ request }) => {+ schemaCalls.push(new URL(request.url).search);+ return HttpResponse.json([+ {+ id: "b-gmail",+ name: "GmailSendBlock",+ inputSchema: {+ type: "object",+ required: ["subject", "to"],+ properties: {+ to: { type: "array", title: "Recipients" },+ subject: { type: "string", title: "Subject line" },+ body: { type: "string", title: "Message" },+ },+ },+ },+ ]);+ }),+ );+}++test("a block's card names the block and labels its inputs from the block's schema", async () => {+ const schemaCalls: string[] = [];+ serve(schemaCalls);+ render(+ <CopilotChatActionsProvider onSend={vi.fn()} onBackendTurn={vi.fn()}>+ <CopilotPendingReviews chatSessionId={CHAT_SESSION} />+ </CopilotChatActionsProvider>,+ );++ expect(+ await screen.findByRole("heading", { name: /Run Gmail Send/ }),+ ).toBeDefined();+ expect(await screen.findByText("Recipients")).toBeDefined();+ expect(screen.getByText("Subject line")).toBeDefined();+ expect(screen.getByText("Message")).toBeDefined();+ expect(screen.getByText("Can't be undone")).toBeDefined();+ expect(schemaCalls.join()).toContain("b-gmail");+ // A key the schema does not list still shows, under the server's label.+ expect(screen.getByText("Account")).toBeDefined();+});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ApprovalQueue/__tests__/fixtures.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ApprovalQueue/__tests__/fixtures.tsindex 635cba1439..2884808517 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ApprovalQueue/__tests__/fixtures.ts+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ApprovalQueue/__tests__/fixtures.ts@@ -1,4 +1,6 @@+import { http, HttpResponse } from "msw";import type { PendingHumanReviewModel } from "@/app/api/__generated__/models/pendingHumanReviewModel";+import realCardsJson from "./realCards.json";export const CHAT_SESSION = "s1";@@ -94,10 +96,11 @@ export function mail(id = "mail", chatRules: string[] = ["allow", "judge"]) {reasonKind: "subject",subject: {kind: "block",- key: "gmail-send",+ key: "block:b-gmail",name: "Gmail Send",effect: "external",irreversible: true,+ block_id: "b-gmail",},chatRules,args: {@@ -136,6 +139,32 @@ export function deleteFolder(id: string, folderId: string) {});}+// A workflow run whose step reaches outside the platform.+export function workflow(id = "wf") {+ return heldReview({+ id,+ tool: "run_agent",+ mode: "auto",+ reason:+ "Runs Morning digest; its step Gmail Send reaches outside the platform.",+ reasonKind: "subject",+ subject: {+ kind: "workflow",+ key: "workflow:g-1",+ name: "Morning digest",+ effect: "external",+ irreversible: true,+ block_id: null,+ },+ args: { library_agent_id: "lib-1", inputs: { topic: "Q3 invoices" } },+ fields: [+ { key: "library_agent_id", label: "Library agent" },+ { key: "inputs", label: "Inputs" },+ ],+ headline: { ask: "Run", object: "Morning digest" },+ });+}+// A read the content judge held: its row sits under its own ``read-`` node id.export function heldRead(id: string, url: string) {const review = heldReview({@@ -154,3 +183,39 @@ export function heldRead(id: string, url: string) {const node = "copilot-node-gate-read-web_fetch";return { ...review, node_id: node, node_exec_id: `${node}:${id}` };}++export interface RealCard {+ story: string;+ review: PendingHumanReviewModel;+ schema: Record<string, unknown> | null;+}++// Built by the backend's payload builder from real registry blocks (card_fixture_test.py).+export function realCards(): RealCard[] {+ return (realCardsJson as unknown as Omit<RealCard, "review">[]).map(+ (card) => ({+ ...card,+ review: {+ ...(card as unknown as { review: PendingHumanReviewModel }).review,+ created_at: new Date(Date.now() - 5 * 60_000),+ },+ }),+ );+}++export function realCardSchemaHandler(cards: RealCard[]) {+ return http.get("*/api/builder/blocks/batch", ({ request }) => {+ const ids = new URL(request.url).searchParams.getAll("block_ids");+ return HttpResponse.json(+ cards+ .filter((card) => card.schema)+ .map((card) => ({+ id: (card.review.payload as { subject: { block_id: string } }).subject+ .block_id,+ name: card.story,+ inputSchema: card.schema,+ }))+ .filter((block) => ids.includes(block.id)),+ );+ });+}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ApprovalQueue/__tests__/realCards.json b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ApprovalQueue/__tests__/realCards.jsonnew file mode 100644index 0000000000..dc2a1aff60--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ApprovalQueue/__tests__/realCards.json@@ -0,0 +1,1086 @@+[+ {+ "story": "Gmail Send",+ "review": {+ "node_exec_id": "copilot-node-gate-run_capability:45dc4fe375588da5",+ "node_id": "copilot-node-gate-run_capability",+ "user_id": "user-1",+ "session_id": "s1",+ "graph_exec_id": null,+ "graph_id": null,+ "graph_version": null,+ "payload": {+ "tool": "run_capability",+ "arguments": {+ "to": ["[email protected]"],+ "cc": ["[email protected]"],+ "subject": "Q3 invoices missing PO numbers",+ "body": "Hi Dana,\n\nThe Q3 invoice pack is in the shared Invoices folder. Three of them are still missing a PO number:\n\n- INV-2041\n- INV-2044\n- INV-2051\n\nCould you look before Friday?\n\nThanks,\nOtto"+ },+ "clipped": [],+ "fields": [+ {+ "key": "to",+ "label": "To"+ },+ {+ "key": "cc",+ "label": "Cc"+ },+ {+ "key": "subject",+ "label": "Subject"+ },+ {+ "key": "body",+ "label": "Body"+ }+ ],+ "tool_call_id": "call-run_capability",+ "turn": 1,+ "mode": "auto",+ "subject": {+ "kind": "block",+ "key": "block:6c27abc2-e51d-499e-a85f-5a0041ba94f0",+ "name": "Gmail Send",+ "effect": "external",+ "irreversible": true,+ "block_id": "6c27abc2-e51d-499e-a85f-5a0041ba94f0"+ },+ "reason": "Runs Gmail Send, which reaches outside the platform.",+ "reason_kind": "subject",+ "chat_rules_allowed": [],+ "headline": {+ "ask": "Run",+ "object": "Gmail Send",+ "object_key": null+ }+ },+ "instructions": "Gmail Send",+ "editable": false,+ "status": "WAITING"+ },+ "schema": {+ "properties": {+ "credentials": {+ "credentials_provider": ["google"],+ "credentials_types": ["oauth2"],+ "properties": {+ "id": {+ "title": "Id",+ "type": "string"+ },+ "title": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Title"+ },+ "provider": {+ "const": "google",+ "title": "Provider",+ "type": "string"+ },+ "type": {+ "const": "oauth2",+ "title": "Type",+ "type": "string"+ }+ },+ "required": ["id", "provider", "type"],+ "title": "CredentialsMetaInput[Literal[<ProviderName.GOOGLE: 'google'>], Literal['oauth2']]",+ "type": "object",+ "credentials_scopes": ["https://www.googleapis.com/auth/gmail.send"],+ "description": "The Google integration requires OAuth2 authentication."+ },+ "to": {+ "advanced": false,+ "description": "Recipient email addresses",+ "items": {+ "type": "string"+ },+ "secret": false,+ "title": "To",+ "type": "array"+ },+ "subject": {+ "advanced": false,+ "description": "Email subject",+ "secret": false,+ "title": "Subject",+ "type": "string"+ },+ "body": {+ "advanced": false,+ "description": "Email body (plain text or HTML)",+ "secret": false,+ "title": "Body",+ "type": "string"+ },+ "cc": {+ "advanced": true,+ "description": "CC recipients",+ "items": {+ "type": "string"+ },+ "secret": false,+ "title": "Cc",+ "type": "array"+ },+ "bcc": {+ "advanced": true,+ "description": "BCC recipients",+ "items": {+ "type": "string"+ },+ "secret": false,+ "title": "Bcc",+ "type": "array"+ },+ "content_type": {+ "advanced": true,+ "anyOf": [+ {+ "enum": ["auto", "plain", "html"],+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "description": "Content type: 'auto' (default - detects HTML), 'plain', or 'html'",+ "secret": false,+ "title": "Content Type"+ },+ "attachments": {+ "advanced": true,+ "description": "Files to attach",+ "items": {+ "format": "file",+ "type": "string"+ },+ "secret": false,+ "title": "Attachments",+ "type": "array"+ }+ },+ "required": ["credentials", "to", "subject", "body"],+ "title": "Input",+ "type": "object"+ }+ },+ {+ "story": "Google Sheets Update Row",+ "review": {+ "node_exec_id": "copilot-node-gate-run_capability:9be621b1d86e07dd",+ "node_id": "copilot-node-gate-run_capability",+ "user_id": "user-1",+ "session_id": "s1",+ "graph_exec_id": null,+ "graph_id": null,+ "graph_version": null,+ "payload": {+ "tool": "run_capability",+ "arguments": {+ "spreadsheet": {+ "id": "1x9QwErTyUiOp",+ "name": "Q3 invoices",+ "mimeType": "application/vnd.google-apps.spreadsheet",+ "url": "https://docs.google.com/spreadsheets/d/1x9QwErTyUiOp"+ },+ "sheet_name": "October",+ "row_index": 7,+ "values": ["INV-2044", "4,210.00", "Paid"]+ },+ "clipped": [],+ "fields": [+ {+ "key": "spreadsheet",+ "label": "Spreadsheet"+ },+ {+ "key": "sheet_name",+ "label": "Sheet name"+ },+ {+ "key": "row_index",+ "label": "Row index"+ },+ {+ "key": "values",+ "label": "Values"+ }+ ],+ "tool_call_id": "call-run_capability",+ "turn": 1,+ "mode": "auto",+ "subject": {+ "kind": "block",+ "key": "block:b8a934d5-fca0-4be3-9fc2-a99bf63bd385",+ "name": "Google Sheets Update Row",+ "effect": "external",+ "irreversible": false,+ "block_id": "b8a934d5-fca0-4be3-9fc2-a99bf63bd385"+ },+ "reason": "Otto does not know what Google Sheets Update Row does, so he asks.",+ "reason_kind": "subject",+ "chat_rules_allowed": [],+ "headline": {+ "ask": "Run",+ "object": "Google Sheets Update Row",+ "object_key": null+ }+ },+ "instructions": "Google Sheets Update Row",+ "editable": false,+ "status": "WAITING"+ },+ "schema": {+ "properties": {+ "spreadsheet": {+ "description": "Select a Google Sheets spreadsheet. At runtime, feed this from an AgentGoogleDriveFileInputBlock with matching allowed_views. NEVER hardcode a file ID in input_default (including one parsed from a Drive URL the user pasted in chat) — only the picker attaches the _credentials_id needed for auth.",+ "properties": {+ "id": {+ "description": "Google Drive file/folder ID",+ "title": "Id",+ "type": "string"+ },+ "name": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "description": "File/folder name",+ "title": "Name"+ },+ "mimeType": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "description": "MIME type (e.g., application/vnd.google-apps.document)",+ "title": "Mimetype"+ },+ "url": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "description": "URL to open the file",+ "title": "Url"+ },+ "iconUrl": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "description": "Icon URL",+ "title": "Iconurl"+ },+ "isFolder": {+ "anyOf": [+ {+ "type": "boolean"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "description": "Whether this is a folder",+ "title": "Isfolder"+ },+ "_credentials_id": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "description": "Internal: credential ID for authentication",+ "title": "Credentials Id"+ }+ },+ "required": ["id"],+ "title": "Spreadsheet",+ "type": "object",+ "advanced": false,+ "auto_credentials": {+ "kwarg_name": "credentials",+ "provider": "google",+ "scopes": ["https://www.googleapis.com/auth/drive.file"],+ "type": "oauth2"+ },+ "default": null,+ "format": "google-drive-picker",+ "google_drive_picker_config": {+ "allow_folder_selection": false,+ "allowed_mime_types": ["application/vnd.google-apps.spreadsheet"],+ "allowed_views": ["SPREADSHEETS"],+ "auto_credentials": {+ "kwarg_name": "credentials",+ "provider": "google",+ "scopes": ["https://www.googleapis.com/auth/drive.file"],+ "type": "oauth2"+ },+ "multiselect": false,+ "scopes": ["https://www.googleapis.com/auth/drive.file"]+ },+ "placeholder": "Select from Google Drive",+ "secret": false+ },+ "sheet_name": {+ "advanced": true,+ "default": "",+ "description": "Sheet name (optional, defaults to first sheet)",+ "secret": false,+ "title": "Sheet Name",+ "type": "string"+ },+ "row_index": {+ "advanced": false,+ "description": "1-based row index to update",+ "secret": false,+ "title": "Row Index",+ "type": "integer"+ },+ "values": {+ "advanced": true,+ "default": [],+ "description": "New values for the row (in column order)",+ "items": {+ "type": "string"+ },+ "secret": false,+ "title": "Values",+ "type": "array"+ },+ "dict_values": {+ "additionalProperties": {+ "type": "string"+ },+ "advanced": true,+ "default": {},+ "description": "Values as dict with column headers as keys (alternative to values)",+ "secret": false,+ "title": "Dict Values",+ "type": "object"+ }+ },+ "required": ["row_index"],+ "title": "Input",+ "type": "object"+ }+ },+ {+ "story": "Execute Code Step",+ "review": {+ "node_exec_id": "copilot-node-gate-run_capability:89830f14bf9fbf54",+ "node_id": "copilot-node-gate-run_capability",+ "user_id": "user-1",+ "session_id": "s1",+ "graph_exec_id": null,+ "graph_id": null,+ "graph_version": null,+ "payload": {+ "tool": "run_capability",+ "arguments": {+ "sandbox_id": "sbx-q3",+ "language": "python",+ "step_code": "import pandas as pd\n\ndf = pd.read_csv('invoices.csv')\nmissing = df[df.po_number.isna()]\nprint(missing[['id', 'amount']].to_markdown())\n"+ },+ "clipped": [],+ "fields": [+ {+ "key": "sandbox_id",+ "label": "Sandbox"+ },+ {+ "key": "language",+ "label": "Language"+ },+ {+ "key": "step_code",+ "label": "Step code"+ }+ ],+ "tool_call_id": "call-run_capability",+ "turn": 1,+ "mode": "auto",+ "subject": {+ "kind": "block",+ "key": "block:82b59b8e-ea10-4d57-9161-8b169b0adba6",+ "name": "Execute Code Step",+ "effect": "shell",+ "irreversible": false,+ "block_id": "82b59b8e-ea10-4d57-9161-8b169b0adba6"+ },+ "reason": "it reads a local file of invoices and prints what it finds.",+ "reason_kind": "supervisor",+ "chat_rules_allowed": [],+ "headline": {+ "ask": "Run",+ "object": "Execute Code Step",+ "object_key": null+ }+ },+ "instructions": "Execute Code Step",+ "editable": false,+ "status": "WAITING"+ },+ "schema": {+ "properties": {+ "credentials": {+ "credentials_provider": ["e2b"],+ "credentials_types": ["api_key"],+ "properties": {+ "id": {+ "title": "Id",+ "type": "string"+ },+ "title": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Title"+ },+ "provider": {+ "const": "e2b",+ "title": "Provider",+ "type": "string"+ },+ "type": {+ "const": "api_key",+ "title": "Type",+ "type": "string"+ }+ },+ "required": ["id", "provider", "type"],+ "title": "CredentialsMetaInput[Literal[<ProviderName.E2B: 'e2b'>], Literal['api_key']]",+ "type": "object",+ "description": "Enter your API key for the E2B platform. You can get it in here - https://e2b.dev/docs"+ },+ "sandbox_id": {+ "advanced": false,+ "description": "ID of the sandbox instance to execute the code in",+ "secret": false,+ "title": "Sandbox Id",+ "type": "string"+ },+ "step_code": {+ "advanced": false,+ "default": "",+ "description": "Code to execute in the sandbox",+ "placeholder": "print('Hello, World!')",+ "secret": false,+ "title": "Step Code",+ "type": "string"+ },+ "language": {+ "enum": ["python", "js", "bash", "r", "java"],+ "title": "ProgrammingLanguage",+ "type": "string",+ "advanced": false,+ "default": "python",+ "description": "Programming language to execute",+ "secret": false+ },+ "dispose_sandbox": {+ "advanced": true,+ "default": false,+ "description": "Whether to dispose of the sandbox after executing this code.",+ "secret": false,+ "title": "Dispose Sandbox",+ "type": "boolean"+ }+ },+ "required": ["credentials", "sandbox_id"],+ "title": "Input",+ "type": "object"+ }+ },+ {+ "story": "Send Web Request",+ "review": {+ "node_exec_id": "copilot-node-gate-run_capability:f9fc2d8be8150e56",+ "node_id": "copilot-node-gate-run_capability",+ "user_id": "user-1",+ "session_id": "s1",+ "graph_exec_id": null,+ "graph_id": null,+ "graph_version": null,+ "payload": {+ "tool": "run_capability",+ "arguments": {+ "url": "https://api.acme.com/v2/invoices/2044/status",+ "method": "POST",+ "headers": {+ "Content-Type": "application/json",+ "Authorization": "[redacted]"+ },+ "body": {+ "status": "paid",+ "paid_at": "2026-09-24",+ "lines": [1, 2, 3]+ }+ },+ "clipped": [],+ "fields": [+ {+ "key": "url",+ "label": "Url"+ },+ {+ "key": "method",+ "label": "Method"+ },+ {+ "key": "headers",+ "label": "Headers"+ },+ {+ "key": "body",+ "label": "Body"+ }+ ],+ "tool_call_id": "call-run_capability",+ "turn": 1,+ "mode": "auto",+ "subject": {+ "kind": "block",+ "key": "block:6595ae1f-b924-42cb-9a41-551a0611c4b4",+ "name": "Send Web Request",+ "effect": "external",+ "irreversible": false,+ "block_id": "6595ae1f-b924-42cb-9a41-551a0611c4b4"+ },+ "reason": "Runs Send Web Request, which reaches outside the platform.",+ "reason_kind": "subject",+ "chat_rules_allowed": [],+ "headline": {+ "ask": "Run",+ "object": "Send Web Request",+ "object_key": null+ }+ },+ "instructions": "Send Web Request",+ "editable": false,+ "status": "WAITING"+ },+ "schema": {+ "properties": {+ "url": {+ "advanced": false,+ "description": "The URL to send the request to",+ "placeholder": "https://api.example.com",+ "secret": false,+ "title": "Url",+ "type": "string"+ },+ "method": {+ "enum": ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD"],+ "title": "HttpMethod",+ "type": "string",+ "advanced": true,+ "default": "POST",+ "description": "The HTTP method to use for the request",+ "secret": false+ },+ "headers": {+ "additionalProperties": {+ "type": "string"+ },+ "advanced": true,+ "description": "The headers to include in the request",+ "secret": false,+ "title": "Headers",+ "type": "object"+ },+ "json_format": {+ "advanced": true,+ "default": true,+ "description": "If true, send the body as JSON (unless files are also present).",+ "secret": false,+ "title": "JSON format",+ "type": "boolean"+ },+ "body": {+ "advanced": true,+ "anyOf": [+ {+ "additionalProperties": true,+ "type": "object"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "description": "Form/JSON body payload. If files are supplied, this must be a mapping of form‑fields.",+ "secret": false,+ "title": "Body"+ },+ "files_name": {+ "advanced": true,+ "default": "file",+ "description": "The name of the file field in the form data.",+ "secret": false,+ "title": "Files Name",+ "type": "string"+ },+ "files": {+ "advanced": true,+ "description": "Mapping of *form field name* → Image url / path / base64 url.",+ "items": {+ "format": "file",+ "type": "string"+ },+ "secret": false,+ "title": "Files",+ "type": "array"+ }+ },+ "required": ["url"],+ "title": "Input",+ "type": "object"+ }+ },+ {+ "story": "Post To X",+ "review": {+ "node_exec_id": "copilot-node-gate-run_capability:d50b2741a9b2406f",+ "node_id": "copilot-node-gate-run_capability",+ "user_id": "user-1",+ "session_id": "s1",+ "graph_exec_id": null,+ "graph_id": null,+ "graph_version": null,+ "payload": {+ "tool": "run_capability",+ "arguments": {+ "post": "Q3 is closed. Thanks to everyone who got their invoices in on time.",+ "media_urls": ["https://cdn.acme.com/q3-chart.png"],+ "alt_text": ["Bar chart of Q3 revenue by month"],+ "shorten_links": true+ },+ "clipped": [],+ "fields": [+ {+ "key": "post",+ "label": "Post"+ },+ {+ "key": "media_urls",+ "label": "Media urls"+ },+ {+ "key": "alt_text",+ "label": "Alt text"+ },+ {+ "key": "shorten_links",+ "label": "Shorten links"+ }+ ],+ "tool_call_id": "call-run_capability",+ "turn": 1,+ "mode": "auto",+ "subject": {+ "kind": "block",+ "key": "block:9e8f844e-b4a5-4b25-80f2-9e1dd7d67625",+ "name": "Post To X",+ "effect": "external",+ "irreversible": true,+ "block_id": "9e8f844e-b4a5-4b25-80f2-9e1dd7d67625"+ },+ "reason": "Runs Post To X, which reaches outside the platform.",+ "reason_kind": "subject",+ "chat_rules_allowed": [],+ "headline": {+ "ask": "Run",+ "object": "Post To X",+ "object_key": null+ }+ },+ "instructions": "Post To X",+ "editable": false,+ "status": "WAITING"+ },+ "schema": {+ "description": "Input schema for X / Twitter posts.",+ "properties": {+ "credentials": {+ "credentials_provider": ["ayrshare"],+ "credentials_types": ["api_key"],+ "properties": {+ "id": {+ "title": "Id",+ "type": "string"+ },+ "title": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Title"+ },+ "provider": {+ "description": "Provider name for integrations. Can be any string value, including custom provider names.",+ "title": "Provider",+ "type": "string"+ },+ "type": {+ "enum": [+ "api_key",+ "oauth2",+ "user_password",+ "host_scoped",+ "device_code"+ ],+ "title": "Type",+ "type": "string"+ }+ },+ "required": ["id", "provider", "type"],+ "title": "CredentialsMetaInput",+ "type": "object",+ "description": "Ayrshare profile credential. AutoGPT provisions this managed credential automatically — the user does not create it. After it's in place, the user links each social account via the Ayrshare SSO popup in the Builder."+ },+ "post": {+ "advanced": false,+ "description": "The post text (max 280 chars, up to 25,000 for Premium users). Use @handle to mention users. Use \\n\\n for thread breaks.",+ "secret": false,+ "title": "Post",+ "type": "string"+ },+ "media_urls": {+ "advanced": false,+ "description": "Optional list of media URLs. X supports up to 4 images or videos per tweet. Auto-preview links unless media is included.",+ "items": {+ "type": "string"+ },+ "secret": false,+ "title": "Media Urls",+ "type": "array"+ },+ "is_video": {+ "advanced": true,+ "default": false,+ "description": "Whether the media is a video. Set to True when uploading a video so billing applies the video tier.",+ "secret": false,+ "title": "Is Video",+ "type": "boolean"+ },+ "schedule_date": {+ "advanced": true,+ "anyOf": [+ {+ "format": "date-time",+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "description": "UTC datetime for scheduling (YYYY-MM-DDThh:mm:ssZ)",+ "secret": false,+ "title": "Schedule Date"+ },+ "disable_comments": {+ "advanced": true,+ "default": false,+ "description": "Whether to disable comments",+ "secret": false,+ "title": "Disable Comments",+ "type": "boolean"+ },+ "shorten_links": {+ "advanced": true,+ "default": false,+ "description": "Whether to shorten links",+ "secret": false,+ "title": "Shorten Links",+ "type": "boolean"+ },+ "unsplash": {+ "advanced": true,+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "description": "Unsplash image configuration",+ "secret": false,+ "title": "Unsplash"+ },+ "requires_approval": {+ "advanced": true,+ "default": false,+ "description": "Whether to enable approval workflow",+ "secret": false,+ "title": "Requires Approval",+ "type": "boolean"+ },+ "random_post": {+ "advanced": true,+ "default": false,+ "description": "Whether to generate random post text",+ "secret": false,+ "title": "Random Post",+ "type": "boolean"+ },+ "random_media_url": {+ "advanced": true,+ "default": false,+ "description": "Whether to generate random media",+ "secret": false,+ "title": "Random Media Url",+ "type": "boolean"+ },+ "notes": {+ "advanced": true,+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "description": "Additional notes for the post",+ "secret": false,+ "title": "Notes"+ },+ "reply_to_id": {+ "advanced": true,+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "description": "ID of the tweet to reply to",+ "secret": false,+ "title": "Reply To Id"+ },+ "quote_tweet_id": {+ "advanced": true,+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "description": "ID of the tweet to quote (low-level Tweet ID)",+ "secret": false,+ "title": "Quote Tweet Id"+ },+ "poll_options": {+ "advanced": true,+ "description": "Poll options (2-4 choices)",+ "items": {+ "type": "string"+ },+ "secret": false,+ "title": "Poll Options",+ "type": "array"+ },+ "poll_duration": {+ "advanced": true,+ "default": 1440,+ "description": "Poll duration in minutes (1-10080)",+ "secret": false,+ "title": "Poll Duration",+ "type": "integer"+ },+ "alt_text": {+ "advanced": true,+ "description": "Alt text for each image (max 1,000 chars each, not supported for videos)",+ "items": {+ "type": "string"+ },+ "secret": false,+ "title": "Alt Text",+ "type": "array"+ },+ "is_thread": {+ "advanced": true,+ "default": false,+ "description": "Whether to automatically break post into thread based on line breaks",+ "secret": false,+ "title": "Is Thread",+ "type": "boolean"+ },+ "thread_number": {+ "advanced": true,+ "default": false,+ "description": "Add thread numbers (1/n format) to each thread post",+ "secret": false,+ "title": "Thread Number",+ "type": "boolean"+ },+ "thread_media_urls": {+ "advanced": true,+ "description": "Media URLs for thread posts (one per thread, use 'null' to skip)",+ "items": {+ "type": "string"+ },+ "secret": false,+ "title": "Thread Media Urls",+ "type": "array"+ },+ "long_post": {+ "advanced": true,+ "default": false,+ "description": "Force long form post (requires Premium X account)",+ "secret": false,+ "title": "Long Post",+ "type": "boolean"+ },+ "long_video": {+ "advanced": true,+ "default": false,+ "description": "Enable long video upload (requires approval and Business/Enterprise plan)",+ "secret": false,+ "title": "Long Video",+ "type": "boolean"+ },+ "subtitle_url": {+ "advanced": true,+ "default": "",+ "description": "URL to SRT subtitle file for videos (must be HTTPS and end in .srt)",+ "secret": false,+ "title": "Subtitle Url",+ "type": "string"+ },+ "subtitle_language": {+ "advanced": true,+ "default": "en",+ "description": "Language code for subtitles (default: 'en')",+ "secret": false,+ "title": "Subtitle Language",+ "type": "string"+ },+ "subtitle_name": {+ "advanced": true,+ "default": "English",+ "description": "Name of caption track (max 150 chars, default: 'English')",+ "secret": false,+ "title": "Subtitle Name",+ "type": "string"+ }+ },+ "required": ["credentials", "post"],+ "title": "Input",+ "type": "object"+ }+ },+ {+ "story": "Workflow",+ "review": {+ "node_exec_id": "copilot-node-gate-run_agent:b6b37239ba4de98b",+ "node_id": "copilot-node-gate-run_agent",+ "user_id": "user-1",+ "session_id": "s1",+ "graph_exec_id": null,+ "graph_id": null,+ "graph_version": null,+ "payload": {+ "tool": "run_agent",+ "arguments": {+ "library_agent_id": "lib-7",+ "inputs": {+ "topic": "Q3 invoices"+ }+ },+ "clipped": [],+ "fields": [+ {+ "key": "library_agent_id",+ "label": "Library agent"+ },+ {+ "key": "inputs",+ "label": "Inputs"+ }+ ],+ "tool_call_id": "call-run_agent",+ "turn": 1,+ "mode": "auto",+ "subject": {+ "kind": "workflow",+ "key": "workflow:g-digest",+ "name": "Morning digest",+ "effect": "external",+ "irreversible": true,+ "block_id": null+ },+ "reason": "Runs Morning digest; its step Gmail Send reaches outside the platform.",+ "reason_kind": "subject",+ "chat_rules_allowed": [],+ "headline": {+ "ask": "Run",+ "object": "Morning digest",+ "object_key": null+ }+ },+ "instructions": "Morning digest",+ "editable": false,+ "status": "WAITING"+ },+ "schema": null+ }+]diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ApprovalQueue/__tests__/realCards.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ApprovalQueue/__tests__/realCards.test.tsxnew file mode 100644index 0000000000..7903b15dbf--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ApprovalQueue/__tests__/realCards.test.tsx@@ -0,0 +1,69 @@+import { http, HttpResponse } from "msw";+import { expect, test, vi } from "vitest";+import { isIdKey } from "@/components/organisms/ApprovalFields/helpers";+import { server } from "@/mocks/mock-server";+import { render, screen } from "@/tests/integrations/test-utils";+import { CopilotChatActionsProvider } from "../../CopilotChatActionsProvider/CopilotChatActionsProvider";+import { CopilotPendingReviews } from "../../CopilotPendingReviews/CopilotPendingReviews";+import { realCardSchemaHandler, realCards, CHAT_SESSION } from "./fixtures";++const cards = realCards();++test.each(cards.map((card) => [card.story, card] as const))(+ "the real %s card names its subject and labels every input in plain words",+ async (_, card) => {+ server.use(+ http.get(`*/api/review/session/${CHAT_SESSION}`, () =>+ HttpResponse.json([card.review]),+ ),+ realCardSchemaHandler(cards),+ );+ render(+ <CopilotChatActionsProvider onSend={vi.fn()} onBackendTurn={vi.fn()}>+ <CopilotPendingReviews chatSessionId={CHAT_SESSION} />+ </CopilotChatActionsProvider>,+ );++ const payload = card.review.payload as {+ subject: { name: string };+ fields: { key: string; label: string }[];+ };+ expect(+ await screen.findByRole("heading", {+ name: new RegExp(`Run ${payload.subject.name}`),+ }),+ ).toBeDefined();+ const card_ = screen.getByRole("region", { name: "Waiting for you" });+ const text = card_.textContent ?? "";+ expect(text).not.toMatch(+ /[a-z][A-Z]\w*Input|ProgrammingLanguage|Literal\[/,+ );+ expect(text).not.toContain("sk-live");+ // Nested values too: a secret reads as hidden, a camelCase key in words.+ expect(text).not.toContain("[redacted]");+ expect(text).not.toContain("mimeType");+ expect(text).not.toContain("MimeType");+ if (card.schema) {+ // Labels come from the schema once it arrives; each shown input has one.+ const shown = payload.fields.find((field) => !isIdKey(field.key));+ if (shown) await screen.findByText(shown.label);+ }+ },+);++test("a code block's step renders as code", async () => {+ const card = cards.find((c) => c.story === "Execute Code Step")!;+ server.use(+ http.get(`*/api/review/session/${CHAT_SESSION}`, () =>+ HttpResponse.json([card.review]),+ ),+ realCardSchemaHandler(cards),+ );+ render(+ <CopilotChatActionsProvider onSend={vi.fn()} onBackendTurn={vi.fn()}>+ <CopilotPendingReviews chatSessionId={CHAT_SESSION} />+ </CopilotChatActionsProvider>,+ );+ const code = await screen.findByText(/import pandas as pd/);+ expect(code.closest("pre")).not.toBeNull();+});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ApprovalQueue/components/ApprovalCard/useApprovalFields.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ApprovalQueue/components/ApprovalCard/useApprovalFields.tsindex 3a861fc5d6..5c99f3bc53 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ApprovalQueue/components/ApprovalCard/useApprovalFields.ts+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ApprovalQueue/components/ApprovalCard/useApprovalFields.ts@@ -2,24 +2,43 @@ import { useReviewBlockSchema } from "@/components/organisms/PendingReviewCard/cimport { asObject } from "../../../ToolChain/resultHelpers";import type { ApprovalItem } from "../../helpers";-// A block's inputs are labelled by the block's own schema; a tool's by the server.+// A block's inputs are labelled and ordered by the block's own schema; a tool's by the server.export function useApprovalFields(item: ApprovalItem) {const { schema } = useReviewBlockSchema(item.blockId);- if (!item.blockId) return { labels: item.fields, values: item.args };- const values = asObject(item.args.input_data) ?? {};- const properties = asObject(schema?.properties) ?? {};+ const properties = asObject(schema?.properties);+ if (!item.blockId || !properties) {+ return { labels: item.fields, values: item.args };+ }const required = Array.isArray(schema?.required)? (schema.required as string[]): [];const keys = [...required.filter((key) => key in properties),...Object.keys(properties).filter((key) => !required.includes(key)),+ ...Object.keys(item.args).filter((key) => !(key in properties)),];+ const serverLabel = new Map(item.fields.map((f) => [f.key, f.label]));return {labels: keys.map((key) => ({key,- label: String(asObject(properties[key])?.title ?? key),+ label: schemaLabel(+ key,+ asObject(properties[key])?.title,+ serverLabel.get(key) ?? key,+ ),})),- values,+ values: item.args,};}++// A title a person wrote wins; pydantic's own (the key in Title Case, or a type's name) does not.+function schemaLabel(key: string, title: unknown, fallback: string) {+ if (typeof title !== "string" || !title) return fallback;+ const automatic = key+ .split("_")+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))+ .join(" ");+ const typeName = /^[A-Z][A-Za-z0-9]*[a-z][A-Z][A-Za-z0-9]*(\[.*\])?$/;+ if (title === automatic || typeName.test(title)) return fallback;+ return title;+}diff --git a/autogpt_platform/frontend/src/components/organisms/ApprovalFields/components/FieldValue.tsx b/autogpt_platform/frontend/src/components/organisms/ApprovalFields/components/FieldValue.tsxindex 56be0dea94..72efdaae36 100644--- a/autogpt_platform/frontend/src/components/organisms/ApprovalFields/components/FieldValue.tsx+++ b/autogpt_platform/frontend/src/components/organisms/ApprovalFields/components/FieldValue.tsx@@ -10,6 +10,7 @@ import {humanize,lineCount,listText,+ REDACTED,scalarText,} from "../helpers";@@ -27,11 +28,7 @@ export function FieldValue({ name, value, clipped }: Props) {switch (kind) {case "secret":- return (- <span className="text-zinc-500">- <span aria-hidden="true">•••••••• </span>hidden- </span>- );+ return <Hidden />;case "code":return (<pre@@ -59,7 +56,13 @@ export function FieldValue({ name, value, clipped }: Props) {<div key={k} className="contents"><dt className="text-zinc-500">{humanize(k)}</dt><dd className="min-w-0">- {Array.isArray(v) ? listText(v) : scalarText(v)}+ {v === REDACTED ? (+ <Hidden />+ ) : Array.isArray(v) ? (+ listText(v)+ ) : (+ scalarText(v)+ )}</dd></div>))}@@ -119,3 +122,11 @@ function LongText({ text, shortened }: LongTextProps) {</div>);}++function Hidden() {+ return (+ <span className="text-zinc-500">+ <span aria-hidden="true">•••••••• </span>hidden+ </span>+ );+}diff --git a/autogpt_platform/frontend/src/components/organisms/ApprovalFields/helpers.ts b/autogpt_platform/frontend/src/components/organisms/ApprovalFields/helpers.tsindex 7e4b1ac5d5..68be4decde 100644--- a/autogpt_platform/frontend/src/components/organisms/ApprovalFields/helpers.ts+++ b/autogpt_platform/frontend/src/components/organisms/ApprovalFields/helpers.ts@@ -36,7 +36,7 @@ export function fieldKind(key: string, value: unknown): FieldKind {: "json";}const text = String(value);- if (CODE_KEYS.has(key)) return "code";+ if (CODE_KEYS.has(key) || key.endsWith("_code")) return "code";if (text.length > CLAMP_CHARS || lineCount(text) > CLAMP_LINES) return "long";return "short";}@@ -89,7 +89,13 @@ export function lineCount(text: string) {}export function humanize(key: string) {- const words = key.replace(/_/g, " ").trim();+ const words = key+ .replace(/_/g, " ")+ .replace(+ /([a-z])([A-Z])/g,+ (_, a: string, b: string) => `${a} ${b.toLowerCase()}`,+ )+ .trim();return words.charAt(0).toUpperCase() + words.slice(1);}