Message Ingestion
Raw input enters the system and gets stored across multiple databases
PostgreSQL Storage
Stores the message in the conversations.messages table with full ACID guarantees. Links to conversation and user entities.
- Table: conversations.messages
- Rows: 1 inserted
- Relationships: user_id, conversation_id
- Indexes: Updated (user_id, timestamp)
Redis Cache
Caches the session state and last 10 messages for ultra-fast retrieval. TTL set to 1 hour.
- Key: session:user_789:active_conv
- Type: Hash
- TTL: 3600s
- Size: ~2KB
MongoDB Event Log
Creates comprehensive audit trail with full message payload and metadata for analytics.
- Collection: conversation_logs
- Document size: ~1.5KB
- Indexed: timestamp, user_id
- Retention: 90 days
Knowledge Extraction
System extracts entities, concepts, and semantic meaning
Intent Detection
NLP analysis identifies primary intent as "analysis_request" with 94% confidence.
Intent: analysis_request (0.94)
Sub-intents:
- document_analysis (0.89)
- suggestion_generation (0.87)
Entities: [sales_report, quarterly]
Knowledge Graph
Creates nodes for entities and concepts, linking them to the message for traceability.
Nodes created: 3
Relationships created: 2
Graph depth: 2 levels
Query time: 42ms
Vector Embeddings
Generates 1536-dimensional embedding for semantic search and similarity matching.
Model: text-embedding-ada-002
Dimensions: 1536
Index: HNSW (M=16, ef=100)
Indexed in: 180ms
Context Assembly
Gathering relevant context from multiple memory systems
Semantic Search Results
Found 3 highly relevant documents and 2 past conversations with similarity > 0.75.
Top matches:
1. Q3_Sales_Report.pdf (0.89)
2. Previous Conv #4523 (0.82)
3. Business_Strategy_2024.pdf (0.76)
Search time: 45ms
Total candidates: 147
Episodic Memory
Retrieved 5 past conversations about sales and reports from the last 90 days.
Conversations found: 5
Date range: Last 90 days
Topics: sales, quarterly reviews
Avg similarity: 0.78
User Context
Loaded comprehensive user profile including preferences, domain knowledge, and recent activity.
Profile loaded:
- Preferences: 12 items
- Business context: e-commerce
- Expertise: business_analytics (8/10)
- Last active: 2 hours ago
Personalization Layer
Adapting response based on learned user patterns
Communication Style
User prefers balanced tone with comprehensive detail level and structured format.
Selected template:
"structured_analysis_with_recommendations"
Format includes:
- Executive summary
- Detailed findings
- Data visualizations
- Actionable recommendations
Behavioral Patterns
Historical data shows user responds best to actionable insights with visual elements.
Successful patterns:
- Data visualizations: 92% positive
- Actionable steps: 88% positive
- Technical details: 45% follow-ups
Avoid: heavy jargon
Temporal Context
Time of day indicates deep work mode; user expects thorough, comprehensive responses.
Current context:
- Time: 10:00 AM (deep work)
- Day: Tuesday (business focus)
- Avg session: 15 minutes
- Expected depth: High
Cognition Cycle
Planning, reasoning, and executing multi-agent response generation
Task Planning
Main task decomposed into 5 sequential subtasks with clear dependencies.
Task hierarchy:
Main: analyze_and_suggest
ββ parse_document (1.2s)
ββ compare_historical (0.5s)
ββ identify_patterns (0.8s)
ββ generate_suggestions (0.6s)
ββ format_response (0.4s)
Total estimated: 3.5s
Agent Orchestration
4 specialized agents working in coordinated sequence with dependency management.
Agents involved:
1. DocumentAnalyzer
2. DataAnalyst
3. BusinessAdvisor
4. ResponseComposer
Dependencies resolved
Execution order: 1β2β3β4
Reasoning Trace
System applies deductive and inductive reasoning to generate evidence-based recommendations.
Reasoning applied:
- Deductive: Extract facts
- Inductive: Identify patterns
- Abductive: Best explanation
Confidence: 87%
Alternatives considered: 2
Memory Formation
Creating episodic memory of this interaction for future reference and learning.
Episode created:
- ID: "Q3_sales_analysis_2024"
- Context: Business analysis
- Outcome: Recommendations provided
- Importance: 8/10
- Emotional valence: Positive
Response & Feedback Loop
Delivering response and tracking engagement for continuous learning
Response Delivery
Generated comprehensive response with 1247 tokens, 3 citations, and data visualizations.
Response metadata:
- Generation time: 4.3s
- Token count: 1247
- Sources cited: 3
- Agents involved: 4
- Format: Structured markdown
Engagement Tracking
Monitoring user interaction to measure response quality and satisfaction.
Engagement metrics:
- Read time: 3 minutes
- Scroll depth: 95%
- Citations clicked: 2 of 3
- Text copied: Yes
- Feedback: π (positive)
Learning Updates
System learns from this successful interaction to improve future responses.
Updates applied:
β Personalization profile updated
β Knowledge graph strengthened
β Episodic memory consolidated
β Response pattern recorded
Quality score: 0.92
Provenance Chain
Complete audit trail linking response to sources, agents, and reasoning processes.
Provenance established:
- Response β 4 Agents
- Response β 3 Source Documents
- Response β 2 Reasoning Types
- Response β User Satisfaction
Traceability: Complete
π― Complete Journey: 4.3 Seconds
From a single user message to an intelligent, personalized response β orchestrating 6 databases, 4 agents, and 5 cognitive stages.