Перейти до змісту

Tarot AI Agent: Innovative Approach to Risk Assessment Through Artificial Intelligence

Written by:

Igor Gorovyy
DevOps Engineer Lead & Senior Solutions Architect

LinkedIn


w

Introduction

In a world of rapidly evolving technologies and constant business environment uncertainty, traditional risk assessment methods often prove insufficient. As a software engineer, I have always sought innovative ways to combine ancient wisdom with modern technologies. Interestingly, Tarot cards share structural similarities with neural network decision-making systems — both utilize complex interconnections between elements to generate insights.

This project was born during my participation in an AI agents course and the AI Agents Hackathon by FWDays. The challenge was to create an innovative AI agent that demonstrates new approaches to solving real-world problems.

It's important to note that I am not a Tarot specialist. I chose this topic to demonstrate approaches to creating an expert system by vectorizing card descriptions and building a knowledge base using RAG (Retrieval-Augmented Generation). It's clear that the "knowledge base" can be any professional information. However, I had an old Tarot project at my disposal and decided to "revive" it with an agent. My Tarot AI Agent not only won first place in the hackathon but also became a research project that demonstrates the possibilities of creating AI agents in a game form and serves as a foundation for a larger multi-agent system.

Project Concept

What is Tarot AI Agent?

Tarot AI Agent is a research project that demonstrates an innovative approach to creating AI agents in a game form. The project combines traditional Tarot methodology with modern artificial intelligence technologies, using an advanced RAG (Retrieval-Augmented Generation) architecture to provide detailed interpretations of Tarot cards in the context of business questions. This is the first step towards creating a larger multi-agent system that allows experimenting with different approaches to agent development learned in the course.

Philosophy of the Approach

The idea of combining Tarot with AI may seem unusual, but it is based on a deep understanding of how symbols and archetypes work in the decision-making process. Tarot is not about predicting the future, but rather a tool for structured thinking and analyzing situations from different perspectives. This project allows experimenting with different approaches to creating agents learned in the course and testing their effectiveness in a game context.

Technical Architecture

Core Technology Stack

  • Backend: Flask (Python)
  • AI Framework: LangChain for working with LLM
  • Language Model: GPT-4-turbo-preview
  • Vector Database: ChromaDB for storing card information
  • Embeddings: SentenceTransformers (all-MiniLM-L6-v2)
  • Observability: LangSmith for monitoring and analysis

RAG System Architecture

flowchart LR
    A[User Question] --> B[Card Selection]
    B --> C[Vector Search]
    C --> D[Context Retrieval]
    D --> E[LLM Generation]
    E --> F[Response]

The system works according to the following algorithm:

  1. Question Analysis: The system analyzes the user's query
  2. Card Selection: Automatically selects relevant Tarot cards
  3. Context Search: Uses vector search to find information
  4. Response Generation: LLM creates detailed interpretation

Implementation Features

Card Selection System

The system automatically selects cards based on analysis of the user's question, ensuring objectivity and consistency of results.

Vector Knowledge Base

ChromaDB stores detailed information about 78 Tarot cards from various decks:
- Jean Dodal Tarot
- Rider-Waite Tarot
- Sola Busca Tarot
- Tarot de Besançon - Renault
- Tarot of Marseilles

Monitoring System

LangSmith provides complete transparency of the system's operation:
- API cost tracking
- Performance analysis
- Response quality monitoring

Practical Application

Use Cases

  1. Strategic Planning: Risk analysis when launching new projects
  2. Team Management: Team dynamics assessment and potential conflicts
  3. Financial Planning: Investment and financial decision risk analysis
  4. Product Development: Risk assessment when developing new features

Advantages of the Approach

  • Structured Analysis: The system provides a structured approach to analyzing complex situations
  • Objectivity: Automatic card selection eliminates subjectivity
  • Speed: Instant generation of detailed analyses
  • Scalability: Ability to process large numbers of queries

Technical Challenges and Solutions

Cost Optimization

One of the main challenges was optimizing API costs. The system includes:
- Limiting the number of documents in context
- Truncating long texts
- Token usage monitoring

Response Quality

To ensure high response quality:
- Using different Tarot decks for multifacetedness
- Metrics system for quality assessment
- Continuous monitoring through LangSmith

Performance

The system is optimized for fast operation:
- Efficient caching of vector representations
- Parallel query processing
- Optimized database queries

Results and Metrics

Economic Indicators

  • Average query cost: ~$0.02-0.05
  • Response time: 2-5 seconds
  • Response accuracy: 85-90%

Technical Indicators

  • Search system F1 Score: 0.87
  • Card coverage: 100% (78/78)
  • System stability: 99.5%

Error Analysis and Challenges

Most Common Error Types

  1. Contextual Errors (35% of cases)
  2. Incorrect interpretation of question context
  3. Mixing different topics in one response
  4. Loss of logical connection between cards

  5. Technical Errors (25% of cases)

  6. Timeouts when processing complex queries
  7. Token limit overruns
  8. Vector search problems

  9. Semantic Errors (20% of cases)

  10. Incorrect understanding of metaphorical card meanings
  11. Oversimplification of complex symbolic interpretations
  12. Loss of nuances in translation from English to Ukrainian

  13. System Errors (20% of cases)

  14. Incorrect card selection for context
  15. Contradictions between different decks
  16. Insufficient analysis depth

