Quickstart
1
Import the Settings extension
Import the necessary components from the Agent Stack SDK fomr extension.
2
Add settings parameter to your agent
Inject the extension into your agent function using the
Annotated type hint.3
Define your settings structure
Create a
SettingsFormRender object with the fields you want users to configure.
The only allowed field types for settings are CheckboxGroupField and SingleSelectField.4
Process settings data
Use
parse_settings_form() to access the user’s configuration choices.It is also possible to combine setting with initial form using
FormServiceExtensionSpec.demand_forms, but they need to be parsed separately.Basic Settings Example
Here’s how to add simple user defined settings to your agent:How to work with settings
Here’s what you need to know to add settings capabilities to your agent: Import the form extension: ImportFormServiceExtensionServer, FormServiceExtensionSpec, SettingsFormRender, and field types from agentstack_sdk.a2a.extensions.
Inject the extension: Add a form parameter to your agent function using the Annotated type hint with FormServiceExtensionServer and FormServiceExtensionSpec.demand_settings().
Define your settings structure: Create a SettingsFormRender object with the fields you want users to configure. Only CheckboxGroupField and SingleSelectField are allowed for settings.
Check if the extension exists: Always verify that the form extension is provided before using it, as service extensions are optional.
Parse settings data: Use form.parse_settings_form() to access the user’s configuration choices.
Access field values: Use parsed_settings.values['field_id'] to access the submitted values from your settings fields.
Settings Field Types
Agent Stack supports various field types for collecting different kinds of configuration data:CheckboxGroupField
Groups multiple checkboxes together for related boolean options. A single checkbox must still be wrapped inside theCheckboxGroupField.