AI Assistant
The AI Assistant is an intelligent chat interface integrated into the workflow editor that can create workflow entities on your behalf. It uses natural language understanding combined with documentation search (RAG) to understand your intent and generate entities automatically.
Overview
The Assistant provides a conversational way to build workflows:
- Natural Language Entity Creation — Describe what you want, and the assistant creates it
- Context-Aware — Uses documentation search to understand available functions and patterns
- Tool Calling — Actually creates entities in the database, not just explanations
Accessing the Assistant
The Assistant tab is available in the workflow editor sidebar:
- Open a workflow from the Workflows page
- Click the Assistant tab in the left sidebar
- Type your request in the chat input
Example Prompts
The Assistant understands various ways to request entity creation:
| Request | What Gets Created |
|---|---|
| "Create an action that posts to Mastodon" | Action entity with Mastodon posting script |
| "Create an event for NFL touchdowns" | Event entity with touchdown condition |
| "Create a prompt for generating tweets" | Prompt entity with tweet generation template |
| "Create an action to store data in S3" | Action entity with STM script |
How It Works
1. Documentation Search (RAG)
When you send a message, the Assistant:
- Generates an embedding of your query using OpenAI
- Searches the documentation database for relevant content
- Retrieves the most similar documentation chunks
- Uses this context to inform its response
2. Tool Calling
The Assistant can execute actions using OpenAI function calling:
Available Tools:
| Tool | Purpose |
|---|---|
create_workflow_entity | Creates a new entity in the database |
list_entity_types | Lists available entity types and their configurations |
3. Entity Creation
When creating an entity, the Assistant:
- Determines the appropriate entity type (event, action, prompt)
- Generates relevant configuration (script, prompt text, conditions)
- Creates the entity in your current organization and environment
- Returns confirmation with the created entity details
Created Entities
After the Assistant creates an entity:
- A success chip appears showing the entity name
- Click the chip to open the entity editor
- The entity is automatically added to the entities list
- You can immediately drag it onto the canvas
Context Sources
The Assistant shows which documentation informed its response:
- Click "X sources" below a response to expand
- Each source shows the document title and similarity score
- Higher similarity scores indicate more relevant context
Capabilities
The Assistant can create entities with:
For Action entities:
- Custom JavaScript scripts using available functions
print(),postToMastodon(),stmStore(),pubsubPublish()- Access to
message, environment variables, andoutputglobals
For Prompt entities:
- Prompt templates for LLM calls
- Model selection guidance
- Argument configuration
For Event entities:
- Condition expressions
- Branching logic (Single Path, True/False, Multi)
- Logic field configuration
Best Practices
Be Specific
Good: "Create an action that posts the latest AI response to Mastodon using the MASTODON_URL variable"
Bad: "Create a posting action"
Reference Available Functions
"Create an action that uses postLatestPromptToMastodon() to share AI responses"
Mention Required Variables
"Create an action that calls the API using OPENAI_API_KEY"
Configuration
The Assistant requires OpenAI API credentials:
OPENAI_API_KEY=sk-proj-xxxxxxxxxxxx
API Reference
| Operation | Method | Endpoint |
|---|---|---|
| Chat | POST | /api/assistant/chat |
| Search Docs | POST | /api/documentation/search |
Chat Request
{
"message": "Create an action that posts to Mastodon",
"history": [],
"organizationId": "org-id",
"environmentId": "env-id"
}
Chat Response
{
"message": "I have created a Post to Mastodon action...",
"context": [
{ "title": "Mastodon Scripts", "similarity": 0.89 }
],
"createdEntities": [
{ "id": "entity-id", "name": "Post to Mastodon", "type": "action" }
]
}
Related Topics
- Workflow Canvas — Visual workflow editor
- Workflow Entities — Entity types and configuration
- Scripts Reference — Available functions for scripts