AI Generator Setup in Action Jail (Administrator)
The AI generator in the Action Jail action editor allows quick generation of code, JSON config, and documentation using an LLM (without connecting an agent). To work, you need to configure an API key (OpenAI token) for the selected process (bot).
When to use
- You need to use the "Quick Generate", "Generate from Code", "Generate Documentation" buttons in the action editor.
- AI generation does not work or shows the error "Select a process (bot) in the sidebar".
What to know
- Token is stored at the process (bot) level — each bot can have its own key.
- Fallback source — if the bot has no key, the global
openai_tokenfrom Instance Settings is used. - No agent — generation goes directly via the
POST /kw/fast_line/ai_text_editor/endpoint, without Instance Agent or MCP.
Before you start
You have an OpenAI API key (or compatible provider via Portkey). You have permissions to configure the process (bot) or Instance Settings. A process (bot) is selected in the Constructor sidebar — otherwise AI generation will show an error.
Step-by-step instructions
Option 1: Token for a specific process (bot)
- Open Fast Line (or another module where the OpenAI token for the bot is configured).
- Select the required process (bot) in the sidebar.
- In the Import section (or equivalent), find the "OpenAI Token" / "Add Token" block.
- Enter the API key and save.
- In Action Jail, select the same process in the sidebar — AI generation will work for this bot.
Technical details: The token is stored in kw_bots.custom_json.openai.token for the selected bot_id.
Option 2: Global token (Instance Settings)
- Open Settings → Instance Settings (or equivalent for your instance).
- Find the key
openai_token. - Set the value — OpenAI API key.
- Save. This token is used if the bot has no key of its own.
Technical details: The value is stored in kw_engine_settings with key = 'openai_token'.
Where groups and descriptions appear
- Action groups — in the Action Jail library in the "Select action group" dropdown (left sidebar when opening an action).
- Action description — in the "Describe the action functionality..." field in the "Action Information" section; used for hints and reference guides.
- Parameter description — in each parameter in the JSON config / UI schema; displayed as a hint next to the field in the Scenario Builder form.
How to verify success
- A process (bot) is selected in Action Jail in the sidebar.
- Clicking "Quick Generate" or "Generate from Code" does not show the "Select process" error.
- Generation returns a result (code, JSON, or text) instead of a network or 422 error.
Troubleshooting
| Problem | Solution |
|---|---|
| "Select a process (bot) in the sidebar" | Select a bot in the Constructor sidebar before using AI generation. |
| 422 / token data error | Verify the token is saved for the selected bot or in Instance Settings. |
| Generation does not respond | Verify you are using a valid API key and the provider (OpenAI/Portkey) is supported. |