Skip to content

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.

fix(blocks): rename placeholder_values to options on AgentDropdownInputBlock (#12595)

Toran Bruce Richards11b846dd4974
diff --git a/autogpt_platform/backend/backend/blocks/io.py b/autogpt_platform/backend/backend/blocks/io.py
index 53fc23b68a..e72ee5c097 100644
--- a/autogpt_platform/backend/backend/blocks/io.py
+++ b/autogpt_platform/backend/backend/blocks/io.py
@@ -2,6 +2,8 @@ import copy
from datetime import date, time
from typing import Any, Optional
+from pydantic import AliasChoices, Field
+
from backend.blocks._base import (
Block,
BlockCategory,
@@ -467,7 +469,8 @@ class AgentFileInputBlock(AgentInputBlock):
class AgentDropdownInputBlock(AgentInputBlock):
"""
- A specialized text input block that relies on placeholder_values to present a dropdown.
+ A specialized text input block that presents a dropdown selector
+ restricted to a fixed set of values.
"""
class Input(AgentInputBlock.Input):
@@ -477,16 +480,23 @@ class AgentDropdownInputBlock(AgentInputBlock):
advanced=False,
title="Default Value",
)
- placeholder_values: list = SchemaField(
- description="Possible values for the dropdown.",
+ # Use Field() directly (not SchemaField) to pass validation_alias,
+ # which handles backward compat for legacy "placeholder_values" across
+ # all construction paths (model_construct, __init__, model_validate).
+ options: list = Field(
default_factory=list,
- advanced=False,
title="Dropdown Options",
+ description=(
+ "If provided, renders the input as a dropdown selector "
+ "restricted to these values. Leave empty for free-text input."
+ ),
+ validation_alias=AliasChoices("options", "placeholder_values"),
+ json_schema_extra={"advanced": False, "secret": False},
)
def generate_schema(self):
schema = super().generate_schema()
- if possible_values := self.placeholder_values:
+ if possible_values := self.options:
schema["enum"] = possible_values
return schema
@@ -504,13 +514,13 @@ class AgentDropdownInputBlock(AgentInputBlock):
{
"value": "Option A",
"name": "dropdown_1",
- "placeholder_values": ["Option A", "Option B", "Option C"],
+ "options": ["Option A", "Option B", "Option C"],
"description": "Dropdown example 1",
},
{
"value": "Option C",
"name": "dropdown_2",
- "placeholder_values": ["Option A", "Option B", "Option C"],
+ "options": ["Option A", "Option B", "Option C"],
"description": "Dropdown example 2",
},
],
diff --git a/autogpt_platform/backend/backend/blocks/test/test_block.py b/autogpt_platform/backend/backend/blocks/test/test_block.py
index 569e8b767d..719dd600d5 100644
--- a/autogpt_platform/backend/backend/blocks/test/test_block.py
+++ b/autogpt_platform/backend/backend/blocks/test/test_block.py
@@ -300,13 +300,27 @@ def test_agent_input_block_ignores_legacy_placeholder_values():
def test_dropdown_input_block_produces_enum():
- """Verify AgentDropdownInputBlock.Input.generate_schema() produces enum."""
- options = ["Option A", "Option B"]
+ """Verify AgentDropdownInputBlock.Input.generate_schema() produces enum
+ using the canonical 'options' field name."""
+ opts = ["Option A", "Option B"]
instance = AgentDropdownInputBlock.Input.model_construct(
- name="choice", value=None, placeholder_values=options
+ name="choice", value=None, options=opts
)
schema = instance.generate_schema()
- assert schema.get("enum") == options
+ assert schema.get("enum") == opts
+
+
+def test_dropdown_input_block_legacy_placeholder_values_produces_enum():
+ """Verify backward compat: passing legacy 'placeholder_values' to
+ AgentDropdownInputBlock still produces enum via model_construct remap."""
+ opts = ["Option A", "Option B"]
+ instance = AgentDropdownInputBlock.Input.model_construct(
+ name="choice", value=None, placeholder_values=opts
+ )
+ schema = instance.generate_schema()
+ assert (
+ schema.get("enum") == opts
+ ), "Legacy placeholder_values should be remapped to options"
def test_generate_schema_integration_legacy_placeholder_values():
@@ -329,11 +343,11 @@ def test_generate_schema_integration_legacy_placeholder_values():
def test_generate_schema_integration_dropdown_produces_enum():
"""Test the full Graph._generate_schema path with AgentDropdownInputBlock
- — verifies enum IS produced for dropdown blocks."""
+ — verifies enum IS produced for dropdown blocks using canonical field name."""
dropdown_input_default = {
"name": "color",
"value": None,
- "placeholder_values": ["Red", "Green", "Blue"],
+ "options": ["Red", "Green", "Blue"],
}
result = BaseGraph._generate_schema(
(AgentDropdownInputBlock.Input, dropdown_input_default),
@@ -344,3 +358,36 @@ def test_generate_schema_integration_dropdown_produces_enum():
"Green",
"Blue",
], "Graph schema should contain enum from AgentDropdownInputBlock"
+
+
+def test_generate_schema_integration_dropdown_legacy_placeholder_values():
+ """Test the full Graph._generate_schema path with AgentDropdownInputBlock
+ using legacy 'placeholder_values' — verifies backward compat produces enum."""
+ legacy_dropdown_input_default = {
+ "name": "color",
+ "value": None,
+ "placeholder_values": ["Red", "Green", "Blue"],
+ }
+ result = BaseGraph._generate_schema(
+ (AgentDropdownInputBlock.Input, legacy_dropdown_input_default),
+ )
+ color_props = result["properties"]["color"]
+ assert color_props.get("enum") == [
+ "Red",
+ "Green",
+ "Blue",
+ ], "Legacy placeholder_values should still produce enum via model_construct remap"
+
+
+def test_dropdown_input_block_init_legacy_placeholder_values():
+ """Verify backward compat: constructing AgentDropdownInputBlock.Input via
+ model_validate with legacy 'placeholder_values' correctly maps to 'options'."""
+ opts = ["Option A", "Option B"]
+ instance = AgentDropdownInputBlock.Input.model_validate(
+ {"name": "choice", "value": None, "placeholder_values": opts}
+ )
+ assert (
+ instance.options == opts
+ ), "Legacy placeholder_values should be remapped to options via model_validate"
+ schema = instance.generate_schema()
+ assert schema.get("enum") == opts
diff --git a/autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md b/autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
index 3c319b6742..e204f5eec8 100644
--- a/autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
+++ b/autogpt_platform/backend/backend/copilot/sdk/agent_generation_guide.md
@@ -89,8 +89,8 @@ These define the agent's interface — what it accepts and what it produces.
**AgentDropdownInputBlock** (ID: `655d6fdf-a334-421c-b733-520549c07cd1`):
- Specialized input block that presents a dropdown/select to the user
-- Required `input_default` fields: `name` (str), `placeholder_values` (list of options, must have at least one)
-- Optional: `title`, `description`, `value` (default selection)
+- Required `input_default` fields: `name` (str)
+- Optional: `options` (list of dropdown values; when omitted/empty, input behaves as free-text), `title`, `description`, `value` (default selection)
- Output: `result` — the user-selected value at runtime
- Use this instead of AgentInputBlock when the user should pick from a fixed set of options
diff --git a/autogpt_platform/backend/load-tests/tests/api/graph-execution-test.js b/autogpt_platform/backend/load-tests/tests/api/graph-execution-test.js
index e0f70cf0d8..41d97241ba 100644
--- a/autogpt_platform/backend/load-tests/tests/api/graph-execution-test.js
+++ b/autogpt_platform/backend/load-tests/tests/api/graph-execution-test.js
@@ -22,7 +22,6 @@ function generateTestGraph(name = null) {
input_default: {
name: "Load Test Input",
description: "Test input for load testing",
- placeholder_values: {},
},
input_nodes: [],
output_nodes: ["output_node"],
@@ -59,11 +58,7 @@ function generateExecutionInputs() {
"Load Test Input": {
name: "Load Test Input",
description: "Test input for load testing",
- placeholder_values: {
- test_data: `Test execution at ${new Date().toISOString()}`,
- test_parameter: Math.random().toString(36).substr(2, 9),
- numeric_value: Math.floor(Math.random() * 1000),
- },
+ value: `Test execution at ${new Date().toISOString()}`,
},
};
}
diff --git a/docs/integrations/block-integrations/basic.md b/docs/integrations/block-integrations/basic.md
index 60f8389de1..94e45f04cf 100644
--- a/docs/integrations/block-integrations/basic.md
+++ b/docs/integrations/block-integrations/basic.md
@@ -169,7 +169,7 @@ Block for dropdown text selection.
### How it works
<!-- MANUAL: how_it_works -->
-This block provides a dropdown selection input for users interacting with your agent. You define the available options using placeholder_values, and users select one option from the list at runtime.
+This block provides a dropdown selection input for users interacting with your agent. You define the available options using the `options` field, and users select one option from the list at runtime.
This is ideal when you want to constrain user input to a predefined set of choices, ensuring valid input and simplifying the user experience. The selected value is passed to downstream blocks in your workflow.
<!-- END MANUAL -->
@@ -184,7 +184,7 @@ This is ideal when you want to constrain user input to a predefined set of choic
| description | The description of the input. | str | No |
| advanced | Whether to show the input in the advanced section, if the field is not required. | bool | No |
| secret | Whether the input should be treated as a secret. | bool | No |
-| placeholder_values | Possible values for the dropdown. | List[Any] | No |
+| options | If provided, renders the input as a dropdown selector restricted to these values. Leave empty for free-text input. | List[Any] | No |
### Outputs