Files
baserow/web-frontend/modules/agent/components/AgentCreateDescribeStep.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

79 lines
2.2 KiB
Vue

<template>
<FormGroup :label="$t('agent.name')" small-label required>
<FormInput
ref="nameInput"
:model-value="modelValue.name"
:placeholder="$t('agent.setupNamePlaceholder')"
:maxlength="IDENTITY_NAME_MAX_LENGTH"
@focus.once="$event.target.select()"
@update:model-value="update({ name: $event })"
/>
</FormGroup>
<FormGroup
class="margin-top-2"
:label="$t('agent.setupWhatShouldItDo')"
small-label
required
>
<FormTextarea
:model-value="modelValue.instructions"
:placeholder="$t('agent.setupInstructionsPlaceholder')"
:rows="5"
@update:model-value="update({ instructions: $event })"
/>
</FormGroup>
<div class="agent-create__suggestions">
<button
v-for="suggestion in SETUP_SUGGESTIONS"
:key="suggestion.labelKey"
type="button"
class="agent-create__suggestion"
@click="applySuggestion(suggestion)"
>
<i class="agent-create__suggestion-icon" :class="suggestion.icon"></i>
{{ $t(suggestion.labelKey) }}
</button>
</div>
</template>
<script setup>
import { computed, nextTick, onMounted, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { useStore } from 'vuex'
import {
IDENTITY_NAME_MAX_LENGTH,
SETUP_SUGGESTIONS,
setupActionTypes,
suggestionSetup,
} from '@baserow/modules/agent/utils/agentSetup'
const props = defineProps({
modelValue: { type: Object, required: true },
workspace: { type: Object, required: true },
})
const emit = defineEmits(['update:modelValue'])
const { t } = useI18n()
const store = useStore()
const { $registry } = useNuxtApp()
const nameInput = ref(null)
const offeredActionTypes = computed(() =>
setupActionTypes($registry, props.workspace).map((type) => type.getType())
)
function update(values) {
emit('update:modelValue', { ...props.modelValue, ...values })
}
function applySuggestion(suggestion) {
const takenNames = store.getters['application/getAllOfWorkspace'](
props.workspace
).map((application) => application.name)
update(suggestionSetup(suggestion, t, offeredActionTypes.value, takenNames))
}
onMounted(async () => {
await nextTick()
nameInput.value?.focus()
})
</script>