StackSpot Action AI Prompt Execution
This StackSpot Action allows you to create and execute a Quick Command using the StackSpot API. It supports creating a Quick Command execution, retrieving its details, and executing specific steps within the Quick Command.
Action:
stackspot-core/stackspot-ai-quick-command@0
Features
- Create a Quick Command execution.
- Retrieve details about the Quick Command execution.
Inputs
| Name | Type | Description | Required | Default Value |
|---|---|---|---|---|
quick_command_slug | String | The slug of the Quick Command to be executed. | Yes | N/A |
conversation_id | String | The conversation ID to keep context across multiple executions. | No | Automatically generated ULID |
Usage Example
Workflow Example
See example of how to use this Action in a StackSpot Workflow:
Outputs
| Name | Type | Description |
|---|---|---|
answer | String | The AI generated a response for the given prompt. |
Context
The Action collects the following contextual information to enhance the AI's response:
- Account Slug: Identifier of the user's account.
- Account ID: ID of the user's account (v2).
- Username: User's email address.
- Operating System: Operating system of the user's environment.
- Conversation ID: Unique identifier of the conversation.
- Workspace: Workspace ID resolved by the CLI.
- Platform: Platform in use (in this case, CLI).
- Knowledge Source: List of Knowledge Sources provided as input.
Implementation
The action is implemented in Python and involves the following steps:
- Input Handling: It reads the
prompt,knowledge_sources, and optionally theconversation_idfrom the input metadata. - Context Creation: It builds a context dictionary using the
contextfunction, including details such as account information, OS, Workspace, and other relevant data. - AI Interaction: It calls the
prompt_code_buddyfunction from theoscli.apis.ai.codebuddy.servicemodule, passing the prompt and the context. - Output: It prints the AI's response and sets it as
answerin the output metadata, making it available for other Workflow steps.
Usage Example
schema-version: v1
kind: workflow
metadata:
name: example
display-name: example
description: example
version: 0.0.1
spec:
type: reusable
label: example
inputs:
- name: prompt
label: prompt
type: text
jobs:
- id: job_1
label: Interact with AI
steps:
- id: step_1
label: Interact with AI
name: "stackspot-core/stackspot-ai@1"
type: action
inputs:
prompt: "{{ inputs.prompt }}"
conversation_id: "{{ var.STK_WORKFLOW_EXECUTION_ID }}"
agent_id: 01JSMM61QVZTSS7C03DDC5T7ME