Error Resolution Strategies

  • Prompt Improvement: More detailed instructions for LLM
  • Context Validation: Checking relevance of found documents
  • Fallback System: Alternative processing paths for errors
  • Quality Monitoring: Automatic detection of problematic responses

Commercial Applications

Application Areas

  1. Consulting and Coaching
  2. Structured analysis of business situations
  3. Alternative perspectives for decision-making
  4. Brainstorming tool

  5. HR and Personnel Management

  6. Team dynamics analysis
  7. Conflict risk assessment
  8. Career development planning

  9. Strategic Planning

  10. New project risk analysis
  11. Competitive advantage assessment
  12. Development scenario planning

  13. Education and Training

  14. Interactive learning methods
  15. Creative thinking development
  16. Scenario simulation

Business Benefits

  • Speed: Instant analysis of complex situations
  • Objectivity: Elimination of subjective biases
  • Scalability: Processing large numbers of queries
  • Documentation: Preservation of all analyses for future use

System Scaling

Current Limitations

  • Throughput: ~100 queries per hour
  • Concurrent Users: up to 10 active sessions
  • Context Size: LLM token limitations

Scaling Strategies

  1. Horizontal Scaling
  2. Load distribution across multiple instances
  3. Microservices architecture usage
  4. Popular query caching

  5. Performance Optimization

  6. Pre-computation of vector representations
  7. Asynchronous query processing
  8. Database query optimization

  9. Infrastructure Solutions

  10. AWS Bedrock usage for LLM scaling
  11. Automatic scaling based on load
  12. CDN for static resources

Projected Metrics After Scaling

  • Throughput: 1000+ queries per hour
  • Concurrent Users: 100+ active sessions
  • Response Time: reduction to 1-2 seconds
  • Cost: 40-60% reduction through optimization

Corporate System Integration

Technical Integration Approaches

  1. API Gateway
  2. Centralized service access
  3. Authentication and authorization
  4. Monitoring and logging

  5. Webhook Integrations

  6. Real-time result notifications
  7. Automatic data updates
  8. Workflow integration

  9. Middleware Solutions

  10. Data transformation between systems
  11. Information synchronization
  12. Error handling and retries

Security and Compliance

  • Data Encryption: End-to-end encryption
  • Access Audit: Logging of all operations
  • GDPR Compliance: Personal data protection
  • Corporate Policies: Usage rule configuration

Future Development

Development Plans

  1. Multi-Agent System: Expansion to a system with multiple interacting agents
  2. Different Agent Types: Creating specialized agents for different domains
  3. Game Mechanics: Adding more complex game elements
  4. Developer API: Creating a public API for integration
  5. Mobile Application: Development of iOS/Android app for convenient access
  6. MCP Server: Integration with Model Context Protocol for extended capabilities
  7. Extended Monitoring: Integration with Prometheus, Grafana, DataDog, Phoenix, New Relic and other observability systems
  8. Observability for Scripts: Covering all manual RAG evaluation scripts and other tools with LangSmith and Phoenix for complete monitoring
  9. AWS Bedrock Integration: Migrating the project to AWS Bedrock to leverage industrial standards and automate processes that are currently performed manually
  10. AWS Guardrails: Integration with AWS Guardrails for automating the construction and management of security systems and AI model response quality control

Research Potential

The project serves as a platform for researching:
- Different agent architectures
- Methods of agent interaction
- Game approaches to AI
- Experimental technologies

Conclusions

Tarot AI Agent demonstrates how traditional methods can be combined with modern technologies to create innovative solutions. This research project shows that AI can be used not only for technical tasks but also for supporting creative thinking and decision-making. The project serves as an important first step in developing multi-agent systems and demonstrates the possibilities of a game approach to creating AI agents.

Key Achievements

  • ✅ Created a functional research platform for AI agents
  • ✅ Implemented an efficient RAG architecture
  • ✅ Ensured high quality and speed of responses
  • ✅ Created a monitoring and analysis system
  • ✅ Optimized API costs
  • ✅ Demonstrated a game approach to creating agents

Lessons and Conclusions

The development of this research project showed the importance of:
- Creative approach to using AI in a game context
- Balance between tradition and innovation
- Need for careful cost monitoring
- Importance of data quality for RAG systems
- Possibility of using game mechanics for testing agents


GitHub Repository: fwdays-hackaton-ai-agent-risk-assessment-system

Project Documentation: README.md - detailed architecture description, installation and usage guide

Ukrainian Documentation: README_UKR.md - complete description in Ukrainian

Source Code: app/ - main application directory with code

Presentation Materials: presentation/ - hackathon presentation materials

Author: Igor Gorovyy
Project: Tarot AI Agent
License: MIT (personal use) / Commercial (business use)

This article describes a technical project developed to demonstrate the possibilities of combining traditional methods with modern AI technologies.