Skip to content

AI Brain MVP v2

An intelligent coaching assistant that helps peer leaders and mobilizers guide youth entrepreneurs in East Africa through a structured 15-stage pedagogical model, from initial business activation to sustainable growth and long-term vision development.

Purpose

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

This workflow serves as an AI-powered coaching support system for peer leaders and mobilizers working with youth entrepreneurs in East Africa. The system analyzes descriptions of youth situations and provides stage-appropriate guidance based on a comprehensive 15-stage entrepreneurial development model that progresses from psychological activation through business building to sustainable growth.

How It Works

  1. Message Reception: A coach sends a message through the chat interface describing either a general question or a specific youth situation
  2. Message Classification: The system determines whether the message is a general inquiry about the pedagogical model or describes a specific youth situation
  3. General Response Path: For general questions, provides information about the 15-stage model, explains specific stages, or helps coaches understand how to use the tool
  4. Youth Analysis Path: For specific youth situations, analyzes the description to determine which of the 15 stages (S1-S15) the youth is currently at
  5. Stage Identification: Extracts the appropriate stage ID and retrieves detailed information about that stage including goals, skills, bottlenecks, and micro-actions
  6. Coaching Recommendations: Generates specific, actionable advice for what the coach should say or do next with their youth, tailored to the identified stage
  7. Response Delivery: Returns practical suggestions in plain English that coaches can translate to local languages

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 -->|GENERAL| F[LLM:General Response]
    F --> G[Code in JavaScript]

    E -->|YOUTH_SITUATION| H[LLM:Thinking Step]
    H --> I[Code:Extract Stage ID]
    I --> J[Code:Get Stage Details]
    J --> K[LLM:Suggest Next Steps]
    K --> L[Code:Format Output]

    M[OpenRouter Chat Model] -.->|AI Model| C
    N[OpenRouter:Thinking] -.->|AI Model| H
    O[OpenRouter:Suggestions] -.->|AI Model| K
    P[OpenRouter Chat Model1] -.->|AI Model| F

Trigger

Chat Trigger: Public webhook that accepts chat messages from coaches. The trigger is configured to be publicly accessible and captures both the chat input and session ID.

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 pedagogical model data and extracts user message
LLM Chain LLM:Route Message Classifies messages as general questions or youth-specific situations
Code Code:Parse Route Processes routing decision and prepares data for appropriate path
If IF:Route Routes workflow based on message classification
LLM Chain LLM:General Response Handles general questions about the pedagogical model
LLM Chain LLM:Thinking Step Analyzes youth situations to identify current stage
Code Code:Extract Stage ID Extracts stage identifier (S1-S15) from AI analysis
Code Code:Get Stage Details Retrieves comprehensive stage information from embedded data
LLM Chain LLM:Suggest Next Steps Generates coaching recommendations based on stage analysis
Code Code:Format Output Formats final response for delivery
Code Code in JavaScript Formats general responses

External Services & Credentials Required

OpenRouter API: - Service: OpenRouter (AI model routing service) - Credential Name: "OpenRouter account 2" - Used for: All LLM operations including message routing, youth analysis, and response generation - Required: API key for OpenRouter service

Environment Variables

No specific environment variables are configured in this workflow. All configuration is handled through the OpenRouter API credentials.

Data Flow

Input: - Chat messages from coaches containing either general questions or descriptions of youth situations - Session ID for conversation tracking

Processing: - Message classification (general vs. youth-specific) - Stage analysis using 15-stage entrepreneurial development model - Retrieval of stage-specific guidance including goals, skills, bottlenecks, and micro-actions

Output: - For general questions: Explanatory information about the pedagogical model - For youth situations: Specific coaching recommendations including what to say and do next - All responses formatted in plain English for easy translation to local languages

Error Handling

The workflow includes basic error handling through: - Default stage assignment (S1) if stage extraction fails - Fallback text extraction from AI responses using multiple JSON properties - Route classification with uppercase normalization and trim operations

No explicit error nodes or comprehensive error handling paths are implemented.

Known Limitations

Based on the workflow structure: - Relies on accurate AI classification of message types - Stage identification depends on AI analysis quality - No conversation history or context retention between sessions - Limited to the predefined 15-stage model structure - No validation of coach credentials 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 API account
    • Generate an API key
    • Add credentials in n8n with name "OpenRouter account 2"
    • Apply credentials to all OpenRouter nodes
  3. Activate Chat Trigger:

    • The chat trigger will generate a public webhook URL
    • Note the webhook ID: 70851f21-844f-4a07-8952-f5b6cf1af9cb
    • Configure your chat interface to send messages to this endpoint
  4. Test the Workflow:

    • Send a general question like "What is Stage 5?"
    • Send a youth situation description to test stage analysis
    • Verify responses are appropriate for each message type
  5. Deploy:

    • Ensure the workflow is activated
    • Share the chat interface with peer leaders and mobilizers
    • Provide training on how to describe youth situations effectively

The workflow is ready to use once credentials are configured and the trigger is activated.