Files
baserow/web-frontend/modules/agent/components/configuration/AgentSettingsSection.vue
Davide Silvestri cc361e6658 feat(agent): create agents with a setup wizard (#6765)
* feat(agent): create agents with a two-step setup wizard

The create modal asks for a name and what the agent should do, then reviews
instructions, how it starts, the identity it acts as, permissions and extras.
The choices are applied through the endpoints Configuration uses; a choice
that can't be applied is reported and the agent still opens.

The Run as dropdown can also create an identity. Application types supply
their create modal through getCreateModalComponent.

* feat(agent): add tools, model and identity choices to the create wizard

The wizard gains a third screen for the provider, model, reasoning effort and
web search. Review can create an identity and pick tools one by one. Each
suggestion now fills the whole setup: how the agent starts, its schedule,
permissions, web search and actions.

A new endpoint lists the tools an agent created in a workspace can be given,
so they can be picked before the agent exists. The provider, model and effort
fields are one component shared by Configuration and the wizard.

* fix(agent): choose the wizard identity role from workspace tools

* fix(agent): address create wizard review

Skip locked tools in the permission presets, create the identity before
the agent so a rejected name stops the wizard, number suggestion names,
select the prefilled name, report models that can't search the web, show
a failed tools request and fix the Read only icon.

* fix(agent): address second create wizard review

Give a new identity Builder when the agent may change data, reuse the
identity a failed create made, explain why web search stays off and pass
the workspace to the tool picker.
2026-11-20 14:32:37 +01:00

87 lines
2.3 KiB
Vue

<template>
<FormGroup
:label="$t('agent.name')"
:error="!name.trim()"
:error-message="name.trim() ? '' : $t('error.requiredField')"
small-label
required
>
<FormInput
:model-value="name"
:error="!name.trim()"
:disabled="!editable"
:maxlength="160"
@update:model-value="$emit('update:name', $event)"
@blur="$emit('rename')"
/>
</FormGroup>
<AgentModelFields
ref="modelFields"
class="margin-top-2"
:values="configuration"
:enabled-models="enabledModels"
:error-messages="errorMessages"
:disabled="!editable"
:availability-loading="availabilityLoading"
@change="changeModelFields"
/>
<AgentWebSearchSetting
class="margin-top-3"
:configuration="configuration"
:editable="editable"
@change="changeWebSearch"
/>
<AgentWebFetchSetting
class="margin-top-3"
:configuration="configuration"
:editable="editable"
@change="changeWebFetch"
/>
</template>
<script setup>
import { computed, ref } from 'vue'
import AgentModelFields from '@baserow/modules/agent/components/AgentModelFields'
import AgentWebSearchSetting from '@baserow/modules/agent/components/configuration/AgentWebSearchSetting'
import AgentWebFetchSetting from '@baserow/modules/agent/components/configuration/AgentWebFetchSetting'
const props = defineProps({
name: { type: String, required: true },
configuration: { type: Object, required: true },
errors: { type: Object, required: true },
enabledModels: { type: Object, required: true },
sectionType: { type: Object, required: true },
editable: Boolean,
availabilityLoading: Boolean,
})
const emit = defineEmits(['update:name', 'rename', 'change', 'flush'])
const modelFields = ref(null)
const errorMessages = computed(() =>
Object.fromEntries(
['provider_type', 'model_identifier'].map((field) => [
field,
props.sectionType.getFieldErrorMessage(field, props.errors[field]),
])
)
)
function changeModelFields(values) {
emit('change', values)
emit('flush')
}
function changeWebSearch(enabled) {
emit('change', { web_search_enabled: enabled })
emit('flush')
}
function changeWebFetch(enabled) {
emit('change', { web_fetch_enabled: enabled })
emit('flush')
}
const focusField = (field) => modelFields.value?.focusField(field)
defineExpose({ focusField })
</script>