Skip to content

AI Brain MVP v2

An intelligent coaching assistant that analyzes youth entrepreneur situations and provides stage-specific guidance to coaches working with young entrepreneurs in East Africa. The system uses a 15-stage pedagogical model to identify where youth are in their entrepreneurial journey and suggests targeted micro-actions for coaches to recommend.

Purpose

No business context provided yet — add a context.md to enrich this documentation.

This workflow serves as a decision-support tool for peer leaders and mobilizers who coach youth entrepreneurs. It helps coaches: - Quickly assess which stage of entrepreneurial development their youth is at - Receive specific, actionable advice on what to say or do next - Access relevant micro-actions and bottleneck solutions for each stage - Get general information about the 15-stage pedagogical model

The system bridges the gap between theoretical coaching frameworks and practical, in-the-moment guidance that coaches need when supporting youth entrepreneurs.

How It Works

  1. Message Reception: A coach sends a message through the chat interface
  2. Message Classification: The system determines if the message is about a specific youth situation or a general inquiry
  3. General Path: For general questions, provides information about the pedagogical model and how to use the tool
  4. Youth Analysis Path: For specific youth situations:
    • Analyzes the youth's current stage using AI reasoning
    • Extracts the stage ID from the analysis
    • Retrieves detailed stage information including goals, skills, bottlenecks, and micro-actions
    • Generates specific coaching suggestions tailored to that stage
  5. Response Delivery: Returns actionable advice formatted for the coach

Workflow Diagram

graph TD
    A[When chat message received] --> B[Set:Load Stage Data]
    B --> C[LLM:Route Message]
    C --> D[Code:Parse Route]
    D --> E[IF:Route]

    E -->|YOUTH_SITUATION| F[LLM:Thinking Step]
    E -->|GENERAL| G[LLM:General Response]

    F --> H[Code:Extract Stage ID]
    H --> I[Code:Get Stage Details]
    I --> J[LLM:Suggest Next Steps]
    J --> K[Code:Format Output]

    G --> L[Code in JavaScript]

    M[OpenRouter Chat Model] -.-> C
    N[OpenRouter:Thinking] -.-> F
    O[OpenRouter:Suggestions] -.-> J
    P[OpenRouter Chat Model1] -.-> G

Trigger

Chat Trigger: Public webhook that accepts chat messages from coaches. The trigger is configured to be publicly accessible and processes incoming chat input along with session IDs.

Nodes Used

Node Type Node Name Purpose
Chat Trigger When chat message received Receives incoming chat messages from coaches
Set Set:Load Stage Data Loads the 15-stage model data and extracts user message
LLM Chain LLM:Route Message Classifies messages as general or youth-specific
Code Code:Parse Route Processes routing decision and prepares data
If IF:Route Routes to appropriate processing path
LLM Chain LLM:Thinking Step Analyzes youth situation to determine current stage
Code Code:Extract Stage ID Extracts stage identifier from AI analysis
Code Code:Get Stage Details Retrieves comprehensive stage information from database
LLM Chain LLM:Suggest Next Steps Generates coaching suggestions for specific stage
LLM Chain LLM:General Response Handles general inquiries about the model
Code Code:Format Output Formats final response for youth situations
Code Code in JavaScript Formats final response for general inquiries
OpenRouter LLM Multiple instances Provides AI language model capabilities

External Services & Credentials Required

OpenRouter API: - Service: OpenRouter (AI language model provider) - Credential: openRouterApi (ID: Az2rKAl4uVoFJhBr) - Used for: All AI reasoning, analysis, and response generation - Required for: Message routing, stage analysis, and coaching suggestions

Environment Variables

No environment variables are explicitly configured in this workflow. All configuration is handled through: - Hardcoded stage data in the Code:Get Stage Details node - OpenRouter API credentials stored in n8n's credential system

Data Flow

Input: - chatInput: Coach's message describing youth situation or general inquiry - sessionId: Chat session identifier for conversation tracking

Processing: - Stage list and count (15 stages from S1-S15) - User message classification (GENERAL vs YOUTH_SITUATION) - Stage analysis and identification - Detailed stage information retrieval - Coaching suggestion generation

Output: - output: Formatted response containing either: - General information about the pedagogical model - Specific coaching suggestions with stage analysis and micro-actions

Error Handling

The workflow includes basic error handling through: - Default stage assignment (S1) if stage extraction fails - Fallback responses in case of AI processing errors - Route validation to ensure proper message classification

No explicit error nodes are present, but the system gracefully handles missing or malformed data through defensive coding practices.

Known Limitations

Based on the workflow structure: - Relies on external OpenRouter API availability - Stage data is hardcoded in JavaScript rather than stored in a database - No conversation history or context retention between sessions - Limited to 15 predefined stages with no dynamic stage creation - No user authentication or access control

No related workflows are mentioned in the available context.

Setup Instructions

  1. Import Workflow: Import the JSON workflow file into your n8n instance

  2. Configure OpenRouter Credentials:

    • Create an OpenRouter account and obtain API key
    • In n8n, go to Credentials → Add Credential → OpenRouter API
    • Enter your API key and save as "OpenRouter account 2"
  3. Activate Workflow:

    • Open the workflow in n8n
    • Click "Active" to enable the chat trigger
    • Note the webhook URL for the chat interface
  4. Test the Setup:

    • Send a general message like "What is Stage 5?" to test general responses
    • Send a youth situation like "I have a youth who is selling tomatoes but struggling with pricing" to test stage analysis
  5. Integration:

    • Use the webhook URL to integrate with your chat interface
    • Ensure proper session ID handling for conversation tracking
  6. Customization:

    • Modify stage data in the "Code:Get Stage Details" node if needed
    • Adjust prompts in LLM nodes to match your coaching context
    • Update the stage list in "Set:Load Stage Data" if stages change