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(backend/copilot): inline picker-backed inputs via run_block + accept AgentInputBlock subclasses (#12880)
An Vy Le3aa72b42453e
diff --git a/autogpt_platform/backend/backend/blocks/google/_drive.py b/autogpt_platform/backend/backend/blocks/google/_drive.pyindex cb2b52821c..c5ecc55701 100644--- a/autogpt_platform/backend/backend/blocks/google/_drive.py+++ b/autogpt_platform/backend/backend/blocks/google/_drive.py@@ -133,10 +133,21 @@ def GoogleDriveFileField(if allowed_mime_types:picker_config["allowed_mime_types"] = list(allowed_mime_types)+ agent_builder_hint = (+ "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."+ )+return SchemaField(default=None,title=title,- description=description,+ description=(+ f"{description.rstrip('.')}. {agent_builder_hint}"+ if description+ else agent_builder_hint+ ),placeholder=placeholder or "Select from Google Drive",# Use google-drive-picker format so frontend renders existing componentformat="google-drive-picker",diff --git a/autogpt_platform/backend/backend/blocks/io.py b/autogpt_platform/backend/backend/blocks/io.pyindex e72ee5c097..2ef9999da4 100644--- a/autogpt_platform/backend/backend/blocks/io.py+++ b/autogpt_platform/backend/backend/blocks/io.py@@ -737,7 +737,22 @@ class AgentGoogleDriveFileInputBlock(AgentInputBlock):)super().__init__(id="d3b32f15-6fd7-40e3-be52-e083f51b19a2",- description="Block for selecting a file from Google Drive.",+ description=(+ "Agent-level input for a Google Drive file. REQUIRED for any "+ "agent that reads or writes a Drive file (Sheets, Docs, "+ "Slides, or generic Drive) — the picker is the only source "+ "of the _credentials_id needed at runtime, so consuming "+ "blocks cannot receive a hardcoded ID. Set allowed_views to "+ 'match the consumer: ["SPREADSHEETS"] for Sheets, '+ '["DOCUMENTS"] for Docs, ["PRESENTATIONS"] for Slides '+ "(leave default for generic Drive). Wire `result` to the "+ "consumer block's Drive field and leave that field unset in "+ "the consumer's input_default. Example link to a Google "+ 'Sheets block: {"source_name": "result", "sink_name": '+ '"spreadsheet"} (use "document" for Docs, "presentation" '+ "for Slides). Use one input block per distinct file; "+ "multiple consumers of the same file share it."+ ),disabled=not config.enable_agent_input_subtype_blocks,input_schema=AgentGoogleDriveFileInputBlock.Input,output_schema=AgentGoogleDriveFileInputBlock.Output,diff --git a/autogpt_platform/backend/backend/copilot/prompting.py b/autogpt_platform/backend/backend/copilot/prompting.pyindex c8af41637c..b517d7e329 100644--- a/autogpt_platform/backend/backend/copilot/prompting.py+++ b/autogpt_platform/backend/backend/copilot/prompting.py@@ -152,6 +152,60 @@ When the user asks to interact with a service or API, follow this order:- Do NOT invoke `AutoPilotBlock` via `run_block`; use `run_sub_session`instead.+### Picker-backed inputs via `run_block` (READ BEFORE CALLING)++Some block input fields are populated by a platform-rendered picker at+run time — the user clicks a button, authenticates, and selects a+resource in one step. **The picker is the ONLY source of the hidden+credentials attached to the selected value.** A bare ID or URL will+never authenticate. You can spot a picker field by a `format` hint or+an `auto_credentials` entry in the schema returned by `find_block`.++**The correct flow — just call `run_block` with the field set to+`null` (or omit it for non-required fields); the platform handles the+picker and credentials.**++✅ Correct — triggers the inline picker:+```+run_block(block_id="...", input_data={"<picker_field>": null, ...other inputs...})+```++The tool returns a setup card with the picker in chat. The user picks+the resource, and `run_block` is re-invoked automatically with the+full picker payload (including the hidden credentials field) merged+in. You do NOT need to collect URLs, IDs, or credentials from the+user — just call the tool.++❌ Do NOT:+- Ask the user for a URL, ID, or any identifier for a picker-backed+ resource before calling `run_block`. The picker inside the setup+ card is the answer.+- Hardcode an ID parsed from a URL the user happens to mention — a+ bare ID has no attached credentials and the block fails at auth.+- Refuse the task ("I can't access private resources") — you can, via+ the picker. Call `run_block` first.++**Chained calls**: if a prior tool already returned a full picker+object (with its hidden credentials field attached), you MAY pass that+object through as-is to a downstream `run_block`; do not strip or+modify its fields.++### Pre-flight with `validate_only`++`run_block(id, {})` is NOT always a safe probe — for blocks with no+required inputs, it executes immediately. When you need to inspect+what a block does or what it needs without side effects, pass+`validate_only: true`:++```+run_block(block_id="...", input_data={...}, validate_only=true)+```++This returns the block's input/output schema and a list of missing+required fields — never executes, never renders picker cards, never+charges credits. Use it when you're unsure whether a block has+required inputs, or to plan multi-step work without committing.+"""# E2B-only notes — E2B has full internet access so gh CLI works there.diff --git a/autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md b/autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.mdindex 9b37a70148..a0d6e6b1a1 100644--- a/autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md+++ b/autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md@@ -106,6 +106,14 @@ These define the agent's interface — what it accepts and what it produces.Without these blocks, the agent has no interface and the user cannot provideinputs or see outputs. NEVER skip them.+Specialized input subclasses (`AgentDropdownInputBlock`,+`AgentGoogleDriveFileInputBlock`, `AgentShortTextInputBlock`, …) satisfy+this requirement on their own — do NOT add a throwaway base+`AgentInputBlock` alongside a specialized one. Each subclass carries its+own usage guidance (when it is required, how to configure it, how to+wire it to consumers, concrete link shape) in its block and field+descriptions; read and follow those when `find_block` surfaces a match.+### Key Rules- **Name & description**: Include `name` and `description` in the agent JSONdiff --git a/autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py b/autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.pyindex dd862092d7..ef7eba9ff7 100644--- a/autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py+++ b/autogpt_platform/backend/backend/copilot/tools/agent_generator/validator.py@@ -655,34 +655,78 @@ class AgentValidator:return valid- def validate_io_blocks(self, agent: AgentDict) -> bool:+ def _collect_io_block_ids(+ self, blocks: list[dict[str, Any]]+ ) -> tuple[set[str], set[str]]:"""- Validate that the agent has at least one AgentInputBlock and one- AgentOutputBlock. These blocks define the agent's interface.+ Build sets of all input/output block IDs from the blocks registry.++ Input/output blocks are identified by ``uiType`` (populated from+ ``Block.block_type`` at registration time). Specialized subclasses+ like ``AgentGoogleDriveFileInputBlock`` count as input blocks even+ though they have their own block IDs — this matches the runtime+ behavior, where any subclass of ``AgentInputBlock`` exposes a+ user-facing input. The literal base IDs are always included so the+ function works even when called with a minimal blocks list (e.g.+ unit tests).+ """+ input_ids: set[str] = {AGENT_INPUT_BLOCK_ID}+ output_ids: set[str] = {AGENT_OUTPUT_BLOCK_ID}+ for block in blocks:+ block_id = block.get("id")+ if not block_id:+ continue+ ui_type = block.get("uiType")+ if ui_type == "Input":+ input_ids.add(block_id)+ elif ui_type == "Output":+ output_ids.add(block_id)+ return input_ids, output_ids++ def validate_io_blocks(+ self, agent: AgentDict, blocks: list[dict[str, Any]] | None = None+ ) -> bool:+ """+ Validate that the agent has at least one input block and one output+ block. These blocks define the agent's interface.++ Any block whose ``uiType`` is ``"Input"`` satisfies the input+ requirement — including specialized variants like+ ``AgentGoogleDriveFileInputBlock``, ``AgentDropdownInputBlock``,+ ``AgentTableInputBlock``, etc. The equivalent applies for outputs.+ This prevents the validator from forcing agents to keep a throwaway+ base ``AgentInputBlock`` alongside a real specialized input.Returns True if both are present, False otherwise."""valid = True- block_ids = {node.get("block_id") for node in agent.get("nodes", [])}+ input_ids, output_ids = self._collect_io_block_ids(blocks or [])+ node_block_ids = {+ node.get("block_id")+ for node in agent.get("nodes", [])+ if node.get("block_id")+ }- if AGENT_INPUT_BLOCK_ID not in block_ids:+ if not node_block_ids & input_ids:self.add_error(- f"Agent is missing an AgentInputBlock (block_id: "- f"'{AGENT_INPUT_BLOCK_ID}'). Every agent must have at "- f"least one AgentInputBlock to define user-facing inputs. "- f"Add a node with block_id '{AGENT_INPUT_BLOCK_ID}' and "- f"set input_default with 'name' and optionally 'title'."+ f"Agent is missing an input block. Every agent must have at "+ f"least one input block to define user-facing inputs. Add a "+ f"node using the base AgentInputBlock (block_id: "+ f"'{AGENT_INPUT_BLOCK_ID}') or any specialized input block "+ f"subclass (e.g. AgentGoogleDriveFileInputBlock, "+ f"AgentDropdownInputBlock, AgentShortTextInputBlock). Set "+ f"input_default with 'name' and optionally 'title'.")valid = False- if AGENT_OUTPUT_BLOCK_ID not in block_ids:+ if not node_block_ids & output_ids:self.add_error(- f"Agent is missing an AgentOutputBlock (block_id: "- f"'{AGENT_OUTPUT_BLOCK_ID}'). Every agent must have at "- f"least one AgentOutputBlock to define user-facing outputs. "- f"Add a node with block_id '{AGENT_OUTPUT_BLOCK_ID}' and "- f"set input_default with 'name', then link 'value' from "- f"another block's output."+ f"Agent is missing an output block. Every agent must have "+ f"at least one output block to define user-facing outputs. "+ f"Add a node using the base AgentOutputBlock (block_id: "+ f"'{AGENT_OUTPUT_BLOCK_ID}') or any specialized output "+ f"block subclass. Set input_default with 'name', then link "+ f"'value' from another block's output.")valid = False@@ -1114,7 +1158,7 @@ class AgentValidator:),("IO blocks",- self.validate_io_blocks(agent),+ self.validate_io_blocks(agent, blocks),),# Always validate AgentExecutorBlock schemas to prevent# frontend crashesdiff --git a/autogpt_platform/backend/backend/copilot/tools/agent_generator/validator_test.py b/autogpt_platform/backend/backend/copilot/tools/agent_generator/validator_test.pyindex 54a2ed673d..939ca521ce 100644--- a/autogpt_platform/backend/backend/copilot/tools/agent_generator/validator_test.py+++ b/autogpt_platform/backend/backend/copilot/tools/agent_generator/validator_test.py@@ -61,8 +61,9 @@ def _make_block(output_schema: dict | None = None,categories: list | None = None,static_output: bool = False,+ ui_type: str | None = None,) -> dict:- return {+ block: dict = {"id": block_id,"name": name,"inputSchema": input_schema or {"properties": {}, "required": []},@@ -70,6 +71,9 @@ def _make_block("categories": categories or [],"staticOutput": static_output,}+ if ui_type is not None:+ block["uiType"] = ui_type+ return block# ============================================================================@@ -538,6 +542,47 @@ class TestValidateIoBlocks:assert v.validate_io_blocks(agent) is Falseassert len(v.errors) == 2+ def test_subclass_input_block_satisfies_requirement(self):+ # AgentGoogleDriveFileInputBlock is a subclass of AgentInputBlock with+ # a different block_id, but it still exposes a user-facing input, so+ # it should satisfy the input-block requirement on its own.+ v = AgentValidator()+ drive_input_block = _make_block(+ block_id="d3b32f15-6fd7-40e3-be52-e083f51b19a2",+ name="AgentGoogleDriveFileInputBlock",+ ui_type="Input",+ )+ output_block = _make_block(+ block_id=AGENT_OUTPUT_BLOCK_ID,+ name="AgentOutputBlock",+ ui_type="Output",+ )+ drive_node = _make_node(block_id="d3b32f15-6fd7-40e3-be52-e083f51b19a2")+ output_node = _make_node(block_id=AGENT_OUTPUT_BLOCK_ID)+ agent = _make_agent(nodes=[drive_node, output_node])++ assert v.validate_io_blocks(agent, [drive_input_block, output_block]) is True+ assert v.errors == []++ def test_subclass_output_block_satisfies_requirement(self):+ v = AgentValidator()+ input_block = _make_block(+ block_id=AGENT_INPUT_BLOCK_ID,+ name="AgentInputBlock",+ ui_type="Input",+ )+ custom_output_block = _make_block(+ block_id="custom-output-id",+ name="CustomOutputBlock",+ ui_type="Output",+ )+ input_node = _make_node(block_id=AGENT_INPUT_BLOCK_ID)+ output_node = _make_node(block_id="custom-output-id")+ agent = _make_agent(nodes=[input_node, output_node])++ assert v.validate_io_blocks(agent, [input_block, custom_output_block]) is True+ assert v.errors == []+# ============================================================================# validate (integration)diff --git a/autogpt_platform/backend/backend/copilot/tools/helpers.py b/autogpt_platform/backend/backend/copilot/tools/helpers.pyindex 9de94cb2f2..dc418818a2 100644--- a/autogpt_platform/backend/backend/copilot/tools/helpers.py+++ b/autogpt_platform/backend/backend/copilot/tools/helpers.py@@ -23,6 +23,10 @@ from backend.data.credit import UsageTransactionMetadatafrom backend.data.db_accessors import credit_db, review_db, workspace_dbfrom backend.data.execution import ExecutionContextfrom backend.data.model import CredentialsFieldInfo, CredentialsMetaInput+from backend.executor.auto_credentials import (+ MissingAutoCredentialsError,+ acquire_auto_credentials,+)from backend.executor.simulator import simulate_blockfrom backend.executor.utils import block_usage_costfrom backend.integrations.creds_manager import IntegrationCredentialsManager@@ -72,7 +76,12 @@ def get_inputs_from_schema(for name, schema in properties.items():if name in exclude:continue+ # Pass the schema through verbatim so the frontend's generic custom+ # field dispatch (keyed on `format` / json_schema_extra) gets every+ # hint it needs — any block-specific whitelist here would silently+ # downgrade new picker/widget formats to plain text inputs.entry: dict[str, Any] = {+ **schema,"name": name,"title": schema.get("title", name),"type": schema.get("type", "string"),@@ -261,115 +270,175 @@ async def execute_block(session_id=session_id,)- # Coerce non-matching data types to the expected input schema.- coerce_inputs_to_schema(input_data, block.input_schema)-- # Pre-execution credit check (courtesy; spend_credits is atomic)- cost, cost_filter = block_usage_cost(block, input_data)- has_cost = cost > 0- _credit_db = credit_db()- if has_cost:- balance = await _credit_db.get_credits(user_id)- if balance < cost:- return ErrorResponse(- message=(- f"Insufficient credits to run '{block.name}'. "- "Please top up your credits to continue."+ # Auto-credentials (picker-populated fields like GoogleDriveFileField).+ # If the picker hasn't been filled, surface the existing setup-card so+ # the user can pick inline via FormRenderer's google-drive-picker; the+ # LLM re-invokes this tool once input_data carries `_credentials_id`.+ auto_locks: list[Any] = []+ try:+ auto_extra_kwargs, auto_locks = await acquire_auto_credentials(+ input_model=block.input_schema,+ input_data=input_data,+ creds_manager=creds_manager,+ user_id=user_id,+ )+ except MissingAutoCredentialsError as e:+ input_schema = block.input_schema.jsonschema()+ credentials_fields = set(block.input_schema.get_credentials_fields().keys())+ return SetupRequirementsResponse(+ message=str(e),+ session_id=session_id,+ setup_info=SetupInfo(+ agent_id=block_id,+ agent_name=block.name,+ user_readiness=UserReadiness(+ has_all_credentials=True,+ missing_credentials={},+ ready_to_run=False,),- session_id=session_id,- )+ requirements={+ "credentials": [],+ "inputs": get_inputs_from_schema(+ input_schema,+ exclude_fields=credentials_fields,+ input_data=input_data,+ ),+ "execution_modes": ["immediate"],+ },+ ),+ graph_id=None,+ graph_version=None,+ )+ except ValueError as e:+ return ErrorResponse(message=str(e), error=str(e), session_id=session_id)- # Execute the block under the shared MCP wait cap. A block is- # expected to finish in MAX_TOOL_WAIT_SECONDS; if it doesn't, the- # MCP handler would block the stream close to the idle timeout.- # wait_for cancels the generator on timeout, but the finally below- # still settles billing via asyncio.shield — external side effects- # may already have landed and the user should be charged for them.- outputs: dict[str, list[Any]] = defaultdict(list)- charge_handled = False+ # Everything from here owns the auto-cred locks; wrap so any early+ # return / exception (coerce, credit check, execution, etc.) still+ # releases them. Previously a raise between the acquire and the+ # inner wait_for try could strand locks until Redis TTL.try:- await asyncio.wait_for(- _collect_block_outputs(block, input_data, exec_kwargs, outputs),- timeout=MAX_TOOL_WAIT_SECONDS,- )+ exec_kwargs.update(auto_extra_kwargs)- # Normal (non-cancelled) path. Mark charge_handled BEFORE the- # await so an outer cancellation landing mid-charge can't race- # the finally block into a double-charge. asyncio.shield keeps- # the spend running to completion even if the outer awaitable- # is cancelled.+ # Coerce non-matching data types to the expected input schema.+ coerce_inputs_to_schema(input_data, block.input_schema)++ # Pre-execution credit check (courtesy; spend_credits is atomic)+ cost, cost_filter = block_usage_cost(block, input_data)+ has_cost = cost > 0+ _credit_db = credit_db()if has_cost:- charge_handled = True- await asyncio.shield(- _charge_block_credits(- _credit_db,- user_id=user_id,- block_name=block.name,- block_id=block_id,- node_exec_id=node_exec_id,- cost=cost,- cost_filter=cost_filter,- synthetic_graph_id=synthetic_graph_id,- synthetic_node_id=synthetic_node_id,+ balance = await _credit_db.get_credits(user_id)+ if balance < cost:+ return ErrorResponse(+ message=(+ f"Insufficient credits to run '{block.name}'. "+ "Please top up your credits to continue."+ ),+ session_id=session_id,)++ # Execute the block under the shared MCP wait cap. A block is+ # expected to finish in MAX_TOOL_WAIT_SECONDS; if it doesn't, the+ # MCP handler would block the stream close to the idle timeout.+ # wait_for cancels the generator on timeout, but the finally below+ # still settles billing via asyncio.shield — external side effects+ # may already have landed and the user should be charged for them.+ outputs: dict[str, list[Any]] = defaultdict(list)+ charge_handled = False+ try:+ await asyncio.wait_for(+ _collect_block_outputs(block, input_data, exec_kwargs, outputs),+ timeout=MAX_TOOL_WAIT_SECONDS,)- return BlockOutputResponse(- message=f"Block '{block.name}' executed successfully",- block_id=block_id,- block_name=block.name,- outputs=dict(outputs),- success=True,- session_id=session_id,- )- except asyncio.TimeoutError:- # Structured record of tool-call timeouts (SECRT-2247 part 3).- # Grep prod logs for `copilot_tool_timeout` to find tools that- # keep hitting the cap — candidates for prompt tuning or- # escalation to the async start+poll pattern.- logger.warning(- "copilot_tool_timeout tool=run_block block=%s block_id=%s "- "input_keys=%s user=%s session=%s cap_s=%d",- block.name,- block_id,- sorted(input_data.keys()),- user_id,- session_id,- MAX_TOOL_WAIT_SECONDS,- )- return ErrorResponse(- message=(- f"Block '{block.name}' exceeded the "- f"{MAX_TOOL_WAIT_SECONDS}s single-tool wait cap and was "- "cancelled. Long-running work should go through run_agent "- "(graph executions) or run_sub_session (sub-AutoPilot "- "tasks) — those use async start+poll so nothing blocks "- "the chat stream."- ),- session_id=session_id,- )- finally:- # Sentry r3105079148: asyncio.wait_for raises CancelledError into- # the generator. Normal `except Exception` doesn't catch it, so- # without this finally a cancelled block would skip credit- # charging entirely while external side effects still landed.- # Only run when the normal-path charge was NOT reached (the flag- # is set before the await, so any cancellation during charge still- # sets it and avoids double-billing — r3105216985).- if has_cost and outputs and not charge_handled:- await asyncio.shield(- _charge_block_credits(- _credit_db,- user_id=user_id,- block_name=block.name,- block_id=block_id,- node_exec_id=node_exec_id,- cost=cost,- cost_filter=cost_filter,- synthetic_graph_id=synthetic_graph_id,- synthetic_node_id=synthetic_node_id,+ # Normal (non-cancelled) path. Mark charge_handled BEFORE the+ # await so an outer cancellation landing mid-charge can't race+ # the finally block into a double-charge. asyncio.shield keeps+ # the spend running to completion even if the outer awaitable+ # is cancelled.+ if has_cost:+ charge_handled = True+ await asyncio.shield(+ _charge_block_credits(+ _credit_db,+ user_id=user_id,+ block_name=block.name,+ block_id=block_id,+ node_exec_id=node_exec_id,+ cost=cost,+ cost_filter=cost_filter,+ synthetic_graph_id=synthetic_graph_id,+ synthetic_node_id=synthetic_node_id,+ ))++ return BlockOutputResponse(+ message=f"Block '{block.name}' executed successfully",+ block_id=block_id,+ block_name=block.name,+ outputs=dict(outputs),+ success=True,+ session_id=session_id,+ )+ except asyncio.TimeoutError:+ # Structured record of tool-call timeouts (SECRT-2247 part 3).+ # Grep prod logs for `copilot_tool_timeout` to find tools that+ # keep hitting the cap — candidates for prompt tuning or+ # escalation to the async start+poll pattern.+ logger.warning(+ "copilot_tool_timeout tool=run_block block=%s block_id=%s "+ "input_keys=%s user=%s session=%s cap_s=%d",+ block.name,+ block_id,+ sorted(input_data.keys()),+ user_id,+ session_id,+ MAX_TOOL_WAIT_SECONDS,)+ return ErrorResponse(+ message=(+ f"Block '{block.name}' exceeded the "+ f"{MAX_TOOL_WAIT_SECONDS}s single-tool wait cap and "+ "was cancelled. Long-running work should go through "+ "run_agent (graph executions) or run_sub_session "+ "(sub-AutoPilot tasks) — those use async start+poll "+ "so nothing blocks the chat stream."+ ),+ session_id=session_id,+ )+ finally:+ # Sentry r3105079148: asyncio.wait_for raises CancelledError+ # into the generator. Normal `except Exception` doesn't catch+ # it, so without this finally a cancelled block would skip+ # credit charging entirely while external side effects still+ # landed. Only run when the normal-path charge was NOT+ # reached (the flag is set before the await, so any+ # cancellation during charge still sets it and avoids+ # double-billing — r3105216985).+ if has_cost and outputs and not charge_handled:+ await asyncio.shield(+ _charge_block_credits(+ _credit_db,+ user_id=user_id,+ block_name=block.name,+ block_id=block_id,+ node_exec_id=node_exec_id,+ cost=cost,+ cost_filter=cost_filter,+ synthetic_graph_id=synthetic_graph_id,+ synthetic_node_id=synthetic_node_id,+ )+ )+ finally:+ # Release auto-cred locks on every exit path so Redis doesn't hold them until TTL.+ for lock in auto_locks:+ try:+ await lock.release()+ except Exception as release_exc:+ logger.warning(+ "Failed to release auto-credential lock: %s",+ release_exc,+ )except BlockError as e:logger.warning("Block execution failed: %s", e)@@ -466,6 +535,7 @@ async def prepare_block_for_execution(session: ChatSession,session_id: str,dry_run: bool,+ validate_only: bool = False,) -> "BlockPreparation | ToolResponseBase":"""Validate and prepare a block for execution.@@ -552,24 +622,57 @@ 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+ provided_input_keys = set(input_data.keys()) - credentials_fields- if missing_credentials and not dry_run:+ # Picker-backed required fields that the caller hasn't filled surface the+ # same setup card as missing OAuth credentials — the frontend renders+ # the picker inline via FormRenderer's custom-field dispatch. Detecting+ # it here (instead of only inside execute_block's auto-creds layer)+ # saves a round trip when the caller omitted the field entirely.+ picker_fields_missing = [+ f+ for f in required_non_credential_keys - provided_input_keys+ if isinstance(input_schema.get("properties", {}).get(f), dict)+ and (+ input_schema["properties"][f].get("format") == "google-drive-picker"+ or "auto_credentials" in input_schema["properties"][f]+ )+ ]++ # validate_only suppresses the setup-card early-return — the caller is+ # doing static introspection, rendering a picker would violate the+ # documented no-side-effects contract of that mode.+ if (missing_credentials or picker_fields_missing) and not (+ dry_run or validate_only+ ):credentials_fields_info = _resolve_discriminated_credentials(block, input_data)missing_creds_dict = build_missing_credentials_from_field_info(credentials_fields_info, set(matched_credentials.keys()))missing_creds_list = list(missing_creds_dict.values())+ if missing_credentials:+ message = (+ f"Block '{block.name}' requires credentials that are not "+ "configured. Please set up the required credentials before "+ "running this block."+ )+ else:+ message = (+ f"Block '{block.name}' needs "+ f"{', '.join(repr(f) for f in picker_fields_missing)} "+ "picked before it can run. Select in the card below; the "+ "tool will re-run automatically."+ )return SetupRequirementsResponse(- message=(- f"Block '{block.name}' requires credentials that are not configured. "- "Please set up the required credentials before running this block."- ),+ message=message,session_id=session_id,setup_info=SetupInfo(agent_id=block_id,agent_name=block.name,user_readiness=UserReadiness(- has_all_credentials=False,+ has_all_credentials=not missing_credentials,missing_credentials=missing_creds_dict,ready_to_run=False,),@@ -586,9 +689,6 @@ async def prepare_block_for_execution(graph_id=None,graph_version=None,)- required_keys = set(input_schema.get("required", []))- required_non_credential_keys = required_keys - credentials_fields- provided_input_keys = set(input_data.keys()) - credentials_fieldsvalid_fields = set(input_schema.get("properties", {}).keys()) - credentials_fieldsunrecognized_fields = provided_input_keys - valid_fieldsdiff --git a/autogpt_platform/backend/backend/copilot/tools/helpers_test.py b/autogpt_platform/backend/backend/copilot/tools/helpers_test.pyindex ee513e22ef..d25420bf03 100644--- a/autogpt_platform/backend/backend/copilot/tools/helpers_test.py+++ b/autogpt_platform/backend/backend/copilot/tools/helpers_test.py@@ -1035,3 +1035,293 @@ async def test_prepare_block_file_ref_expansion_error() -> None:)assert isinstance(result, ErrorResponse)assert "file reference" in result.message.lower()+++# ---------------------------------------------------------------------------+# Auto-credentials (Google Drive picker) regression tests for execute_block+# ---------------------------------------------------------------------------+++def _make_block_with_auto_creds(+ field_name: str = "spreadsheet",+ kwarg_name: str = "credentials",+ provider: str = "google",+):+ """Mock block exposing one auto_credentials field (Drive picker style)."""+ block = _make_block(block_id="drive-consumer", name="DriveConsumer")+ block.input_schema.get_auto_credentials_fields = MagicMock(+ return_value={+ kwarg_name: {+ "field_name": field_name,+ "config": {+ "provider": provider,+ "type": "oauth2",+ "scopes": ["https://www.googleapis.com/auth/drive.file"],+ },+ }+ }+ )+ block.input_schema.get_credentials_fields = MagicMock(return_value={})+ block.input_schema.jsonschema = MagicMock(+ return_value={+ "type": "object",+ "properties": {+ field_name: {+ "type": "object",+ "title": "Spreadsheet",+ "format": "google-drive-picker",+ "google_drive_picker_config": {+ "multiselect": False,+ "allowed_views": ["SPREADSHEETS"],+ },+ },+ "range": {"type": "string", "title": "Range"},+ },+ "required": [field_name],+ }+ )+ return block++[email protected](loop_scope="session")+class TestExecuteBlockAutoCredentials:+ async def test_happy_path_resolves_picker_credentials(self):+ """Drive file with valid _credentials_id → block executes with creds injected."""+ block = _make_block_with_auto_creds()+ credit_patch, _mock_credit = _patch_credit_db()+ mock_creds = MagicMock(id="cred-id-123", provider="google")+ mock_lock = AsyncMock()+ creds_manager_cls = MagicMock()+ creds_manager_cls.return_value.acquire = AsyncMock(+ return_value=(mock_creds, mock_lock)+ )+ creds_manager_cls.return_value.get = AsyncMock(return_value=None)++ with (+ _patch_workspace(),+ credit_patch,+ patch(+ "backend.copilot.tools.helpers.IntegrationCredentialsManager",+ creds_manager_cls,+ ),+ ):+ result = await execute_block(+ block=block,+ block_id="drive-consumer",+ input_data={+ "spreadsheet": {+ "_credentials_id": "cred-id-123",+ "id": "file-1",+ "name": "Test.xlsx",+ "mimeType": "application/vnd.google-apps.spreadsheet",+ },+ "range": "A1:C10",+ },+ user_id=_USER,+ session_id=_SESSION,+ node_exec_id="exec-drive-1",+ matched_credentials={},+ dry_run=False,+ )++ assert isinstance(result, BlockOutputResponse)+ assert result.success is True+ creds_manager_cls.return_value.acquire.assert_awaited_once_with(+ _USER, "cred-id-123"+ )+ mock_lock.release.assert_awaited_once()++ async def test_missing_credentials_id_returns_setup_requirements(self):+ """Drive field without _credentials_id → SetupRequirementsResponse+ surfacing the picker field to the frontend."""+ block = _make_block_with_auto_creds()+ credit_patch, _ = _patch_credit_db()++ with (+ _patch_workspace(),+ credit_patch,+ ):+ result = await execute_block(+ block=block,+ block_id="drive-consumer",+ input_data={+ "spreadsheet": {+ "id": "file-1",+ "name": "Test.xlsx",+ "mimeType": "application/vnd.google-apps.spreadsheet",+ },+ "range": "A1:C10",+ },+ user_id=_USER,+ session_id=_SESSION,+ node_exec_id="exec-drive-2",+ matched_credentials={},+ dry_run=False,+ )++ assert isinstance(result, SetupRequirementsResponse)+ inputs = result.setup_info.requirements["inputs"]+ picker_field = next((i for i in inputs if i["name"] == "spreadsheet"), None)+ assert picker_field is not None+ assert picker_field["format"] == "google-drive-picker"+ assert "google_drive_picker_config" in picker_field++ async def test_chained_none_credentials_id_skips_acquisition(self):+ """_credentials_id=None (upstream-chained) → skip acquire, execute anyway."""+ block = _make_block_with_auto_creds()+ credit_patch, _ = _patch_credit_db()+ creds_manager_cls = MagicMock()+ creds_manager_cls.return_value.acquire = AsyncMock()+ creds_manager_cls.return_value.get = AsyncMock(return_value=None)++ with (+ _patch_workspace(),+ credit_patch,+ patch(+ "backend.copilot.tools.helpers.IntegrationCredentialsManager",+ creds_manager_cls,+ ),+ ):+ result = await execute_block(+ block=block,+ block_id="drive-consumer",+ input_data={+ "spreadsheet": {+ "_credentials_id": None,+ "id": "file-1",+ "name": "Test.xlsx",+ "mimeType": "application/vnd.google-apps.spreadsheet",+ },+ "range": "A1:C10",+ },+ user_id=_USER,+ session_id=_SESSION,+ node_exec_id="exec-drive-3",+ matched_credentials={},+ dry_run=False,+ )++ assert isinstance(result, BlockOutputResponse)+ creds_manager_cls.return_value.acquire.assert_not_awaited()++ async def test_no_file_selected_returns_setup_requirements(self):+ """Drive field provided as None → SetupRequirementsResponse."""+ block = _make_block_with_auto_creds()+ credit_patch, _ = _patch_credit_db()++ with (+ _patch_workspace(),+ credit_patch,+ ):+ result = await execute_block(+ block=block,+ block_id="drive-consumer",+ input_data={"spreadsheet": None, "range": "A1:C10"},+ user_id=_USER,+ session_id=_SESSION,+ node_exec_id="exec-drive-4",+ matched_credentials={},+ dry_run=False,+ )++ assert isinstance(result, SetupRequirementsResponse)+ assert result.setup_info.user_readiness.ready_to_run is False++ async def test_auto_cred_locks_released_when_coerce_raises(self):+ """Regression guard for Sentry r3135420231: if coerce_inputs_to_schema+ raises between acquire_auto_credentials and the inner wait_for try,+ the auto-cred locks must still be released."""+ block = _make_block_with_auto_creds()+ credit_patch, _ = _patch_credit_db()+ mock_creds = MagicMock(id="cred-id-123", provider="google")+ mock_lock = AsyncMock()+ creds_manager_cls = MagicMock()+ creds_manager_cls.return_value.acquire = AsyncMock(+ return_value=(mock_creds, mock_lock)+ )+ creds_manager_cls.return_value.get = AsyncMock(return_value=None)++ with (+ _patch_workspace(),+ credit_patch,+ patch(+ "backend.copilot.tools.helpers.IntegrationCredentialsManager",+ creds_manager_cls,+ ),+ patch(+ "backend.copilot.tools.helpers.coerce_inputs_to_schema",+ side_effect=RuntimeError("boom during coerce"),+ ),+ ):+ result = await execute_block(+ block=block,+ block_id="drive-consumer",+ input_data={+ "spreadsheet": {+ "_credentials_id": "cred-id-123",+ "id": "file-1",+ "name": "Test.xlsx",+ "mimeType": "application/vnd.google-apps.spreadsheet",+ },+ "range": "A1:C10",+ },+ user_id=_USER,+ session_id=_SESSION,+ node_exec_id="exec-drive-5",+ matched_credentials={},+ dry_run=False,+ )++ # Exception propagates to the outer ErrorResponse path, but the lock+ # must have been released on the way out (not stranded in Redis).+ assert isinstance(result, ErrorResponse)+ mock_lock.release.assert_awaited_once()++ async def test_auto_cred_locks_released_on_insufficient_credits(self):+ """Early-return from the credit-balance check must still release+ auto-cred locks (same r3135420231 surface, different trigger)."""+ block = _make_block_with_auto_creds()+ # balance < cost → early return ErrorResponse+ credit_patch, _ = _patch_credit_db(get_credits_return=0)+ mock_creds = MagicMock(id="cred-id-123", provider="google")+ mock_lock = AsyncMock()+ creds_manager_cls = MagicMock()+ creds_manager_cls.return_value.acquire = AsyncMock(+ return_value=(mock_creds, mock_lock)+ )+ creds_manager_cls.return_value.get = AsyncMock(return_value=None)++ with (+ _patch_workspace(),+ credit_patch,+ patch(+ "backend.copilot.tools.helpers.IntegrationCredentialsManager",+ creds_manager_cls,+ ),+ patch(+ "backend.copilot.tools.helpers.block_usage_cost",+ return_value=(10, {}),+ ),+ ):+ result = await execute_block(+ block=block,+ block_id="drive-consumer",+ input_data={+ "spreadsheet": {+ "_credentials_id": "cred-id-123",+ "id": "file-1",+ "name": "Test.xlsx",+ "mimeType": "application/vnd.google-apps.spreadsheet",+ },+ "range": "A1:C10",+ },+ user_id=_USER,+ session_id=_SESSION,+ node_exec_id="exec-drive-6",+ matched_credentials={},+ dry_run=False,+ )++ assert isinstance(result, ErrorResponse)+ assert "Insufficient credits" in result.message+ mock_lock.release.assert_awaited_once()diff --git a/autogpt_platform/backend/backend/copilot/tools/run_block.py b/autogpt_platform/backend/backend/copilot/tools/run_block.pyindex 070486b376..63f860852d 100644--- a/autogpt_platform/backend/backend/copilot/tools/run_block.py+++ b/autogpt_platform/backend/backend/copilot/tools/run_block.py@@ -33,6 +33,8 @@ class RunBlockTool(BaseTool):"Execute a block. IMPORTANT: Always get block_id from find_block first ""— do NOT guess or fabricate IDs. ""Call with empty input_data to see schema, then with data to execute. "+ "Pass `validate_only: true` to inspect a block without running it "+ "(safe pre-flight — returns schema + detected missing inputs). ""If review_required, use continue_run_block.")@@ -49,6 +51,18 @@ class RunBlockTool(BaseTool):"type": "object","description": "Input values. Use {} first to see schema.",},+ "validate_only": {+ "type": "boolean",+ "description": (+ "If true, describe what the block would do without "+ "executing it or rendering any picker cards. Use this "+ "as a safe pre-flight for blocks with no required "+ "inputs (where empty input_data would otherwise "+ "execute immediately) or to check what a call "+ "_would_ need before committing."+ ),+ "default": False,+ },},"required": ["block_id", "input_data"],}@@ -64,6 +78,7 @@ class RunBlockTool(BaseTool):*,block_id: str = "",input_data: dict | None = None,+ validate_only: bool = False,**kwargs, # dry_run is intentionally not accepted; read from session.dry_run) -> ToolResponseBase:"""Execute a block with the given input data.@@ -113,6 +128,7 @@ class RunBlockTool(BaseTool):session=session,session_id=session_id,dry_run=dry_run,+ validate_only=validate_only,)if isinstance(prep_or_err, ToolResponseBase):return prep_or_err@@ -160,10 +176,14 @@ class RunBlockTool(BaseTool):dry_run=True,)- # Show block details when required inputs are not yet provided.- # This is run_block's two-step UX: first call returns the schema,- # second call (with inputs) actually executes.- if not (prep.required_non_credential_keys <= prep.provided_input_keys):+ # Show block details when required inputs are not yet provided+ # (two-step UX: first call returns the schema, second call actually+ # executes) or when the caller asked for introspection only via+ # validate_only — in both cases we return BlockDetailsResponse and+ # do not execute.+ if validate_only or not (+ prep.required_non_credential_keys <= prep.provided_input_keys+ ):try:output_schema: dict[str, Any] = prep.block.output_schema.jsonschema()except Exception as e:@@ -177,11 +197,26 @@ class RunBlockTool(BaseTool):)credentials_meta = list(prep.matched_credentials.values())+ missing = sorted(+ prep.required_non_credential_keys - prep.provided_input_keys+ )+ if validate_only and not missing:+ detail_msg = (+ f"Block '{prep.block.name}' — all required inputs "+ f"provided, ready to run."+ )+ elif missing:+ detail_msg = (+ f"Block '{prep.block.name}' — missing required input(s): "+ f"{', '.join(repr(m) for m in missing)}."+ )+ else:+ detail_msg = (+ f"Block '{prep.block.name}' details. Provide input_data "+ f"matching the inputs schema to execute the block."+ )return BlockDetailsResponse(- message=(- f"Block '{prep.block.name}' details. "- "Provide input_data matching the inputs schema to execute the block."- ),+ message=detail_msg,session_id=session_id,block=BlockDetails(id=block_id,diff --git a/autogpt_platform/backend/backend/copilot/tools/run_block_test.py b/autogpt_platform/backend/backend/copilot/tools/run_block_test.pyindex 7fbf1f0b34..c902db6b55 100644--- a/autogpt_platform/backend/backend/copilot/tools/run_block_test.py+++ b/autogpt_platform/backend/backend/copilot/tools/run_block_test.py@@ -479,6 +479,190 @@ class TestRunBlockInputValidation:assert isinstance(response, BlockDetailsResponse)+ @pytest.mark.asyncio(loop_scope="session")+ async def test_validate_only_returns_block_details_without_executing(self):+ """validate_only=True returns BlockDetailsResponse and never calls execute."""+ session = make_session(user_id=_TEST_USER_ID)++ # Block with zero required fields — would normally execute on {}.+ mock_block = make_mock_block_with_schema(+ block_id="noop-id",+ name="Noop",+ input_properties={"optional": {"type": "string"}},+ required_fields=[],+ )++ with (+ patch(+ "backend.copilot.tools.helpers.get_block",+ return_value=mock_block,+ ),+ patch(+ "backend.copilot.tools.helpers.match_credentials_to_requirements",+ return_value=({}, []),+ ),+ patch(+ "backend.copilot.tools.run_block.execute_block",+ new_callable=AsyncMock,+ ) as mock_exec,+ ):+ tool = RunBlockTool()+ response = await tool._execute(+ user_id=_TEST_USER_ID,+ session=session,+ block_id="noop-id",+ input_data={},+ validate_only=True,+ )++ assert isinstance(response, BlockDetailsResponse)+ assert "all required inputs provided" in response.message+ mock_exec.assert_not_awaited()++ @pytest.mark.asyncio(loop_scope="session")+ async def test_validate_only_reports_missing_required(self):+ """validate_only surfaces missing required fields without executing."""+ session = make_session(user_id=_TEST_USER_ID)++ mock_block = make_mock_block_with_schema(+ block_id="needs-prompt-id",+ name="AI Gen",+ input_properties={"prompt": {"type": "string"}},+ required_fields=["prompt"],+ )++ with (+ patch(+ "backend.copilot.tools.helpers.get_block",+ return_value=mock_block,+ ),+ patch(+ "backend.copilot.tools.helpers.match_credentials_to_requirements",+ return_value=({}, []),+ ),+ patch(+ "backend.copilot.tools.run_block.execute_block",+ new_callable=AsyncMock,+ ) as mock_exec,+ ):+ tool = RunBlockTool()+ response = await tool._execute(+ user_id=_TEST_USER_ID,+ session=session,+ block_id="needs-prompt-id",+ input_data={},+ validate_only=True,+ )++ assert isinstance(response, BlockDetailsResponse)+ assert "'prompt'" in response.message+ mock_exec.assert_not_awaited()++ @pytest.mark.asyncio(loop_scope="session")+ async def test_validate_only_bypasses_picker_setup_card(self):+ """Regression guard for Sentry r3135709745: validate_only=True on a+ block with missing picker-backed required fields must NOT return a+ SetupRequirementsResponse (that would render the picker, violating+ the no-side-effects contract). BlockDetailsResponse instead."""+ session = make_session(user_id=_TEST_USER_ID)++ mock_block = make_mock_block_with_schema(+ block_id="sheets-read-id",+ name="Google Sheets Read",+ input_properties={+ "spreadsheet": {+ "type": "object",+ "format": "google-drive-picker",+ "auto_credentials": {"provider": "google"},+ },+ "range": {"type": "string"},+ },+ required_fields=["spreadsheet", "range"],+ )++ with (+ patch(+ "backend.copilot.tools.helpers.get_block",+ return_value=mock_block,+ ),+ patch(+ "backend.copilot.tools.helpers.match_credentials_to_requirements",+ return_value=({}, []),+ ),+ patch(+ "backend.copilot.tools.run_block.execute_block",+ new_callable=AsyncMock,+ ) as mock_exec,+ ):+ tool = RunBlockTool()+ response = await tool._execute(+ user_id=_TEST_USER_ID,+ session=session,+ block_id="sheets-read-id",+ input_data={"range": "Sheet1!A1:Z100"},+ validate_only=True,+ )++ from .models import SetupRequirementsResponse++ assert not isinstance(response, SetupRequirementsResponse)+ assert isinstance(response, BlockDetailsResponse)+ assert "'spreadsheet'" in response.message+ mock_exec.assert_not_awaited()++ @pytest.mark.asyncio(loop_scope="session")+ async def test_missing_picker_field_returns_setup_requirements(self):+ """When a missing required field is picker-backed, skip the schema+ preview and return SetupRequirementsResponse directly so the+ frontend renders the picker inline."""+ from .models import SetupRequirementsResponse++ session = make_session(user_id=_TEST_USER_ID)++ mock_block = make_mock_block_with_schema(+ block_id="sheets-read-id",+ name="Google Sheets Read",+ input_properties={+ "spreadsheet": {+ "type": "object",+ "format": "google-drive-picker",+ "google_drive_picker_config": {+ "allowed_views": ["SPREADSHEETS"],+ },+ "auto_credentials": {"provider": "google"},+ },+ "range": {"type": "string"},+ },+ required_fields=["spreadsheet", "range"],+ )++ with (+ patch(+ "backend.copilot.tools.helpers.get_block",+ return_value=mock_block,+ ),+ patch(+ "backend.copilot.tools.helpers.match_credentials_to_requirements",+ return_value=({}, []),+ ),+ ):+ tool = RunBlockTool()++ response = await tool._execute(+ user_id=_TEST_USER_ID,+ session=session,+ block_id="sheets-read-id",+ input_data={"range": "Sheet1!A1:Z100"},+ dry_run=False,+ )++ assert isinstance(response, SetupRequirementsResponse)+ assert "'spreadsheet'" in response.message+ inputs = response.setup_info.requirements["inputs"]+ picker_field = next((i for i in inputs if i["name"] == "spreadsheet"), None)+ assert picker_field is not None+ assert picker_field["format"] == "google-drive-picker"+class TestRunBlockSensitiveAction:"""Tests for sensitive action HITL review in RunBlockTool.diff --git a/autogpt_platform/backend/backend/executor/auto_credentials.py b/autogpt_platform/backend/backend/executor/auto_credentials.pynew file mode 100644index 0000000000..f94c671a63--- /dev/null+++ b/autogpt_platform/backend/backend/executor/auto_credentials.py@@ -0,0 +1,129 @@+"""Auto-credential resolution for picker-style block inputs (e.g. Google Drive).++Shared between the graph executor (``backend/executor/manager.py``) and the+CoPilot direct-block-execution path (``backend/copilot/tools/helpers.py``)+so both handle ``_credentials_id`` payloads identically.+"""++import logging+from typing import Any++from redis.asyncio.lock import Lock as AsyncRedisLock++from backend.blocks._base import BlockSchema+from backend.integrations.creds_manager import IntegrationCredentialsManager++logger = logging.getLogger(__name__)+++class MissingAutoCredentialsError(ValueError):+ """Raised when a picker-style field lacks a usable ``_credentials_id``.++ Distinct from generic ``ValueError`` so callers (e.g. the CoPilot+ run_block path) can branch on "needs picker interaction" and return a+ structured response instead of a bare error.+ """+++async def acquire_auto_credentials(+ input_model: type[BlockSchema],+ input_data: dict[str, Any],+ creds_manager: IntegrationCredentialsManager,+ user_id: str,+) -> tuple[dict[str, Any], list[AsyncRedisLock]]:+ """Resolve ``auto_credentials`` from ``GoogleDriveFileField``-style inputs.++ Returns:+ (extra_exec_kwargs, locks): kwargs to inject into block execution,+ and credential locks to release after execution completes.++ Raises:+ MissingAutoCredentialsError: when a field is missing or lacks a+ ``_credentials_id``. Caller can decide whether to surface a+ picker UI or fail outright.+ ValueError: for other validation failures (invalid cred id, etc.).+ """+ extra_exec_kwargs: dict[str, Any] = {}+ locks: list[AsyncRedisLock] = []++ try:+ for kwarg_name, info in input_model.get_auto_credentials_fields().items():+ field_name = info["field_name"]+ provider = info.get("config", {}).get("provider", "external service")+ field_data = input_data.get(field_name)++ if field_data and isinstance(field_data, dict):+ if "_credentials_id" in field_data:+ cred_id = field_data["_credentials_id"]+ if cred_id is None:+ # Explicitly None means the value is being chained in+ # at execution time from an upstream block — skip.+ continue+ if not isinstance(cred_id, str) or not cred_id.strip():+ file_name = field_data.get("name", "selected file")+ raise ValueError(+ f"{provider.capitalize()} credential id for "+ f"'{file_name}' in field '{field_name}' is empty "+ f"or invalid. Please open the agent in the "+ f"builder and re-select the file."+ )+ file_name = field_data.get("name", "selected file")+ try:+ credentials, lock = await creds_manager.acquire(+ user_id, cred_id+ )+ locks.append(lock)+ extra_exec_kwargs[kwarg_name] = credentials+ except ValueError:+ raise ValueError(+ f"{provider.capitalize()} credentials for "+ f"'{file_name}' in field '{field_name}' are not "+ f"available in your account. "+ f"This can happen if the agent was created by "+ f"another user or the credentials were deleted. "+ f"Please open the agent in the builder and "+ f"re-select the file to authenticate with your "+ f"own account."+ )+ else:+ file_name = field_data.get("name", "selected file")+ raise MissingAutoCredentialsError(+ f"Authentication missing for '{file_name}' in field "+ f"'{field_name}'. The CoPilot chat will render the "+ f"{provider.capitalize()} picker inline — pick the "+ f"file there; re-invoking `run_block` with a bare "+ f"id/URL will not authenticate."+ )+ elif field_data is None and field_name not in input_data:+ # Field not in input_data at all = connected from upstream, skip+ pass+ elif field_data is None or field_data == "":+ raise MissingAutoCredentialsError(+ f"No file selected for '{field_name}'. The CoPilot chat "+ f"will render the {provider.capitalize()} picker inline "+ f"— pick the file there; `run_block` will re-run "+ f"automatically with the populated value."+ )+ else:+ raise ValueError(+ f"Invalid {type(field_data).__name__} value for "+ f"'{field_name}': this field expects a picker-populated "+ f"object carrying the user's credentials, not a bare "+ f"value. Please re-select the file via the picker to "+ f"provide {provider.capitalize()} authentication."+ )+ except BaseException:+ # Release any locks already acquired so failures on later fields+ # don't strand earlier credentials until Redis TTL expires them.+ for lock in locks:+ try:+ await lock.release()+ except Exception as release_exc:+ logger.warning(+ "Failed to release auto-credential lock after "+ "acquisition error: %s",+ release_exc,+ )+ raise++ return extra_exec_kwargs, locksdiff --git a/autogpt_platform/backend/backend/executor/manager.py b/autogpt_platform/backend/backend/executor/manager.pyindex ba3dc49eb6..3ed5dcf1db 100644--- a/autogpt_platform/backend/backend/executor/manager.py+++ b/autogpt_platform/backend/backend/executor/manager.py@@ -75,6 +75,7 @@ from backend.util.settings import Settingsfrom . import billingfrom .activity_status_generator import generate_activity_status_for_execution+from .auto_credentials import acquire_auto_credentialsfrom .automod.manager import automod_managerfrom .cluster_lock import ClusterLockfrom .simulator import get_dry_run_credentials, prepare_dry_run, simulate_block@@ -138,123 +139,6 @@ def execute_graph(T = TypeVar("T")-async def _acquire_auto_credentials(- input_model: type[BlockSchema],- input_data: dict[str, Any],- creds_manager: "IntegrationCredentialsManager",- user_id: str,-) -> tuple[dict[str, Any], list[AsyncRedisLock]]:- """- Resolve auto_credentials from GoogleDriveFileField-style inputs.-- Returns:- (extra_exec_kwargs, locks): kwargs to inject into block execution, and- credential locks to release after execution completes.- """- extra_exec_kwargs: dict[str, Any] = {}- locks: list[AsyncRedisLock] = []-- try:- for kwarg_name, info in input_model.get_auto_credentials_fields().items():- field_name = info["field_name"]- field_data = input_data.get(field_name)-- if field_data and isinstance(field_data, dict):- # Check if _credentials_id key exists in the field data- if "_credentials_id" in field_data:- cred_id = field_data["_credentials_id"]- if cred_id is None:- # Explicitly None means the value is being chained in- # at execution time from an upstream block — skip.- continue- if not isinstance(cred_id, str) or not cred_id.strip():- # Non-string or empty string is corrupted state.- # Fail loudly so the user re-authenticates rather- # than silently running with no creds.- provider = info.get("config", {}).get(- "provider", "external service"- )- file_name = field_data.get("name", "selected file")- raise ValueError(- f"{provider.capitalize()} credential id for "- f"'{file_name}' in field '{field_name}' is empty "- f"or invalid. Please open the agent in the "- f"builder and re-select the file."- )- # Credential ID provided - acquire credentials- provider = info.get("config", {}).get(- "provider", "external service"- )- file_name = field_data.get("name", "selected file")- try:- credentials, lock = await creds_manager.acquire(- user_id, cred_id- )- locks.append(lock)- extra_exec_kwargs[kwarg_name] = credentials- except ValueError:- raise ValueError(- f"{provider.capitalize()} credentials for "- f"'{file_name}' in field '{field_name}' are not "- f"available in your account. "- f"This can happen if the agent was created by another "- f"user or the credentials were deleted. "- f"Please open the agent in the builder and re-select "- f"the file to authenticate with your own account."- )- else:- # _credentials_id key missing entirely - this is an error- provider = info.get("config", {}).get(- "provider", "external service"- )- file_name = field_data.get("name", "selected file")- raise ValueError(- f"Authentication missing for '{file_name}' in field "- f"'{field_name}'. Please re-select the file to authenticate "- f"with {provider.capitalize()}."- )- elif field_data is None and field_name not in input_data:- # Field not in input_data at all = connected from upstream block, skip- pass- elif field_data is None or field_data == "":- # field_data is None/empty but key IS in input_data = user didn't select- provider = info.get("config", {}).get("provider", "external service")- raise ValueError(- f"No file selected for '{field_name}'. "- f"Please select a file to provide "- f"{provider.capitalize()} authentication."- )- else:- # field_data is truthy but NOT a dict (e.g. bare Drive ID- # string, int, list). The graph validator catches this at- # save time, but API callers / legacy graphs can still- # reach here — surface what the value actually is instead- # of the misleading "No file selected" message.- provider = info.get("config", {}).get("provider", "external service")- raise ValueError(- f"Invalid {type(field_data).__name__} value for "- f"'{field_name}': this field expects a picker-populated "- f"object carrying the user's credentials, not a bare "- f"value. Please re-select the file via the picker to "- f"provide {provider.capitalize()} authentication."- )- except BaseException:- # Release any locks already acquired so failures on later fields- # don't strand earlier credentials until Redis TTL expires them.- for lock in locks:- try:- await lock.release()- except Exception as release_exc:- _logger.warning(- "Failed to release auto-credential lock after acquisition "- "error: %s",- release_exc,- )- raise-- return extra_exec_kwargs, locks--async def execute_node(node: Node,data: NodeExecutionEntry,@@ -427,7 +311,7 @@ async def execute_node(extra_exec_kwargs[field_name] = credentials# Handle auto-generated credentials (e.g., from GoogleDriveFileInput)- auto_extra_kwargs, auto_locks = await _acquire_auto_credentials(+ auto_extra_kwargs, auto_locks = await acquire_auto_credentials(input_model=input_model,input_data=input_data,creds_manager=creds_manager,diff --git a/autogpt_platform/backend/backend/executor/manager_auto_credentials_test.py b/autogpt_platform/backend/backend/executor/manager_auto_credentials_test.pyindex 62f58cfa59..74ce936b51 100644--- a/autogpt_platform/backend/backend/executor/manager_auto_credentials_test.py+++ b/autogpt_platform/backend/backend/executor/manager_auto_credentials_test.py@@ -1,8 +1,8 @@"""-Tests for auto_credentials handling in execute_node().+Tests for auto_credentials handling.-These test the _acquire_auto_credentials() helper function extracted from-execute_node() (manager.py lines 273-308).+These cover ``acquire_auto_credentials`` in ``backend/executor/auto_credentials.py``+— shared by the graph executor and the CoPilot direct-block-execution path."""import pytest@@ -68,12 +68,12 @@ async def test_auto_credentials_happy_path(mock_creds_manager,):"""When field_data has a valid _credentials_id, credentials should be acquired."""- from backend.executor.manager import _acquire_auto_credentials+ from backend.executor.auto_credentials import acquire_auto_credentialsmanager, mock_creds, mock_lock = mock_creds_managerinput_data = {"spreadsheet": google_drive_file_data["valid"]}- extra_kwargs, locks = await _acquire_auto_credentials(+ extra_kwargs, locks = await acquire_auto_credentials(input_model=mock_input_model,input_data=input_data,creds_manager=manager,@@ -96,14 +96,14 @@ async def test_auto_credentials_field_none_static_raises(When field_data is None and the key IS in input_data (user didn't select a file),should raise ValueError instead of silently skipping."""- from backend.executor.manager import _acquire_auto_credentials+ from backend.executor.auto_credentials import acquire_auto_credentialsmanager, _, _ = mock_creds_manager# Key is present but value is None = user didn't select a fileinput_data = {"spreadsheet": None}with pytest.raises(ValueError, match="No file selected"):- await _acquire_auto_credentials(+ await acquire_auto_credentials(input_model=mock_input_model,input_data=input_data,creds_manager=manager,@@ -121,13 +121,13 @@ async def test_auto_credentials_field_absent_skips(When the field key is NOT in input_data at all (upstream connection),should skip without error."""- from backend.executor.manager import _acquire_auto_credentials+ from backend.executor.auto_credentials import acquire_auto_credentialsmanager, _, _ = mock_creds_manager# Key not present = connected from upstream blockinput_data = {}- extra_kwargs, locks = await _acquire_auto_credentials(+ extra_kwargs, locks = await acquire_auto_credentials(input_model=mock_input_model,input_data=input_data,creds_manager=manager,@@ -150,12 +150,12 @@ async def test_auto_credentials_chained_cred_id_none(When _credentials_id is explicitly None (chained data from upstream),should skip credential acquisition."""- from backend.executor.manager import _acquire_auto_credentials+ from backend.executor.auto_credentials import acquire_auto_credentialsmanager, _, _ = mock_creds_managerinput_data = {"spreadsheet": google_drive_file_data["chained"]}- extra_kwargs, locks = await _acquire_auto_credentials(+ extra_kwargs, locks = await acquire_auto_credentials(input_model=mock_input_model,input_data=input_data,creds_manager=manager,@@ -177,13 +177,13 @@ async def test_auto_credentials_missing_cred_id_key_raises(When _credentials_id key is missing entirely from field_data dict,should raise ValueError."""- from backend.executor.manager import _acquire_auto_credentials+ from backend.executor.auto_credentials import acquire_auto_credentialsmanager, _, _ = mock_creds_managerinput_data = {"spreadsheet": google_drive_file_data["missing_key"]}with pytest.raises(ValueError, match="Authentication missing"):- await _acquire_auto_credentials(+ await acquire_auto_credentials(input_model=mock_input_model,input_data=input_data,creds_manager=manager,@@ -202,7 +202,7 @@ async def test_auto_credentials_ownership_mismatch_error([SECRT-1772] When acquire() raises ValueError (credential belongs to another user),the error message should mention 'not available' (not 'expired')."""- from backend.executor.manager import _acquire_auto_credentials+ from backend.executor.auto_credentials import acquire_auto_credentialsmanager, _, _ = mock_creds_managermanager.acquire.side_effect = ValueError(@@ -211,7 +211,7 @@ async def test_auto_credentials_ownership_mismatch_error(input_data = {"spreadsheet": google_drive_file_data["valid"]}with pytest.raises(ValueError, match="not available in your account"):- await _acquire_auto_credentials(+ await acquire_auto_credentials(input_model=mock_input_model,input_data=input_data,creds_manager=manager,@@ -230,7 +230,7 @@ async def test_auto_credentials_deleted_credential_error([SECRT-1772] When acquire() raises ValueError (credential was deleted),the error message should mention 'not available' (not 'expired')."""- from backend.executor.manager import _acquire_auto_credentials+ from backend.executor.auto_credentials import acquire_auto_credentialsmanager, _, _ = mock_creds_managermanager.acquire.side_effect = ValueError(@@ -239,7 +239,7 @@ async def test_auto_credentials_deleted_credential_error(input_data = {"spreadsheet": google_drive_file_data["valid"]}with pytest.raises(ValueError, match="not available in your account"):- await _acquire_auto_credentials(+ await acquire_auto_credentials(input_model=mock_input_model,input_data=input_data,creds_manager=manager,@@ -255,12 +255,12 @@ async def test_auto_credentials_lock_appended(mock_creds_manager,):"""Lock from acquire() should be included in returned locks list."""- from backend.executor.manager import _acquire_auto_credentials+ from backend.executor.auto_credentials import acquire_auto_credentialsmanager, _, mock_lock = mock_creds_managerinput_data = {"spreadsheet": google_drive_file_data["valid"]}- extra_kwargs, locks = await _acquire_auto_credentials(+ extra_kwargs, locks = await acquire_auto_credentials(input_model=mock_input_model,input_data=input_data,creds_manager=manager,@@ -277,7 +277,7 @@ async def test_auto_credentials_multiple_fields(mock_creds_manager,):"""When there are multiple auto_credentials fields, only valid ones should acquire."""- from backend.executor.manager import _acquire_auto_credentials+ from backend.executor.auto_credentials import acquire_auto_credentialsmanager, mock_creds, mock_lock = mock_creds_manager@@ -306,7 +306,7 @@ async def test_auto_credentials_multiple_fields(},}- extra_kwargs, locks = await _acquire_auto_credentials(+ extra_kwargs, locks = await acquire_auto_credentials(input_model=input_model,input_data=input_data,creds_manager=manager,@@ -326,7 +326,7 @@ async def test_acquire_auto_credentials_releases_partial_locks_on_failure("""When acquiring a later auto-credential field raises, any locksalready taken for earlier fields must be released — otherwise they'dsit until Redis TTL expires, blocking the next execution."""- from backend.executor.manager import _acquire_auto_credentials+ from backend.executor.auto_credentials import acquire_auto_credentialsmanager = mocker.AsyncMock()good_creds = mocker.MagicMock()@@ -366,7 +366,7 @@ async def test_acquire_auto_credentials_releases_partial_locks_on_failure(}with pytest.raises(ValueError):- await _acquire_auto_credentials(+ await acquire_auto_credentials(input_model=input_model,input_data=input_data,creds_manager=manager,@@ -384,7 +384,7 @@ async def test_acquire_auto_credentials_rejects_empty_string_credential_id(slip through ``if cred_id:`` and run without injecting credentials.Now it raises so the user re-authenticates rather than executing ablock that silently has no creds."""- from backend.executor.manager import _acquire_auto_credentials+ from backend.executor.auto_credentials import acquire_auto_credentialsmanager = mocker.AsyncMock()@@ -405,7 +405,7 @@ async def test_acquire_auto_credentials_rejects_empty_string_credential_id(}with pytest.raises(ValueError, match="empty or invalid"):- await _acquire_auto_credentials(+ await acquire_auto_credentials(input_model=input_model,input_data=input_data,creds_manager=manager,@@ -440,7 +440,7 @@ async def test_acquire_auto_credentials_rejects_non_dict_value_with_type_messagePin the tighter contract: a non-dict value must raise an errorthat names both the field *and* the type it received."""- from backend.executor.manager import _acquire_auto_credentials+ from backend.executor.auto_credentials import acquire_auto_credentialsmanager = mocker.AsyncMock()input_model = mocker.MagicMock()@@ -454,7 +454,7 @@ async def test_acquire_auto_credentials_rejects_non_dict_value_with_type_messageinput_data = {"spreadsheet": bad_value}with pytest.raises(ValueError) as exc_info:- await _acquire_auto_credentials(+ await acquire_auto_credentials(input_model=input_model,input_data=input_data,creds_manager=manager,diff --git a/autogpt_platform/backend/backend/integrations/managed_providers/ayrshare.py b/autogpt_platform/backend/backend/integrations/managed_providers/ayrshare.pyindex fc2254f81e..603fc45d4b 100644--- a/autogpt_platform/backend/backend/integrations/managed_providers/ayrshare.py+++ b/autogpt_platform/backend/backend/integrations/managed_providers/ayrshare.py@@ -32,6 +32,7 @@ platform UX, not a credential concern.from __future__ import annotationsimport logging+import secretsfrom pydantic import SecretStr@@ -101,9 +102,6 @@ class AyrshareManagedProvider(ManagedCredentialProvider):user_integrations.managed_credentials.ayrshare_profile_key = None-import secrets--def _profile_title(user_id: str) -> str:"""A unique Ayrshare profile title for this provision attempt.diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/tools/RunBlock/components/SetupRequirementsCard/__tests__/helpers.test.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/tools/RunBlock/components/SetupRequirementsCard/__tests__/helpers.test.tsindex ba0281278e..ceba27ed8d 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/tools/RunBlock/components/SetupRequirementsCard/__tests__/helpers.test.ts+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/tools/RunBlock/components/SetupRequirementsCard/__tests__/helpers.test.ts@@ -280,6 +280,43 @@ describe("coerceExpectedInputs", () => {expect(result[0].value).toBeUndefined();});+ it("preserves arbitrary schema keys (format, picker configs, etc.)", () => {+ const result = coerceExpectedInputs([+ {+ name: "spreadsheet",+ type: "object",+ format: "google-drive-picker",+ google_drive_picker_config: {+ multiselect: false,+ allowed_views: ["SPREADSHEETS"],+ },+ auto_credentials: { provider: "google", type: "oauth2" },+ },+ ]);+ expect(result[0].format).toBe("google-drive-picker");+ expect(result[0].google_drive_picker_config).toEqual({+ multiselect: false,+ allowed_views: ["SPREADSHEETS"],+ });+ expect(result[0].auto_credentials).toEqual({+ provider: "google",+ type: "oauth2",+ });+ });++ it("skips undefined extra keys but keeps other extras", () => {+ const result = coerceExpectedInputs([+ {+ name: "q",+ type: "string",+ format: "email",+ extra_hint: undefined,+ },+ ]);+ expect(result[0].format).toBe("email");+ expect(result[0]).not.toHaveProperty("extra_hint");+ });+it("omits non-string discriminator_values from scopes in coerceCredentialFields", () => {const input = {cred1: {@@ -428,6 +465,49 @@ describe("buildExpectedInputsSchema", () => {expect(buildExpectedInputsSchema(advancedOnly)).toBeNull();expect(buildExpectedInputsSchema(advancedOnly, true)).not.toBeNull();});++ it("propagates arbitrary schema keys (e.g. format, picker config) into properties", () => {+ const pickerInput = [+ {+ name: "spreadsheet",+ title: "Spreadsheet",+ type: "object",+ required: true,+ advanced: false,+ format: "google-drive-picker",+ google_drive_picker_config: {+ multiselect: false,+ allowed_views: ["SPREADSHEETS"],+ },+ auto_credentials: { provider: "google" },+ },+ ];+ const schema = buildExpectedInputsSchema(pickerInput);+ const props = schema!.properties as Record<string, Record<string, unknown>>;+ expect(props.spreadsheet.format).toBe("google-drive-picker");+ expect(props.spreadsheet.google_drive_picker_config).toEqual({+ multiselect: false,+ allowed_views: ["SPREADSHEETS"],+ });+ expect(props.spreadsheet.auto_credentials).toEqual({ provider: "google" });+ });++ it("does not leak reserved keys (name, required, advanced) into properties", () => {+ const input = [+ {+ name: "query",+ title: "Query",+ type: "string",+ required: true,+ advanced: false,+ },+ ];+ const schema = buildExpectedInputsSchema(input);+ const props = schema!.properties as Record<string, Record<string, unknown>>;+ expect(props.query).not.toHaveProperty("name");+ expect(props.query).not.toHaveProperty("required");+ expect(props.query).not.toHaveProperty("advanced");+ });});describe("extractInitialValues", () => {diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/tools/RunBlock/components/SetupRequirementsCard/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/tools/RunBlock/components/SetupRequirementsCard/helpers.tsindex 10e2399e80..b4b54be28e 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/tools/RunBlock/components/SetupRequirementsCard/helpers.ts+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/tools/RunBlock/components/SetupRequirementsCard/helpers.ts@@ -118,8 +118,23 @@ interface ExpectedInput {required: boolean;advanced: boolean;value?: unknown;+ // Any additional JSON-schema fields (format, json_schema_extra entries,+ // custom widget configs, etc.) are preserved verbatim so the generic+ // custom-field dispatch on the frontend can read them. Keeps this+ // layer free of widget-specific knowledge.+ [key: string]: unknown;}+const RESERVED_EXPECTED_INPUT_KEYS = new Set([+ "name",+ "title",+ "type",+ "description",+ "required",+ "advanced",+ "value",+]);+export function coerceExpectedInputs(rawInputs: unknown): ExpectedInput[] {if (!Array.isArray(rawInputs)) return [];const results: ExpectedInput[] = [];@@ -149,6 +164,14 @@ export function coerceExpectedInputs(rawInputs: unknown): ExpectedInput[] {if (input.value !== undefined && input.value !== null) {item.value = input.value;}+ // Preserve any additional schema fields (format, custom widget+ // configs, etc.) verbatim — dispatch is handled by the generic+ // custom-field layer in FormRenderer.+ for (const [key, value] of Object.entries(input)) {+ if (RESERVED_EXPECTED_INPUT_KEYS.has(key)) continue;+ if (value === undefined) continue;+ item[key] = value;+ }results.push(item);});@@ -195,6 +218,13 @@ export function buildExpectedInputsSchema(};if (input.description) prop.description = input.description;if (input.value !== undefined) prop.default = input.value;+ // Pass through any additional schema fields (format, custom widget+ // configs, etc.) so the generic custom-field dispatch can use them.+ for (const [key, value] of Object.entries(input)) {+ if (RESERVED_EXPECTED_INPUT_KEYS.has(key)) continue;+ if (value === undefined) continue;+ prop[key] = value;+ }properties[input.name] = prop;if (input.required) required.push(input.name);}diff --git a/docs/integrations/README.md b/docs/integrations/README.mdindex 2173e79e33..604d521a03 100644--- a/docs/integrations/README.md+++ b/docs/integrations/README.md@@ -41,7 +41,7 @@ Below is a comprehensive list of all available blocks, categorized by their prim| [Agent Date Input](block-integrations/basic.md#agent-date-input) | Block for date input || [Agent Dropdown Input](block-integrations/basic.md#agent-dropdown-input) | Block for dropdown text selection || [Agent File Input](block-integrations/basic.md#agent-file-input) | Block for file upload input (string path for example) |-| [Agent Google Drive File Input](block-integrations/basic.md#agent-google-drive-file-input) | Block for selecting a file from Google Drive |+| [Agent Google Drive File Input](block-integrations/basic.md#agent-google-drive-file-input) | Agent-level input for a Google Drive file || [Agent Input](block-integrations/basic.md#agent-input) | A block that accepts and processes user input values within a workflow, supporting various input types and validation || [Agent Long Text Input](block-integrations/basic.md#agent-long-text-input) | Block for long text input (multi-line) || [Agent Number Input](block-integrations/basic.md#agent-number-input) | Block for number input |diff --git a/docs/integrations/block-integrations/basic.md b/docs/integrations/block-integrations/basic.mdindex 94e45f04cf..3fe8df3c40 100644--- a/docs/integrations/block-integrations/basic.md+++ b/docs/integrations/block-integrations/basic.md@@ -247,7 +247,7 @@ By default, the block outputs a file path string that other blocks can use to ac## Agent Google Drive File Input### What it is-Block for selecting a file from Google Drive.+Agent-level input for a Google Drive file. REQUIRED for any agent that reads or writes a Drive file (Sheets, Docs, Slides, or generic Drive) — the picker is the only source of the _credentials_id needed at runtime, so consuming blocks cannot receive a hardcoded ID. Set allowed_views to match the consumer: ["SPREADSHEETS"] for Sheets, ["DOCUMENTS"] for Docs, ["PRESENTATIONS"] for Slides (leave default for generic Drive). Wire `result` to the consumer block's Drive field and leave that field unset in the consumer's input_default. Example link to a Google Sheets block: {"source_name": "result", "sink_name": "spreadsheet"} (use "document" for Docs, "presentation" for Slides). Use one input block per distinct file; multiple consumers of the same file share it.### How it works<!-- MANUAL: how_it_works -->diff --git a/docs/integrations/block-integrations/google/docs.md b/docs/integrations/block-integrations/google/docs.mdindex b0bf16abc3..7feaa95a6f 100644--- a/docs/integrations/block-integrations/google/docs.md+++ b/docs/integrations/block-integrations/google/docs.md@@ -19,7 +19,7 @@ Set add_newline to true to insert a line break before the appended content. The| Input | Description | Type | Required ||-------|-------------|------|----------|-| document | Select a Google Doc to append to | Document | No |+| document | Select a Google Doc to append to. 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. | Document | No || markdown | Markdown content to append to the document | str | Yes || add_newline | Add a newline before the appended content | bool | No |@@ -58,7 +58,7 @@ The block finds the document's end index and inserts the text there, with an opt| Input | Description | Type | Required ||-------|-------------|------|----------|-| document | Select a Google Doc to append to | Document | No |+| document | Select a Google Doc to append to. 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. | Document | No || text | Plain text to append (no formatting applied) | str | Yes || add_newline | Add a newline before the appended text | bool | No |@@ -136,7 +136,7 @@ Use the Get Structure block first to find the correct index positions for conten| Input | Description | Type | Required ||-------|-------------|------|----------|-| document | Select a Google Doc | Document | No |+| document | Select a Google Doc. 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. | Document | No || start_index | Start index of content to delete (must be >= 1, as index 0 is a section break) | int | Yes || end_index | End index of content to delete | int | Yes |@@ -175,7 +175,7 @@ The export preserves document formatting as closely as possible in the target fo| Input | Description | Type | Required ||-------|-------------|------|----------|-| document | Select a Google Doc to export | Document | No |+| document | Select a Google Doc to export. 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. | Document | No || format | Export format | "application/pdf" \| "application/vnd.openxmlformats-officedocument.wordprocessingml.document" \| "application/vnd.oasis.opendocument.text" \| "text/plain" \| "text/html" \| "application/epub+zip" \| "application/rtf" | No |### Outputs@@ -214,7 +214,7 @@ The replacement preserves the surrounding formatting but does not apply any new| Input | Description | Type | Required ||-------|-------------|------|----------|-| document | Select a Google Doc | Document | No |+| document | Select a Google Doc. 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. | Document | No || find_text | Plain text to find | str | Yes || replace_text | Plain text to replace with (no formatting applied) | str | Yes || match_case | Match case when finding text | bool | No |@@ -254,7 +254,7 @@ Use the Get Structure block to identify the correct index positions. Multiple fo| Input | Description | Type | Required ||-------|-------------|------|----------|-| document | Select a Google Doc | Document | No |+| document | Select a Google Doc. 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. | Document | No || start_index | Start index of text to format (must be >= 1, as index 0 is a section break) | int | Yes || end_index | End index of text to format | int | Yes || bold | Make text bold | bool | No |@@ -298,7 +298,7 @@ This metadata is useful for tracking document versions, building document invent| Input | Description | Type | Required ||-------|-------------|------|----------|-| document | Select a Google Doc | Document | No |+| document | Select a Google Doc. 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. | Document | No |### Outputs@@ -338,7 +338,7 @@ The index positions are essential for precise editing operations like formatting| Input | Description | Type | Required ||-------|-------------|------|----------|-| document | Select a Google Doc to analyze | Document | No |+| document | Select a Google Doc to analyze. 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. | Document | No || detailed | Return full hierarchical structure instead of flat segments | bool | No |### Outputs@@ -377,7 +377,7 @@ The Markdown parser handles headers, bold, italic, links, lists, and code format| Input | Description | Type | Required ||-------|-------------|------|----------|-| document | Select a Google Doc to insert into | Document | No |+| document | Select a Google Doc to insert into. 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. | Document | No || markdown | Markdown content to insert | str | Yes || index | Position index to insert at (1 = start of document) | int | No |@@ -416,7 +416,7 @@ Page breaks force subsequent content to start on a new page, useful for separati| Input | Description | Type | Required ||-------|-------------|------|----------|-| document | Select a Google Doc | Document | No |+| document | Select a Google Doc. 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. | Document | No || index | Position to insert page break (0 = end of document) | int | No |### Outputs@@ -454,7 +454,7 @@ Unlike the Markdown insert, text is inserted exactly as provided without any for| Input | Description | Type | Required ||-------|-------------|------|----------|-| document | Select a Google Doc to insert into | Document | No |+| document | Select a Google Doc to insert into. 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. | Document | No || text | Plain text to insert (no formatting applied) | str | Yes || index | Position index to insert at (1 = start of document) | int | No |@@ -493,7 +493,7 @@ Cell content can optionally be formatted as Markdown, enabling rich formatting l| Input | Description | Type | Required ||-------|-------------|------|----------|-| document | Select a Google Doc | Document | No |+| document | Select a Google Doc. 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. | Document | No || rows | Number of rows (ignored if content provided) | int | No || columns | Number of columns (ignored if content provided) | int | No || content | Optional 2D array of cell content, e.g. [['Header1', 'Header2'], ['Row1Col1', 'Row1Col2']]. If provided, rows/columns are derived from this. | List[List[str]] | No |@@ -535,7 +535,7 @@ Use this for content analysis, text processing, or feeding document content to A| Input | Description | Type | Required ||-------|-------------|------|----------|-| document | Select a Google Doc to read | Document | No |+| document | Select a Google Doc to read. 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. | Document | No |### Outputs@@ -573,7 +573,7 @@ This is ideal for completely regenerating document content from AI-generated Mar| Input | Description | Type | Required ||-------|-------------|------|----------|-| document | Select a Google Doc to replace content in | Document | No |+| document | Select a Google Doc to replace content in. 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. | Document | No || markdown | Markdown content to replace the document with | str | Yes |### Outputs@@ -611,7 +611,7 @@ Use this for template systems where placeholders like {{SECTION}} are replaced w| Input | Description | Type | Required ||-------|-------------|------|----------|-| document | Select a Google Doc | Document | No |+| document | Select a Google Doc. 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. | Document | No || find_text | Text to find and replace (e.g., '{{PLACEHOLDER}}' or any text) | str | Yes || markdown | Markdown content to replace the found text with | str | Yes || match_case | Match case when finding text | bool | No |@@ -651,7 +651,7 @@ Use Get Structure to find the correct index positions. This enables precise repl| Input | Description | Type | Required ||-------|-------------|------|----------|-| document | Select a Google Doc | Document | No |+| document | Select a Google Doc. 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. | Document | No || markdown | Markdown content to insert in place of the range | str | Yes || start_index | Start index of the range to replace (must be >= 1) | int | Yes || end_index | End index of the range to replace | int | Yes |@@ -691,7 +691,7 @@ When made public, anyone with the link can access the document according to the| Input | Description | Type | Required ||-------|-------------|------|----------|-| document | Select a Google Doc | Document | No |+| document | Select a Google Doc. 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. | Document | No || public | True to make public, False to make private | bool | No || role | Permission role for public access | "reader" \| "commenter" | No |@@ -731,7 +731,7 @@ Leave the email blank to just generate a shareable link. The block returns the s| Input | Description | Type | Required ||-------|-------------|------|----------|-| document | Select a Google Doc to share | Document | No |+| document | Select a Google Doc to share. 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. | Document | No || email | Email address to share with. Leave empty for link sharing. | str | No || role | Permission role for the user | "reader" \| "writer" \| "commenter" | No || send_notification | Send notification email to the user | bool | No |diff --git a/docs/integrations/block-integrations/google/sheets.md b/docs/integrations/block-integrations/google/sheets.mdindex 38393819e5..6605ebd651 100644--- a/docs/integrations/block-integrations/google/sheets.md+++ b/docs/integrations/block-integrations/google/sheets.md@@ -19,7 +19,7 @@ The block uses the Google Sheets API to perform the insertion, shifting existing| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No || sheet_name | Sheet name (optional, defaults to first sheet) | str | No || header | Header name for the new column | str | Yes || position | Where to add: 'end' for last column, or column letter (e.g., 'C') to insert before | str | No |@@ -62,7 +62,7 @@ The dropdown arrow appears in cells when enabled, providing users with a list of| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No || sheet_name | Sheet name (optional, defaults to first sheet) | str | No || range | Cell range to add dropdown to (e.g., 'B2:B100') | str | Yes || options | List of dropdown options | List[str] | Yes |@@ -104,7 +104,7 @@ Notes are useful for documentation, explanations, or audit trails that shouldn't| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | The spreadsheet to add note to | Spreadsheet | No |+| spreadsheet | The spreadsheet to add note to. 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. | Spreadsheet | No || cell | Cell to add note to (e.g., A1, B2) | str | Yes || note | Note text to add | str | Yes || sheet_name | Name of the sheet. Defaults to first sheet. | str | No |@@ -144,7 +144,7 @@ This is ideal for continuously adding records to a log or database-style sheet.| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No || row | Row values to append (e.g., ['Alice', '[email protected]', '25']) | List[str] | Yes || sheet_name | Sheet to append to (optional, defaults to first sheet) | str | No || value_input_option | How values are interpreted. USER_ENTERED: parsed like typed input (e.g., '=SUM(A1:A5)' becomes a formula, '1/2/2024' becomes a date). RAW: stored as-is without parsing. | "RAW" \| "USER_ENTERED" | No |@@ -184,7 +184,7 @@ Operations execute in order and can include various actions like formatting, dat| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No || operations | List of operations to perform | List[BatchOperation] | Yes |### Outputs@@ -222,7 +222,7 @@ Use A1 notation (e.g., "A1:D10" or "Sheet1!B2:C5") to specify the range to clear| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No || range | The A1 notation of the range to clear | str | Yes |### Outputs@@ -260,7 +260,7 @@ The new sheet is added to the destination spreadsheet with a potentially modifie| Input | Description | Type | Required ||-------|-------------|------|----------|-| source_spreadsheet | Select the source spreadsheet | Source Spreadsheet | No |+| source_spreadsheet | Select the source 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. | Source Spreadsheet | No || source_sheet_name | Sheet to copy (optional, defaults to first sheet) | str | No || destination_spreadsheet_id | ID of the destination spreadsheet | str | Yes |@@ -301,7 +301,7 @@ Named ranges can be used in formulas across the spreadsheet and make maintenance| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No || sheet_name | Sheet name (optional, defaults to first sheet) | str | No || name | Name for the range (e.g., 'SalesData', 'CustomerList') | str | Yes || range | Cell range in A1 notation (e.g., 'A1:D10', 'B2:B100') | str | Yes |@@ -382,7 +382,7 @@ All data in the column is permanently deleted and subsequent columns shift left| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No || sheet_name | Sheet name (optional, defaults to first sheet) | str | No || column | Column to delete (header name or column letter like 'A', 'B') | str | Yes |@@ -421,7 +421,7 @@ Works seamlessly with the Filter Rows block output to delete rows matching speci| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No || sheet_name | Sheet name (optional, defaults to first sheet) | str | No || row_indices | 1-based row indices to delete (e.g., [2, 5, 7]) | List[int] | Yes |@@ -461,7 +461,7 @@ The CSV data can be used for integration with other systems, file downloads, or| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | The spreadsheet to export from | Spreadsheet | No |+| spreadsheet | The spreadsheet to export from. 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. | Spreadsheet | No || sheet_name | Name of the sheet to export. Defaults to first sheet. | str | No || include_headers | Include the first row (headers) in the CSV output | bool | No |@@ -501,7 +501,7 @@ Returns matching rows along with their original 1-based row indices, making it e| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No || sheet_name | Sheet name (optional, defaults to first sheet) | str | No || filter_column | Column to filter on (header name or column letter like 'A', 'B') | str | Yes || filter_value | Value to filter by (not used for is_empty/is_not_empty operators) | str | No |@@ -546,7 +546,7 @@ Returns the locations (sheet, row, column) of all matches or just the first one,| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No || find_text | The text to find | str | Yes || sheet_id | The ID of the specific sheet to search (optional, searches all sheets if not provided) | int | No || match_case | Whether to match case | bool | No |@@ -591,7 +591,7 @@ Returns the number of replacements made, enabling verification of the operation'| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No || find_text | The text to find | str | Yes || replace_text | The text to replace with | str | Yes || sheet_id | The ID of the specific sheet to search (optional, searches all sheets if not provided) | int | No |@@ -633,7 +633,7 @@ Formatting enhances readability and can highlight important data or create visua| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No || range | A1 notation – sheet optional | str | Yes || background_color | - | Dict[str, Any] | No || text_color | - | Dict[str, Any] | No |@@ -676,7 +676,7 @@ Returns values as a list for easy iteration or processing in subsequent blocks.| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No || sheet_name | Sheet name (optional, defaults to first sheet) | str | No || column | Column to extract (header name or column letter like 'A', 'B') | str | Yes || include_header | Include the header in output | bool | No |@@ -719,7 +719,7 @@ Returns a list of notes with their cell locations, useful for extracting documen| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | The spreadsheet to get notes from | Spreadsheet | No |+| spreadsheet | The spreadsheet to get notes from. 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. | Spreadsheet | No || range | Range to get notes from (e.g., A1:B10) | str | No || sheet_name | Name of the sheet. Defaults to first sheet. | str | No |@@ -759,7 +759,7 @@ The dictionary format makes it easy to access specific fields by name rather tha| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No || sheet_name | Sheet name (optional, defaults to first sheet) | str | No || row_index | 1-based row index to retrieve | int | Yes |@@ -799,7 +799,7 @@ This information is essential for determining loop boundaries or validating data| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No || sheet_name | Sheet name (optional, defaults to first sheet) | str | No || include_header | Include header row in count | bool | No || count_empty | Count rows with only empty cells | bool | No |@@ -842,7 +842,7 @@ Useful for discovering data categories, building dynamic dropdown lists, or anal| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No || sheet_name | Sheet name (optional, defaults to first sheet) | str | No || column | Column to get unique values from (header name or column letter) | str | Yes || include_count | Include count of each unique value | bool | No |@@ -885,7 +885,7 @@ The CSV string is parsed and written to the sheet, enabling data import from ext| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | The spreadsheet to import into | Spreadsheet | No |+| spreadsheet | The spreadsheet to import into. 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. | Spreadsheet | No || csv_data | CSV data to import | str | Yes || sheet_name | Name of the sheet. Defaults to first sheet. | str | No || start_cell | Cell to start importing at (e.g., A1, B2) | str | No |@@ -927,7 +927,7 @@ Use value_input_option to control whether values are parsed (USER_ENTERED) or st| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No || row | Row values to insert (e.g., ['Alice', '[email protected]', '25']) | List[str] | Yes || row_index | 1-based row index where to insert (existing rows shift down) | int | Yes || sheet_name | Sheet name (optional, defaults to first sheet) | str | No |@@ -968,7 +968,7 @@ Useful for discovering available named ranges or auditing spreadsheet configurat| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No |### Outputs@@ -1006,7 +1006,7 @@ This is useful for database-style lookups where you need to find a record by ID,| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No || sheet_name | Sheet name (optional, defaults to first sheet) | str | No || lookup_column | Column to search in (header name or column letter) | str | Yes || lookup_value | Value to search for | str | Yes |@@ -1051,7 +1051,7 @@ Use this to dynamically organize spreadsheet structure as part of workflows.| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No || operation | Operation to perform | "create" \| "delete" \| "copy" | Yes || sheet_name | Target sheet name (defaults to first sheet for delete) | str | No || source_sheet_id | Source sheet ID for copy | int | No |@@ -1092,7 +1092,7 @@ Useful for understanding spreadsheet structure before performing operations.| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No |### Outputs@@ -1129,7 +1129,7 @@ Use this to prevent accidental changes to important formulas, headers, or refere| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No || sheet_name | Sheet name (optional, defaults to first sheet) | str | No || range | Cell range to protect (e.g., 'A1:D10'). Leave empty to protect entire sheet. | str | No || description | Description for the protected range | str | No |@@ -1169,7 +1169,7 @@ The block connects to Google Sheets using provided credentials, then fetches dat| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No || range | The A1 notation of the range to read | str | Yes |### Outputs@@ -1203,7 +1203,7 @@ Case sensitivity is configurable for text comparisons.| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No || sheet_name | Sheet name (optional, defaults to first sheet) | str | No || columns | Columns to check for duplicates (header names or letters). Empty = all columns. | List[str] | No || keep | Which duplicate to keep: 'first' or 'last' | str | No |@@ -1246,7 +1246,7 @@ When made public, anyone with the link can access the spreadsheet. The share lin| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | The spreadsheet to modify access for | Spreadsheet | No |+| spreadsheet | The spreadsheet to modify access for. 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. | Spreadsheet | No || public | True to make public, False to make private | bool | No || role | Permission role for public access | "reader" \| "commenter" | No |@@ -1286,7 +1286,7 @@ Leave the email blank to just generate a shareable link.| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | The spreadsheet to share | Spreadsheet | No |+| spreadsheet | The spreadsheet to share. 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. | Spreadsheet | No || email | Email address to share with. Leave empty for link sharing. | str | No || role | Permission role for the user | "reader" \| "writer" \| "commenter" | No || send_notification | Send notification email to the user | bool | No |@@ -1328,7 +1328,7 @@ Sorting is performed in-place, modifying the sheet directly.| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No || sheet_name | Sheet name (optional, defaults to first sheet) | str | No || sort_column | Primary column to sort by (header name or column letter) | str | Yes || sort_order | Sort order for primary column | "ascending" \| "descending" | No |@@ -1371,7 +1371,7 @@ Use value_input_option to control whether values are parsed (USER_ENTERED) or st| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No || cell | Cell address in A1 notation (e.g., 'A1', 'Sheet1!B2') | str | Yes || value | Value to write to the cell | str | Yes || value_input_option | How input data should be interpreted | "RAW" \| "USER_ENTERED" | No |@@ -1411,7 +1411,7 @@ The dictionary format is convenient when you only need to update specific column| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No || sheet_name | Sheet name (optional, defaults to first sheet) | str | No || row_index | 1-based row index to update | int | Yes || values | New values for the row (in column order) | List[str] | No |@@ -1450,7 +1450,7 @@ The block authenticates with Google Sheets using provided credentials, then upda| Input | Description | Type | Required ||-------|-------------|------|----------|-| spreadsheet | Select a Google Sheets spreadsheet | Spreadsheet | No |+| spreadsheet | 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. | Spreadsheet | No || range | The A1 notation of the range to write | str | Yes || values | The data to write to the spreadsheet | List[List[str]] | Yes |