Skip to main content
Sometimes you need to give users control over how your agent behaves during a conversation. For example, users might want to enable or disable thinking mode, choose between different response styles, or configure other agent-specific parameters. The Agent Stack platform provides a settings as a part of Form extension that creates an interactive UI component where users can configure these options before or during their interaction with your agent.
Settings extensions are a type of form Service Extension that allows you to easily “inject dependencies” into your agent. This follows the inversion of control principle where your agent defines what it needs, and the platform provides those dependencies.

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: Import FormServiceExtensionServer, 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 are presented to users in a clean, organized interface that makes it easy to configure your agent’s behavior. The platform automatically handles the UI rendering and data collection.
Check if the extension exists: Always verify that the form extension is provided before using it, as service extensions are optional.

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 the CheckboxGroupField.

SingleSelectField

Dropdown fields for choosing an option from a list: