{
  "source_file": "0930",
  "source_platform": "Medium",
  "author": "Ingo Nowitzky",
  "title_listed": "Hybrid AI: Combining Deterministic Analytics with LLM Reasoning",
  "keywords": "",
  "domain": "大模型算法",
  "content_type": "深度技术解析",
  "is_paid_flag": "否",
  "url": "https://towardsdatascience.com/hybrid-ai-combining-deterministic-analytics-with-llm-reasoning/",
  "publish_date": "2026-05-22",
  "corpus_stage": "",
  "notes": "",
  "id": "605cdd7f40a1",
  "collected_at": "2026-10-02T10:11:41",
  "title": "Hybrid AI: Combining Deterministic Analytics with LLM Reasoning | Towards Data Science",
  "body_markdown": "![Revisit consent button](../images/body-df29beacd7496220cc94.svg)\nWe value your privacy\nWe use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking \"Accept All\", you consent to our use of cookies.\nCustomise Reject All Accept All\nCustomise Consent Preferences ![](../images/body-2159bb67f3de8ad870eb.svg)\nWe use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.\nThe cookies that are categorised as \"Necessary\" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... Show more\nNecessaryAlways Active\nNecessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.\n  * Cookie\nBCTempID\n  * Duration\n10 minutes\n  * Description\nNo description available.\n\n\n  * Cookie\n__cf_bm\n  * Duration\n1 hour\n  * Description\nThis cookie, set by Cloudflare, is used to support Cloudflare Bot Management. \n\n\n  * Cookie\nAWSALBCORS\n  * Duration\n7 days\n  * Description\nAmazon Web Services set this cookie for load balancing.\n\n\n  * Cookie\n_cfuvid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to track users across sessions to optimize user experience by maintaining session consistency and providing personalized services\n\n\n  * Cookie\nli_gc\n  * Duration\n6 months\n  * Description\nLinkedin set this cookie for storing visitor's consent regarding using cookies for non-essential purposes.\n\n\n  * Cookie\n__hssrc\n  * Duration\nsession\n  * Description\nThis cookie is set by Hubspot whenever it changes the session cookie. The __hssrc cookie set to 1 indicates that the user has restarted the browser, and if the cookie does not exist, it is assumed to be a new session.\n\n\n  * Cookie\n__hssc\n  * Duration\n1 hour\n  * Description\nHubSpot sets this cookie to keep track of sessions and to determine if HubSpot should increment the session number and timestamps in the __hstc cookie.\n\n\n  * Cookie\nwpEmojiSettingsSupports\n  * Duration\nsession\n  * Description\nWordPress sets this cookie when a user interacts with emojis on a WordPress site. It helps determine if the user's browser can display emojis properly.\n\n\n  * Cookie\nBCSessionID\n  * Duration\n1 year 1 month 4 days\n  * Description\nBlueconic sets this cookie as a unique identifier for the BlueConic profile.\n\n\n  * Cookie\n_octo\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nlogged_in\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\n__Secure-YEC\n  * Duration\npast\n  * Description\nYouTube sets this cookie to stores the user's video player preferences using embedded YouTube video\n\n\n  * Cookie\n__eoi\n  * Duration\n6 months\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTGCORS\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\nlogin-status-p\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTG\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\ncsrf_token\n  * Duration\nsession\n  * Description\nNo description available.\n\n\n  * Cookie\ntoken_v2\n  * Duration\n1 day\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nD\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nPHPSESSID\n  * Duration\nsession\n  * Description\nThis cookie is native to PHP applications. The cookie stores and identifies a user's unique session ID to manage user sessions on the website. The cookie is a session cookie and will be deleted when all the browser windows are closed.\n\n\n  * Cookie\nVISITOR_PRIVACY_METADATA\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to store the user's cookie consent state for the current domain. \n\n\n  * Cookie\ncookietest\n  * Duration\nsession\n  * Description\nThe cookietest cookie is typically used to determine whether the user's browser accepts cookies, essential for website functionality and user experience.\n\n\n  * Cookie\n__Host-airtable-session\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\n__Host-airtable-session.sig\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\nm\n  * Duration\n1 year 1 month 4 days\n  * Description\nStripe sets this cookie for fraud prevention purposes. It identifies the device used to access the website, allowing the website to be formatted accordingly.\n\n\n  * Cookie\nBIGipServer*\n  * Duration\nsession\n  * Description\nMarketo sets this cookie to collect information about the user's online activity and build a profile about their interests to provide advertisements relevant to the user. \n\n\n  * Cookie\n__cfruid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to identify trusted web traffic.\n\n\n  * Cookie\n_GRECAPTCHA\n  * Duration\n6 months\n  * Description\nGoogle Recaptcha service sets this cookie to identify bots to protect the website against malicious spam attacks.\n\n\n  * Cookie\n__Secure-YNID\n  * Duration\n6 months\n  * Description\nGoogle cookie used to protect user security and prevent fraud, especially during the login process.\n\n\n  * Cookie\ncookieyes-consent\n  * Duration\n1 year\n  * Description\nCookieYes sets this cookie to remember users' consent preferences so that their preferences are respected on subsequent visits to this site. It does not collect or store any personal information about the site visitors.\n\n\nFunctional\nFunctional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.\n  * Cookie\nlidc\n  * Duration\n1 day\n  * Description\nLinkedIn sets the lidc cookie to facilitate data center selection.\n\n\n  * Cookie\nbrw\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nbrwConsent\n  * Duration\n5 minutes\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nWMF-Uniq\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nloom_anon_comment\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nloom_referral_video\n  * Duration\nsession\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nVISITOR_INFO1_LIVE\n  * Duration\n6 months\n  * Description\nA cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface.\n\n\n  * Cookie\nyt-remote-connected-devices\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nytidb::LAST_RESULT_ENTRY_KEY\n  * Duration\nNever Expires\n  * Description\nThe cookie ytidb::LAST_RESULT_ENTRY_KEY is used by YouTube to store the last search result entry that was clicked by the user. This information is used to improve the user experience by providing more relevant search results in the future.\n\n\n  * Cookie\nyt-remote-device-id\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-name\n  * Duration\nsession\n  * Description\nThe yt-remote-session-name cookie is used by YouTube to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\nyt-remote-fast-check-period\n  * Duration\nsession\n  * Description\nThe yt-remote-fast-check-period cookie is used by YouTube to store the user's video player preferences for embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-app\n  * Duration\nsession\n  * Description\nThe yt-remote-session-app cookie is used by YouTube to store user preferences and information about the interface of the embedded YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-available\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-available cookie is used to store the user's preferences regarding whether casting is available on their YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-installed\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-installed cookie is used to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\ncp_session\n  * Duration\n3 months\n  * Description\nCodepen sets this cookie for Help systems found in the website.\n\n\n  * Cookie\nloid\n  * Duration\n1 year 1 month 4 days\n  * Description\nThis cookie is set by the Reddit. The cookie enables the sharing of content from the website onto the social media platform.\n\n\nAnalytics\nAnalytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.\n  * Cookie\n__hstc\n  * Duration\n6 months\n  * Description\nHubspot set this main cookie for tracking visitors. It contains the domain, initial timestamp (first visit), last timestamp (last visit), current timestamp (this visit), and session number (increments for each subsequent session).\n\n\n  * Cookie\nhubspotutk\n  * Duration\n6 months\n  * Description\nHubSpot sets this cookie to keep track of the visitors to the website. This cookie is passed to HubSpot on form submission and used when deduplicating contacts.\n\n\n  * Cookie\n_ga\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors.\n\n\n  * Cookie\n_ga_*\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to store and count page views.\n\n\n  * Cookie\n__Host-psifi.analyticsTrace\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n__Host-psifi.analyticsTraceV2\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n_gh_sess\n  * Duration\nsession\n  * Description\nGitHub sets this cookie for temporary application and framework state between pages like what step the user is on in a multiple step form.\n\n\n  * Cookie\nYSC\n  * Duration\nsession\n  * Description\nYSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages.\n\n\n  * Cookie\najs_anonymous_id\n  * Duration\n1 year\n  * Description\nThis cookie is set by Segment to count the number of people who visit a certain site by tracking if they have visited before.\n\n\n  * Cookie\nvuid\n  * Duration\n1 year 1 month 4 days\n  * Description\nVimeo installs this cookie to collect tracking information by setting a unique ID to embed videos on the website. \n\n\nPerformance\nPerformance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.\n  * Cookie\nAWSALB\n  * Duration\n7 days\n  * Description\nAWSALB is an application load balancer cookie set by Amazon Web Services to map the session to the target.\n\n\n  * Cookie\nacq\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nacq.sig\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nptc\n  * Duration\n2 years\n  * Description\nNo description available.\n\n\nAdvertisement\nAdvertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.\n  * Cookie\nmuc_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to collect user behaviour and interaction data to optimize the website.\n\n\n  * Cookie\nguest_id_marketing\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\nguest_id_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\npersonalization_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to integrate and share features for social media and also store information about how the user uses the website, for tracking and targeting.\n\n\n  * Cookie\nguest_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor. It registers if a user is signed in to the Twitter platform and collects information about ad preferences.\n\n\n  * Cookie\nbcookie\n  * Duration\n1 year\n  * Description\nLinkedIn sets this cookie from LinkedIn share buttons and ad tags to recognize browser IDs.\n\n\n  * Cookie\n__Secure-ROLLOUT_TOKEN\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to manage feature rollout and experimentation. It helps Google control which new features or interface changes are shown to users as part of testing and staged rollouts, ensuring consistent experience for a given user during an experiment.\n\n\n  * Cookie\nyt.innertube::nextId\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nyt.innertube::requests\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nsession_tracker\n  * Duration\nsession\n  * Description\nThis cookie is set by the Reddit. This cookie is used to identify trusted web traffic. It also helps in adverstising on the website.\n\n\n  * Cookie\nedgebucket\n  * Duration\nsession\n  * Description\nReddit sets this cookie to save the information about a log-on Reddit user, for the purpose of advertisement recommendations and updating the content.\n\n\n  * Cookie\ndid\n  * Duration\n1 year\n  * Description\nArbor sets this cookie to show targeted ads to site visitors.This cookie expires after 2 months or 1 year.\n\n\nUncategorised\nOther uncategorised cookies are those that are being analysed and have not been classified into a category as yet.\nNo cookies to display.\nReject All Save My Preferences Accept All\nToggle Search[](https://towardsdatascience.com/)Toggle Mobile Navigation\n[](https://towardsdatascience.com/)\nPublish AI, ML & data-science insights to a global community of data professionals.\nSign in[Submit an Article](https://write.insightmediagroup.io)\n[Latest](https://towardsdatascience.com/latest/)[Editor's Picks](https://towardsdatascience.com/tag/editors-pick/)[Newsletter](https://towardsdatascience.com/tag/the-variable/)[ShipAI](https://towardsdatascience.com/shipai/)\n* * *\n[Write For TDS](https://towardsdatascience.com/submissions/)\n[LinkedIn](https://www.linkedin.com/company/towards-data-science/)[X](https://x.com/TDataScience)Toggle Search\n[Agentic AI](https://towardsdatascience.com/category/artificial-intelligence/agentic-ai/)\n# Hybrid AI: Combining Deterministic Analytics with LLM Reasoning\nHow AI architecture prevents plausible but wrong analytics\n[Ingo Nowitzky](https://towardsdatascience.com/author/ingo.nowitzky/)\nMay 22, 202617 min read\n![](../images/000.png)\nGenerated by author using ChatGPT\n## Introduction\nI tried to build an agentic AI network for my company that advises manufacturing plants on how to mature their operations. The system was designed to be data-driven, allowing users to upload assessment data directly through the chat interface. The first working prototype was finished surprisingly quickly, and at first glance the results looked promising.\nThere was only one problem: Most of the results were wrong!\nEven worse, the AI quickly learned which numerical ranges looked plausible and began generating convincing — but fabricated — outputs. Combined with the eloquent language generation of the LLM, these results could easily be mistaken for truth. And this behavior was not limited to a single model. Similar patterns appeared across all tested systems: ChatGPT, Gemini Enterprise, DIA Brain, and Microsoft Copilot.\n**But plausible data is not enough, Enterprise AI systems require reliable data**.\nFurther investigation revealed recurring failure modes. Even with “Code Interpreter” enabled, the systems:\n  * skipped rows or columns,\n  * applied incorrect filters,\n  * returned identical results for different inputs,\n  * silently mixed parts of the dataset,\n  * or simply collapsed under more complex analytical tasks.\n\n\nThis led to a crucial realization:\n**Probabilistic reasoning is extremely powerful for interpretation and interaction — but foundational data analysis requires deterministic execution.**\nLearn this step by step with the interactive [AI Agents](https://roadmap.sh/ai-agents) roadmap.\n## Table of contents\n1 The Use Case  \n2 The Hybrid Architecture  \n3 The Analysis Planner  \n4 The Analysis Engine  \n5 An End-to-End example  \n6 Why AI Architecture Matters\n## 1 The Use Case\nAlthough the specific use case is of secondary importance, it is briefly outlined here to support the practical understanding of the underlying architectural challenge.\nThe primary task of our agent is to advise manufacturing plants and value streams on how to improve their operational maturity: optimizing processes, improving productivity, reducing inventory levels, and ultimately lowering operational costs. To achieve this, the consultation agent operates in two modes:\n  1. It provides generic recommendations for improving specific operational topics based on the retrieval of specialized “how-to” documentation and assessment questionnaires.\n  2. The agent is intended to analyze the current situation of a plant or value stream based on assessment results and assessors’ written recommendations. Based on this analysis, it is expected to provide highly specific recommendations for the next improvement steps.\n\n\nIn both modes — as with most LLM-based AI models — the user can interactively discuss ideas and recommendations with the agent in order to derive the most suitable action plan.\nFor the second operation mode, it is essential that the agent can reliably process and analyze assessment data. In our case, this data is provided as an Excel export from a central database. Ideally, the agent should be able to process the file without any prior manual preparation.\nThe structure of the file, however, is challenging. Since all assessment results, intermediate calculations, metadata, and detailed assessment questions are stored in separate columns, the worksheet contains more than 800 columns. The number of rows corresponds to the number of assessments in the database and can range from one to several hundreds (Fig. 1). Assessment ratings are represented as integers from 0 to 4. In addition, the file contains more than 160 free-text fields with qualitative observations, strengths, weaknesses, and recommendations from the assessors.\n![](../images/001.png)\nFigure 1: Assessment data structure | image by author\nThe analytical tasks of the agent include filtering relevant rows and columns for a specific request, calculating averages, aggregating maturity scores, summarizing textual recommendations, and deriving meaningful improvement suggestions from the results.\nInitially, these tasks appeared to be well within the capabilities of modern LLM-based AI systems, especially with “Code Interpreter” mode enabled. As already mentioned in the introduction, this assumption quickly turned out to be a misconception.\n## 2 The Hybrid Architecture\nThe core idea for overcoming the analytical challenge was to clearly separate deterministic data analysis from LLM-based reasoning and interpretation. Fig. 2 shows the selected system architecture after several improvement iterations. The system was implemented in Microsoft Copilot Studio because the platform allows deterministic workflow elements, such as topics and flows, to be combined with LLM-based reasoning components.\n![](../images/body-a28bb3b47bb18578c09e.png)\nFigure 2: System architecture of the consultation agent with integrated analytics module | image by author\nThe parent agent handles all communication with the user. It orchestrates the sub agents and the analytics module, delegates tasks to them, receives their responses, and composes the final answer.\nThe sub agents are specialized LLM-based modules with access to specific knowledge sources. These include descriptions of maturity-level expectations for the value streams, questionnaires with detailed assessment questions, and more general guidelines for operational excellence. The sub agents are called by the parent agent according to their specific capabilities and respond to the parent agent rather than directly to the user.\nThe analytics module is the main focus of this article. It performs the deterministic data analysis and is designed to provide reproducible and reliable analytical results. It receives an analysis instruction in natural language from the parent agent, referred to as `Parent_Instruction`. The analytics module itself consists of topics, flows, and AI modules, which are called “prompts” in Copilot Studio.\nThe topic `T_receive_Excel_File` handles the upload and storage of assessment files. It is triggered when a file is uploaded in the chat window, indicated by the variable `System.Activity.Attachments` having a value. The topic checks whether the uploaded file is an Excel file and, if so, stores it in the global variable `Assessment_File`.\nThe topic `T_analyze_assessments` is actively called by the parent agent if it has an analytics task to conduct and receives `Parent_Instruction` as input. A second input is the assessment data stored in the global variable `Assessment_File`. The topic contains the two core analytics components: `Analysis_Planner` and `Analysis_Engine`. Both are embedded in agentic flows, `F_Call_Analysis_Planner` and `F_Call_Analysis_Engine`. These flows serve as connectors between the topic `T_analyze_assessments` and the AI prompts `P_Analysis_Planner` and `P_Analysis_Engine`.\n`F_Call_Analysis_Planner` receives only one input, `Parent_Instruction`, and forwards it to `P_Analysis_Planner`. This component generates the `Selection_Rule`, the core analysis instruction to be executed by `P_Analysis_Engine`. The inner workings of `P_Analysis_Planner` are discussed in Chapter 3.\n`F_Call_Analysis_Engine` receives three inputs: the `Selection_Rule` from `Analysis_Planner`, a `Mapping_File` provided from SharePoint, and the `Assessment_File`. All three inputs are forwarded to the AI prompt `P_Analysis_Engine`, which conducts the data analysis as specified by `Analysis_Planner`. The `P_Analysis_Engine` is discussed in detail in Chapter 4.\n## 3 The Analysis Planner\nThe `P_Analysis_Planner` is the intelligent part of the data analysis pipeline and generates the analysis instruction, called `Selection_Rule`. This instruction is a translation of the natural language `Parent_Instruction` and is generally unique for each request. In order to minimize probabilistic variation, the translation process is constrained by strict rules.\n**The Analysis_Planner does not analyze the assessment data itself. Its sole responsibility is to translate the probabilistic**`Parent_Instruction`**into a deterministic analysis specification.**\nIn the following, we will examine selected parts of the instruction in more detail. You can download the full instruction [here](https://www.dropbox.com/scl/fi/ksbs011eslbo10xlrt7lm/Instruction_Analysis_Planner.txt?rlkey=fyp8y9824fb0kdm55dmlvdv1r&st=fg8qdxah&dl=0).\nmarkup\n\n```\nYou are Analysis_Planner, an expert assistant for translating natural-language assessment analysis requests into structured Selection_Rules.Your task is to create a Selection_Rule JSON object for the Analysis_Engine.You receive only one input:1. Parent_Instruction :A natural-language analysis request from the parent agent (orchestrator).You must analyze Parent_Instruction and determine:- which type of analysis is required,- which assessment content categories are relevant,- whether concept or execution maturity/findings are requested,- whether specific chapters are requested,- and whether row filters are required.The Selection_Rule you generate will later be used by the Analysis_Engine together with:- the real assessment data file,- and the Mapping_Fileto execute the analysis deterministically.\n```\n\nThe code box above shows the initial instruction for `P_Analysis_Planner`. It clearly defines purpose and scope and explicitly separates planning from execution. The planner translates the request, while the actual execution is delegated to the `P_Analysis_Engine`.\nNext follows a longer section describing the semantics of the assessment data. Of course, this part is highly specific to the individual use case and dataset. It defines semantic categories used for row filtering and categories used to select the actual analysis targets (TARGET CONTENT CATEGORIES and TARGET SELECTION ATTRIBUTES).\nyaml\n\n```\nASSESSMENT DATA SEMANTICS\n\nThe assessment data can be addressed through the following semantic categories.\n\nROW FILTER CATEGORIES\n\nUse these categories only for row_filters:\n\n- VS_Nr:\n    Unique identifier of the value stream.\n    Use when filtering by value stream number.\n\n- Value Stream:\n    Name of the value stream.\n    Use when filtering by value stream name.\n\n- ...\n\nTARGET CONTENT CATEGORIES\n\nUse these categories only in target_selection_rules.data_category:\n\n- chapter_score:\n    Numeric maturity score.\n    Use for maturity calculations, score analysis, and average maturity analysis.\n\n- strength:\n    Assessor statements describing strengths.\n\n- ...\n\nTARGET SELECTION ATTRIBUTES\n\nUse these attributes only inside target_selection_rules:\n\n- data_category:\n    Defines which target content category is needed.\n\n- aggregation_allowed:\n    Use:\n        - mean for numeric maturity averages\n        - summary for textual summaries\n\n- ...\n```\n\nThe planner never interacts directly with physical dataset columns. Instead, it operates on a semantic abstraction layer that decouples natural language from the underlying dataset structure.\nThis separation is important because the assessment dataset contains more than 800 columns, including:\n  * maturity ratings,\n  * textual assessor findings,\n  * metadata,\n  * organizational mappings,\n  * questionnaire variants,\n  * and concept/execution distinctions.\n\n\nSelecting the correct target columns therefore becomes a critical part of the analysis process.\nRestricting the allowed analysis types is equally important. The planner is intentionally prevented from inventing arbitrary analytical operations. The section ANALYSIS TYPES therefore defines the only valid analysis types — currently just two. This significantly improves the predictability and robustness of downstream execution. Of course, the list can easily be extended for individual use cases.\nyaml\n\n```\nANALYSIS TYPES\n\nUse exactly one of these analysis_type values:\n\n- numeric_mean\n    Use for:\n    - average maturity\n    - mean maturity\n    - ...\n\n- text_summary\n    Use for:\n    - strengths\n    - improvement potentials\n    - ...\n```\n\nThe next section defines how the planner selects the relevant target columns in an abstract and deterministic way. The rules distinguish between the two predefined analysis types `numeric_mean` and `text_summary` and finally determine which dataset columns are selected for a specific request.\nyaml\n\n```\nRULES FOR target_selection_rules\n\nNUMERIC MATURITY ANALYSIS\n\nFor numeric maturity analysis:\n- analysis_type must be:\n    \"numeric_mean\"\n- data_category must be:\n    [\"chapter_score\"]\n- ...\n\nTEXT SUMMARY ANALYSIS\n\nFor textual summary analysis:\n- analysis_type must be:\n    \"text_summary\"\n- data_category:\n    include only requested categories:\n        - \"strength\"\n        - \"potential\"\n        - \"recommendation\"\n        - \"remark\"\n- ...\n```\n\nA similar logic applies to the row filtering process.\nyaml\n\n```\nRULES FOR row_filters\n\nUse row_filters only for filtering rows in the assessment dataset.\n\nAllowed row filter keys are:\n- VS_Nr\n- Value Stream\n- ...\n\nDo NOT use row_filters for:\n- chapter_id\n- ...\n\nThese belong only to target_selection_rules.\n```\n\nFinally, the instruction defines the required output structure together with several strict “do-not rules”. This section is particularly important because the generated output is directly forwarded to the `P_Analysis_Engine` and therefore must follow a clearly defined and machine-readable structure.\njson\n\n```\nOUTPUT FORMAT\n\nReturn only valid JSON.\nDo not return markdown.\nDo not return Python code.\n...\n\nUse exactly this structure:\n\n{\n  \"status\": \"success\",\n  \"parent_instruction_summary\": \"\",\n  \"selection_rule\": {\n    \"analysis_type\": \"\",\n    \"target_selection_rules\": {\n      \"data_category\": [],\n      \"aggregation_allowed\": [],\n      \"concept_execution\": null,\n      \"chapter_id\": null\n    },\n    \"row_filters\": {}\n  },\n  \"warnings\": []\n}\n```\n\nIf the request is unclear, the planner must explicitly return an error structure instead of “guessing” a potentially wrong analysis instruction.\njson\n\n```\nIf the task is unclear, return:\n\n{\n  \"status\": \"error\",\n  \"parent_instruction_summary\": \"\",\n  \"selection_rule\": {\n    \"analysis_type\": null,\n    \"target_selection_rules\": {\n      \"data_category\": [],\n      \"aggregation_allowed\": [],\n      \"concept_execution\": null,\n      \"chapter_id\": null\n    },\n    \"row_filters\": {}\n  },\n  \"warnings\": [\n    \"The analysis task is not clearly understood.\"\n  ]\n}\n```\n\nAt this point, the planner has transformed ambiguous natural language into a deterministic analysis specification. However, the actual data execution still has not happened.\nIn chapter 5, we will follow a real user request through the complete pipeline and examine how `P_Analysis_Planner` generates the `Selection_Rule` and how `P_Analysis_Engine` executes it on the assessment dataset.\n## 4 The Analysis Engine\nUnlike the `P_Analysis_Planner`, the `P_Analysis_Engine` does not reason about the task. It only executes the analysis specification generated by `P_Analysis_Planner`.\nAs in chapter 3, we will focus only on the most relevant parts of the instruction. The full specification can be downloaded [here](https://www.dropbox.com/scl/fi/6rsqjcokgdwj6bczxax7u/Instruction_Analysis_Engine.txt?rlkey=k0wiqgzusrafx45iv8nr5n06p&st=4kqtw3le&dl=0).\nThe instruction of `P_Analysis_Engine` starts with the basic task definition. In essence, the AI prompt is used as a controlled Python execution environment. The code is predefined in the prompt instruction and must only be executed, not modified.\nmarkup\n\n```\nYou are Analysis_Engine, a deterministic pandas-based analysis executor.Your task is to analyze an Excel assessment dataset using Code Interpreter.You receive three inputs:1. document    The Excel file containing the assessment data.2. Mapping_File    The Excel file describing the columns of document.3. Selection_Rule    A JSON object that defines:   - which columns to select from Mapping_File   - which row filters to apply to document   - which type of analysis to performYou must not reinterpret the original user request.You must not infer additional columns.You must not change Selection_Rule.You must not generate a new analysis approach.You must only execute the deterministic Python script below.Use Code Interpreter to execute the Python script.Return only the JSON result printed by the script.Do not return markdown.Do not explain the code.Do not add text before or after the JSON result.\n```\n\n`P_Analysis_Engine` receives three input files:\n  1. The `Assessment_File` uploaded from the user in the chat interface. It is stored in the prompt-internal variable `document`.\n  2. A `Mapping_File` which the flow `F_Call_Analysis_Engine` loads from SharePoint in preparation of the execution.\n  3. The `Selection_Rule` generated by `P_Analysis_Planner` (see chapter 3).\n\n\nThe `Mapping_File` plays a crucial role in defining the semantics of the many columns in `Assessment_File` on a higher level of abstraction. With this abstraction layer, the `Selection_Rule` only needs to specify which type of information is required, while the `P_Analysis_Engine` selects the corresponding dataset columns during execution.\n![](../images/body-a9a0aac8b26f94904ac4.png)\nFigure 3: Structure of `Mapping_File` | image by author\nFig. 3 shows the structure of `Mapping_File`. It contains a row for each column of `Assessment_File`, that is potentially relevant for the data analysis. Data columns that are clearly irrelevant are not represented in `Mapping_File` and therefore are not visible to `P_Analysis_Engine`. For each row, the file specifies the selection criteria:\n  * `data_category`:   \nFunctional meaning of the column, e.g. maturity score, strength, plant name, region, or season.\n  * `chapter_id`:  \nUnique identifier of the assessment chapter.\n  * `chapter_name`:  \nHuman-readable name of the assessment chapter.\n  * `concept_execution`:  \nIndicates whether the column belongs to concept or execution maturity.\n  * `aggregation_allowed`:  \nDefines which type of aggregation is valid for the column, e.g. `mean` for numeric maturity scores or `summary` for textual findings.\n\n\nNext in `P_Analysis_Engine`’s instruction comes a paragraph about how to interpret the Selection_Rule.\nmarkup\n\n```\nRules for Selection_Rule:- analysis_type = \"numeric_mean\":  Calculate arithmetic means for all selected numeric target columns.- analysis_type = \"text_summary\":  Collect non-empty text entries from all selected text target columns.- target_selection_rules:  Select target columns by matching Mapping_File attributes.  A rule value of null means: do not filter by this attribute.  A list means: keep rows where the Mapping_File attribute is in the list.- row_filters:  Apply row filters to document.  Keys are data_category values from Mapping_File, such as \"Plant\", \"Region\", \"Production Principle\", \"Season\".  Values are lists of accepted values.\n```\n\nThe selection specifies:\n  * which analysis operation must be executed (`analysis_type`),\n  * how relevant target columns are selected from the `Mapping_File` (`target_selection_rules`),\n  * and how the assessment dataset is filtered before the analysis is performed (`row_filters`).\n\n\nThis instruction is intentionally deterministic. The `P_Analysis_Engine` is not allowed to reinterpret the original user request or invent additional analytical operations.\nAfter the instruction block, the `P_Analysis_Engine` receives the actual Python script. The full script contains more than 300 lines of code and is part of the AI prompt instruction. It is linked at the top of this chapter and can be downloaded. Many of the code lines are not conceptually important for the architecture. They handle practical robustness: cleaning column names, normalizing input values, handling missing columns, converting Copilot wrapper objects, and returning structured error messages.\nFor the article, I will focus only on the central logic.\nThe first important step is that the engine loads the uploaded assessment data (now available in `document`) and the `Mapping_File`. From this point on, the LLM is no longer interpreting the user request. It only executes the deterministic script based on the `Selection_Rule`.\npython\n\n```\nmapping_df = pd.read_excel(Mapping_File)\ndata_df = pd.read_excel(document)\n\nmapping_df = strip_column_names(mapping_df)\ndata_df = strip_column_names(data_df)\n```\n\nThe key architectural element is the selection of target columns. The `P_Analysis_Engine` never guesses which Excel columns may be relevant. Instead, it filters the `Mapping_File` according to the attributes defined in `target_selection_rules`.\npython\n\n```\ntarget_mapping = mapping_df.copy()\n\nfor attr, rule_value in target_selection_rules.items():\n\n    values = normalize_rule_value(rule_value)\n    values = normalize_list_for_matching(values)\n\n    if values is None:\n        continue\n\n    target_mapping = target_mapping[\n        target_mapping[attr]\n        .apply(normalize_for_matching)\n        .isin(values)\n    ]\n\nselected_target_columns = (\n    target_mapping[\"source_column_name\"]\n    .dropna()\n    .tolist()\n)\n```\n\nThis is the point where the abstract analysis instruction becomes concrete. For example, a rule such as `chapter_id = [\"3.5\"]`, `data_category = [\"chapter_score\"]`, and `aggregation_allowed = [\"mean\"]` is translated into the actual Excel columns containing the Concept and Execution maturity scores for chapter 3.5.\nThe same principle is applied to row filters. Again, the engine does not infer anything from natural language. It only applies the filters explicitly provided in the `Selection_Rule`.\npython\n\n```\nfiltered_df = data_df.copy()\n\nfor filter_category, filter_values in row_filters.items():\n\n    filter_mapping = mapping_df[\n        mapping_df[\"data_category\"]\n        .apply(normalize_for_matching)\n        == normalize_for_matching(filter_category)\n    ]\n\n    filter_col = filter_mapping[\"source_column_name\"].iloc[0]\n\n    filtered_df = filtered_df[\n        filtered_df[filter_col]\n        .apply(normalize_for_matching)\n        .isin(values)\n    ]\n```\n\nAfter column selection and row filtering, the actual analysis logic becomes intentionally straightforward. For numeric maturity analysis, the engine calculates arithmetic means for all selected numeric target columns.\npython\n\n```\nif analysis_type == \"numeric_mean\":\n\n    numeric_result = {}\n\n    for col in available_target_columns:\n\n        series = pd.to_numeric(filtered_df[col], errors=\"coerce\")\n        valid_count = int(series.notna().sum())\n\n        numeric_result[col] = {\n            \"mean\": float(series.mean()) if valid_count > 0 else None,\n            \"valid_count\": valid_count\n        }\n\n    result[\"result\"] = numeric_result\n```\n\nFor textual analysis, the engine collects non-empty assessor statements instead of calculating values.\npython\n\n```\nelif analysis_type == \"text_summary\":\n\n    text_result = {}\n\n    for col in available_target_columns:\n\n        values = [\n            clean_text_value(v)\n            for v in filtered_df[col].tolist()\n        ]\n\n        values = [v for v in values if v is not None]\n\n        text_result[col] = {\n            \"entries\": values,\n            \"entry_count\": len(values)\n        }\n\n    result[\"result\"] = text_result\n```\n\nFinally, the result is returned as JSON. This is important because the output is not yet the final user-facing answer. It is the reliable analytical foundation for the next LLM step: interpretation by the parent agent.\npython\n\n```\nprint(json.dumps(result, indent=2, ensure_ascii=False))\n```\n\nThis design deliberately keeps the `P_Analysis_Engine` “boring”. It does not reason, it does not explain, and it does not improve the analysis. It only executes. And that is exactly the point. The more deterministic this layer is, the more trust can be placed in the later LLM-generated interpretation.\n## 5 End-to-End Example\nTo illustrate the complete workflow, let us follow a realistic example through the full pipeline.\nTriggered by the user interaction, the parent agent might raise the following `Parent_Instruction` to the analytics module:\n**“Summarize the main improvement potentials for chapter 1.4 Failure Prevention System in plant AbcP.”**\nThe request looks simple for a human reader, but it already contains multiple semantic tasks:\n  * identify the requested assessment chapters,\n  * detect the requested content type,\n  * apply a row filter,\n  * retrieve the correct text columns,\n  * aggregate textual findings,\n  * and finally generate a meaningful interpretation ( → parent agent).\n\n\nThis is exactly the type of task where a pure LLM-based analysis becomes unreliable. The system therefore separates the workflow into deterministic execution steps and probabilistic interpretation steps.\n### 5.1 Translation from Analysis Planner\nThe first step is performed by `P_Analysis_Planner`.  \nIt translates the natural language request into a deterministic `Selection_Rule`.\njson\n\n```\n{\n  \"status\": \"success\",\n  \"parent_instruction_summary\": \"Summarize improvement potentials for chapter 1.4 Failure Prevention System in plant AbcP.\",\n  \"selection_rule\": {\n    \"analysis_type\": \"text_summary\",\n    \"target_selection_rules\": {\n      \"data_category\": [\"potential\"],\n      \"aggregation_allowed\": [\"summary\"],\n      \"concept_execution\": null,\n      \"chapter_id\": [\"1.4\"]\n    },\n    \"row_filters\": {\n      \"Plant\": [\"AbcP\"]\n    }\n  },\n  \"warnings\": []\n}\n```\n\nThe `Selection_Rule` already contains the complete deterministic analysis specification:\n  * `analysis_type = \"text_summary\"`  \nindicates that textual assessor findings must be collected instead of numeric calculations.\n  * `data_category = [\"potential\"]`  \nrestricts the analysis to improvement potentials.\n  * `chapter_id = [\"1.4\"]`  \nlimits the analysis to the Failure Prevention System chapter.\n  * `row_filters = {\"Plant\": [\"AbcP\"]}`  \nrestricts the dataset to the requested plant.\n\n\nAt this stage, no data analysis has happened yet. The result is only an execution instruction for the next step.\n### 5.2 Execution from Analysis Engine\nThis `Selection_Rule` is handed over to `P_Analysis_Engine` for execution. First, the engine selects all matching target columns from the `Mapping_File`.\npython\n\n```\ntarget_mapping = target_mapping[\n    target_mapping[attr]\n    .apply(normalize_for_matching)\n    .isin(values)\n]\n```\n\nThis translates the abstract selection criteria into real dataset columns, for example:\npython\n\n```\nselected_target_columns = [\n    \"1.4 CON L2 Improvement potentials\",\n    \"1.4 CON L3 Improvement potentials\",\n    \"1.4 EXE L2 Improvement potentials\",\n    \"1.4 EXE L3 Improvement potentials\"\n]\n```\n\nNext, the row filters are applied:\npython\n\n```\nfiltered_df = filtered_df[\n    filtered_df[filter_col]\n    .apply(normalize_for_matching)\n    .isin(values)\n]\n```\n\nIn this example, the dataset is reduced to assessment rows belonging to plant AbcP.\nFinally, the engine collects all non-empty text entries from the selected columns.\npython\n\n```\nvalues = [\n    clean_text_value(v)\n    for v in filtered_df[col].tolist()\n]\n\nvalues = [v for v in values if v is not None]\n```\n\nAs we can see, the engine does not interpret the findings. It only retrieves and structures them according to the Python script.\nThe engine’s output is a collection of assessors’ written statements about the value stream’s improvement potentials as a JSON object.\njson\n\n```\n{\n  \"entry_count\": 6,\n  \"entries\": [\n    \"Root causes are not systematically tracked.\",\n    \"Escalation rules for recurring failures are unclear.\",\n    \"Lessons learned are not transferred between shifts.\",\n    \"Preventive maintenance findings are not integrated into CIP activities.\",\n    \"Failure trends are visualized inconsistently.\",\n    \"Problem-solving activities focus mainly on symptoms instead of root causes.\"\n  ]\n}\n```\n\nAt this point, the system has still not generated any recommendations. It has only produced a reliable collection of relevant assessment findings. **This JSON object is returned to the parent agent for interpretation and generation of the final response to the user.**\n### 5.3 Interpretation from Parent Agent\nIn the final step, the parent agent collects all responses (potentially additional responses from the sub agents) and generates the final output.\nmarkup\n\n```\nThe collected findings indicate that the Failure Prevention System iscurrently more reactive than preventive. Most gaps are related to missingsystematic root-cause management and weak organizational learning acrossshifts and teams. The highest leverage improvements would likely come fromstrengthening escalation routines, integrating preventive maintenance findingsinto CIP activities, and establishing consistent cross-shift learningmechanisms.\n```\n\nTo summarize the central architectural idea of the system:\nThe LLM no longer creates the analytical foundation itself. Instead, it interprets a deterministic set of already validated findings.\nThe probabilistic reasoning capability of the LLM is used where it creates value: interpretation, prioritization, explanation, and communication — not data processing itself.\n## 6 Why AI Architecture Matters\nLarge Language Models are naturally strong at interpretation, reasoning, and language generation, but still weak at reliable numerical analytics. Their optimization target is plausibility, not deterministic reproducibility. Even with extensions such as “Code Interpreter”, this weakness remains visible in more complex analytical scenarios.\nThe good news is that this limitation can largely be compensated through intelligent system architecture. The key is a clear separation of responsibilities: deterministic data-processing layers execute the analytical foundation, while LLMs focus on interpretation, prioritization, explanation, and communication.\nIn the presented approach, the most important design decision was therefore not adding more AI to the system. It was defining very carefully where probabilistic reasoning should end and deterministic execution should begin.\nReliable agentic systems will likely require exactly these kinds of hybrid architectures: combining the robustness of classical data science pipelines with the inference capabilities of Large Language Models.\n## Register Now to Continue Reading\n### Unlock Towards Data Science with a Free Account\nAll articles on Towards Data Science are available to registered users. Create a free account today to access this article and thousands more.\nRegister for freeSign in to your account\n* * *\n![](../images/body-f5a06262cccdb3c06ef7.jpeg)\nWritten By\n## [Ingo Nowitzky](https://towardsdatascience.com/author/ingo.nowitzky/)\nPhD Engineer, Lean Production professional, and AI enthisiast.\n[See all from Ingo Nowitzky](https://towardsdatascience.com/author/ingo.nowitzky/)\n[Deep Dives](https://towardsdatascience.com/tag/deep-dives/)[Ai Agent](https://towardsdatascience.com/tag/ai-agent/)[Artificial Intelligence](https://towardsdatascience.com/tag/artificial-intelligence/)[Data Science](https://towardsdatascience.com/tag/data-science/)[Llm](https://towardsdatascience.com/tag/llm/)\nShare This Article\n  * [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Ftowardsdatascience.com%2Fhybrid-ai-combining-deterministic-analytics-with-llm-reasoning%2F&title=Hybrid%20AI%3A%20Combining%20Deterministic%20Analytics%20with%20LLM%20Reasoning)\n  * [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Ftowardsdatascience.com%2Fhybrid-ai-combining-deterministic-analytics-with-llm-reasoning%2F&title=Hybrid%20AI%3A%20Combining%20Deterministic%20Analytics%20with%20LLM%20Reasoning)\n  * [](https://x.com/share?url=https%3A%2F%2Ftowardsdatascience.com%2Fhybrid-ai-combining-deterministic-analytics-with-llm-reasoning%2F&text=Hybrid%20AI%3A%20Combining%20Deterministic%20Analytics%20with%20LLM%20Reasoning)\n\n\nTowards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program.\n[Write for TDS](https://towardsdatascience.com/submissions/)\n## Related Articles\n  * [![](../images/002.jpeg)](https://towardsdatascience.com/training-a-neural-network-with-a-few-clean-lines-of-code-b688da064bd5/)\n## [Training a Neural Network With a Few, Clean Lines of Code](https://towardsdatascience.com/training-a-neural-network-with-a-few-clean-lines-of-code-b688da064bd5/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nReusable, maintainable and easy to understand machine learning code.\n[Daniel](https://towardsdatascience.com/author/etzold/)\nJune 14, 20227 min read\n  * [![](../images/003.gif)](https://towardsdatascience.com/build-a-mfcc-based-music-recommendation-engine-on-cloud-3bf3cfbd594b/)\n## [Build A MFCC-Based Music Recommendation Engine On Cloud](https://towardsdatascience.com/build-a-mfcc-based-music-recommendation-engine-on-cloud-3bf3cfbd594b/)\n[Data Science](https://towardsdatascience.com/category/data-science/)\nAn approachable guide to creating unstructured data-driven, innovative apps in Microsoft Azure.\n[Xiaoqian Wang](https://towardsdatascience.com/author/wxqqaz123/)\nAugust 13, 202113 min read\n  * [![](../images/004.png)](https://towardsdatascience.com/4-claude-skills-every-data-scientist-needs-in-2026/)\n## [4 Claude Skills Every Data Scientist Needs in 2026](https://towardsdatascience.com/4-claude-skills-every-data-scientist-needs-in-2026/)\n[Agentic AI](https://towardsdatascience.com/category/artificial-intelligence/agentic-ai/)\nFour skills worth adding to your workflow today if you don't want to be left behind\n[Haden Pelletier](https://towardsdatascience.com/author/pelletierhaden/)\nAugust 29, 20268 min read\n  * [![](../images/005.jpg)](https://towardsdatascience.com/ai-agents-need-their-own-desk-and-git-worktrees-give-it-one/)\n## [AI Agents Need Their Own Desk, and Git Worktrees Give Them One](https://towardsdatascience.com/ai-agents-need-their-own-desk-and-git-worktrees-give-it-one/)\n[Agentic AI](https://towardsdatascience.com/category/artificial-intelligence/agentic-ai/)\nGit worktrees, parallel agentic coding sessions, and the setup tax you should be aware of\n[Ruben Broekx](https://towardsdatascience.com/author/broekxruben/)\nApril 18, 202617 min read\n  * [![](../images/006.jpg)](https://towardsdatascience.com/use-openclaw-to-make-a-personal-ai-assistant/)\n## [Use OpenClaw to Make a Personal AI Assistant](https://towardsdatascience.com/use-openclaw-to-make-a-personal-ai-assistant/)\n[Agentic AI](https://towardsdatascience.com/category/artificial-intelligence/agentic-ai/)\nLearn how to set up OpenClaw as a personalized AI agent\n[Eivind Kjosbakken](https://towardsdatascience.com/author/oieivind/)\nFebruary 17, 20269 min read\n  * [![](../images/007.jpg)](https://towardsdatascience.com/how-to-build-tools-for-ai-agents/)\n## [How to Build Tools for AI Agents](https://towardsdatascience.com/how-to-build-tools-for-ai-agents/)\n[Agentic AI](https://towardsdatascience.com/category/artificial-intelligence/agentic-ai/)\nLearn how to design and build effective tools to be used by AI Agents\n[Eivind Kjosbakken](https://towardsdatascience.com/author/oieivind/)\nOctober 15, 20259 min read\n  * [![](../images/008.png)](https://towardsdatascience.com/the-new-face-of-data-governance-44eee0a91e68/)\n## [The New Face of Data Governance](https://towardsdatascience.com/the-new-face-of-data-governance-44eee0a91e68/)\n[Data Science](https://towardsdatascience.com/category/data-science/)\nData governance is dead. Here's how we can resurrect it.\n[Louise de Leyritz](https://towardsdatascience.com/author/louise.de.leyritz/)\nFebruary 3, 202216 min read\n  * [![](../images/009.jpg)](https://towardsdatascience.com/how-to-apply-claude-code-to-non-technical-tasks/)\n## [How to Apply Claude Code to Non-technical Tasks](https://towardsdatascience.com/how-to-apply-claude-code-to-non-technical-tasks/)\n[Agentic AI](https://towardsdatascience.com/category/artificial-intelligence/agentic-ai/)\nLearn how to apply coding agents to all tasks on your computer\n[Eivind Kjosbakken](https://towardsdatascience.com/author/oieivind/)\nApril 13, 20267 min read\n  * [![](../images/010.jpg)](https://towardsdatascience.com/graph-engineering-for-ai-agents-from-prompts-and-loops-to-workflows/)\n## [Graph Engineering for AI Agents: From Prompts and Loops to Workflows](https://towardsdatascience.com/graph-engineering-for-ai-agents-from-prompts-and-loops-to-workflows/)\n[Agentic AI](https://towardsdatascience.com/category/artificial-intelligence/agentic-ai/)\nA viral debate over loops versus graphs points to a bigger shift in how we build AI systems. Here’s what graph engineering actually means, how it differs from prompt, context, and loop engineering, and why it matters.\n[Nhu Hoang](https://towardsdatascience.com/author/hoanganhquynhnhu/)\nSeptember 14, 202617 min read\n\n\n  * [YouTube](https://www.youtube.com/c/TowardsDataScience)\n  * [X](https://x.com/TDataScience)\n  * [LinkedIn](https://www.linkedin.com/company/towards-data-science/)\n  * [Threads](https://www.threads.net/@towardsdatascience)\n  * [Bluesky](https://bsky.app/profile/towardsdatascience.com)\n\n\n[](https://towardsdatascience.com/)\nYour home for data science and AI. The world's leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals.\nSubscribe to Our Newsletter[Write For TDS](https://towardsdatascience.com/submissions/)•[About](https://towardsdatascience.com/about-towards-data-science-d691af11cc2f/)•[Advertise](https://contact.towardsdatascience.com/advertise-with-towards-data-science)•[Privacy Policy](https://towardsdatascience.com/privacy-policy/)•[Terms of Use](https://towardsdatascience.com/website-terms-of-use/)\n© Insight Media Group, LLC 2026•[The New Stack](https://thenewstack.io)•[roadmap.sh](https://roadmap.sh)•[Creator Network](https://insightmediagroup.io/creator-network)\n####  Recommended Articles \nClose\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500) Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1 ](https://towardsdatascience.com/javascript-fatigue-you-dont-need-js-to-build-chatgpt/ \"Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500) The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs ](https://towardsdatascience.com/subset-sum-problem-solved-in-linear-time-for-dense-enough-inputs/ \"The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500) Does Your Company Have a Data Strategy? ](https://towardsdatascience.com/does-your-company-have-a-data-strategy-e8944dbec4ae/ \"Does Your Company Have a Data Strategy?\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/4970/image?etag=1780565225463&width=500&height=500) Productivity Tips, Data Career Insights, and Other Recent Must-Reads ](https://towardsdatascience.com/productivity-tips-data-career-insights-and-other-recent-must-reads-5c47eb7a2fe0/ \"Productivity Tips, Data Career Insights, and Other Recent Must-Reads\")\n\n\n",
  "metadata": {
    "title": "Hybrid AI: Combining Deterministic Analytics with LLM Reasoning | Towards Data Science",
    "description": "How AI architecture prevents plausible but wrong analytics",
    "keywords": null,
    "author": "Ingo Nowitzky",
    "og:locale": "en_US",
    "og:type": "article",
    "og:title": "Hybrid AI: Combining Deterministic Analytics with LLM Reasoning",
    "og:description": "How AI architecture prevents plausible but wrong analytics",
    "og:url": "https://towardsdatascience.com/hybrid-ai-combining-deterministic-analytics-with-llm-reasoning/",
    "og:site_name": "Towards Data Science",
    "og:image": "https://assets.insightmediagroup.io/media/wp-content/uploads/2026/05/Feature_Image_v2-2.png",
    "og:image:width": "1536",
    "og:image:height": "1024",
    "og:image:type": "image/png",
    "twitter:card": "summary_large_image",
    "twitter:site": "@TDataScience",
    "twitter:creator": "@TDataScience",
    "twitter:label1": "Written by",
    "twitter:data1": "Ingo Nowitzky",
    "twitter:label2": "Est. reading time",
    "twitter:data2": "17 min read",
    "article:published_time": "2026-05-22T10:30:07.000Z",
    "article:modified_time": "2026-05-22T10:30:07.000Z",
    "article:author": "https://towardsdatascience.com/author/ingo.nowitzky/"
  },
  "paywall": {
    "listed_paid": false,
    "detected": false,
    "marker": "",
    "public_only": false,
    "policy": "付费/会员内容只保留页面公开可见部分，不绕过付费墙"
  },
  "crawl": {
    "success": true,
    "status_code": 202,
    "error": ""
  },
  "code_blocks": [
    {
      "language": "txt",
      "file": "attachments/605cdd7f40a1/code/block_000.txt",
      "chars": 806
    },
    {
      "language": "txt",
      "file": "attachments/605cdd7f40a1/code/block_001.txt",
      "chars": 945
    },
    {
      "language": "txt",
      "file": "attachments/605cdd7f40a1/code/block_002.txt",
      "chars": 229
    },
    {
      "language": "txt",
      "file": "attachments/605cdd7f40a1/code/block_003.txt",
      "chars": 438
    },
    {
      "language": "txt",
      "file": "attachments/605cdd7f40a1/code/block_004.txt",
      "chars": 243
    },
    {
      "language": "txt",
      "file": "attachments/605cdd7f40a1/code/block_005.txt",
      "chars": 435
    },
    {
      "language": "txt",
      "file": "attachments/605cdd7f40a1/code/block_006.txt",
      "chars": 398
    },
    {
      "language": "txt",
      "file": "attachments/605cdd7f40a1/code/block_007.txt",
      "chars": 903
    },
    {
      "language": "txt",
      "file": "attachments/605cdd7f40a1/code/block_008.txt",
      "chars": 648
    },
    {
      "language": "txt",
      "file": "attachments/605cdd7f40a1/code/block_009.txt",
      "chars": 158
    },
    {
      "language": "txt",
      "file": "attachments/605cdd7f40a1/code/block_010.txt",
      "chars": 463
    },
    {
      "language": "txt",
      "file": "attachments/605cdd7f40a1/code/block_011.txt",
      "chars": 449
    },
    {
      "language": "txt",
      "file": "attachments/605cdd7f40a1/code/block_012.txt",
      "chars": 410
    },
    {
      "language": "txt",
      "file": "attachments/605cdd7f40a1/code/block_013.txt",
      "chars": 412
    },
    {
      "language": "txt",
      "file": "attachments/605cdd7f40a1/code/block_014.txt",
      "chars": 56
    },
    {
      "language": "txt",
      "file": "attachments/605cdd7f40a1/code/block_015.txt",
      "chars": 464
    },
    {
      "language": "txt",
      "file": "attachments/605cdd7f40a1/code/block_016.txt",
      "chars": 113
    },
    {
      "language": "txt",
      "file": "attachments/605cdd7f40a1/code/block_017.txt",
      "chars": 193
    },
    {
      "language": "txt",
      "file": "attachments/605cdd7f40a1/code/block_018.txt",
      "chars": 110
    },
    {
      "language": "txt",
      "file": "attachments/605cdd7f40a1/code/block_019.txt",
      "chars": 123
    },
    {
      "language": "txt",
      "file": "attachments/605cdd7f40a1/code/block_020.txt",
      "chars": 427
    },
    {
      "language": "txt",
      "file": "attachments/605cdd7f40a1/code/block_021.txt",
      "chars": 447
    }
  ],
  "images": [
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T17:47:34Z"
    },
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T17:47:34Z"
    },
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T17:47:34Z"
    },
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/4970/image?etag=1780565225463&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/4970/image?etag=1780565225463&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T17:47:34Z"
    }
  ],
  "audio": [],
  "videos": [
    {
      "url": "https://www.youtube.com/c/TowardsDataScience",
      "kind": "channel_reference",
      "status": "reference_only"
    }
  ],
  "links": [
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/latest/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/editors-pick/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/the-variable/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/shipai/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/submissions/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/artificial-intelligence/agentic-ai/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/ingo.nowitzky/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/deep-dives/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/ai-agent/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/artificial-intelligence/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/data-science/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/llm/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/training-a-neural-network-with-a-few-clean-lines-of-code-b688da064bd5/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/artificial-intelligence/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/etzold/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/build-a-mfcc-based-music-recommendation-engine-on-cloud-3bf3cfbd594b/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/data-science/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/wxqqaz123/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/4-claude-skills-every-data-scientist-needs-in-2026/"
    },
    {
      "type": "external",
      "href": "https://write.insightmediagroup.io"
    },
    {
      "type": "external",
      "href": "https://www.linkedin.com/company/towards-data-science/"
    },
    {
      "type": "external",
      "href": "https://x.com/TDataScience"
    },
    {
      "type": "external",
      "href": "https://roadmap.sh/ai-agents"
    },
    {
      "type": "external",
      "href": "https://www.dropbox.com/scl/fi/ksbs011eslbo10xlrt7lm/Instruction_Analysis_Planner.txt?dl=0&rlkey=fyp8y9824fb0kdm55dmlvdv1r&st=fg8qdxah"
    },
    {
      "type": "external",
      "href": "https://www.dropbox.com/scl/fi/6rsqjcokgdwj6bczxax7u/Instruction_Analysis_Engine.txt?dl=0&rlkey=k0wiqgzusrafx45iv8nr5n06p&st=4kqtw3le"
    },
    {
      "type": "external",
      "href": "https://www.facebook.com/sharer/sharer.php?title=Hybrid+AI%3A+Combining+Deterministic+Analytics+with+LLM+Reasoning&u=https%3A%2F%2Ftowardsdatascience.com%2Fhybrid-ai-combining-deterministic-analytics-with-llm-reasoning%2F"
    },
    {
      "type": "external",
      "href": "https://www.linkedin.com/shareArticle?mini=true&title=Hybrid+AI%3A+Combining+Deterministic+Analytics+with+LLM+Reasoning&url=https%3A%2F%2Ftowardsdatascience.com%2Fhybrid-ai-combining-deterministic-analytics-with-llm-reasoning%2F"
    },
    {
      "type": "external",
      "href": "https://x.com/share?text=Hybrid+AI%3A+Combining+Deterministic+Analytics+with+LLM+Reasoning&url=https%3A%2F%2Ftowardsdatascience.com%2Fhybrid-ai-combining-deterministic-analytics-with-llm-reasoning%2F"
    },
    {
      "type": "external",
      "href": "https://www.youtube.com/c/TowardsDataScience"
    },
    {
      "type": "external",
      "href": "https://www.threads.net/@towardsdatascience"
    },
    {
      "type": "external",
      "href": "https://bsky.app/profile/towardsdatascience.com"
    },
    {
      "type": "external",
      "href": "https://thenewstack.io"
    },
    {
      "type": "external",
      "href": "https://roadmap.sh"
    },
    {
      "type": "external",
      "href": "https://insightmediagroup.io/creator-network"
    }
  ],
  "repair_version": 2,
  "repaired_at": "2026-10-20T17:26:15Z",
  "source_url": "https://towardsdatascience.com/hybrid-ai-combining-deterministic-analytics-with-llm-reasoning/",
  "delivery_status": "unverified",
  "discovery_status": "http_403",
  "missing_reason": "源页面未重新核验:http_403；已按保留正文补采图片",
  "repair_error": "",
  "actual_video_files": [],
  "expected_saved_body_images": 4,
  "image_discovery": "saved_markdown",
  "source_body_markdown": "![Revisit consent button](https://cdn-cookieyes.com/assets/images/revisit.svg)\nWe value your privacy\nWe use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking \"Accept All\", you consent to our use of cookies.\nCustomise Reject All Accept All\nCustomise Consent Preferences ![](https://cdn-cookieyes.com/assets/images/close.svg)\nWe use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.\nThe cookies that are categorised as \"Necessary\" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... Show more\nNecessaryAlways Active\nNecessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.\n  * Cookie\nBCTempID\n  * Duration\n10 minutes\n  * Description\nNo description available.\n\n\n  * Cookie\n__cf_bm\n  * Duration\n1 hour\n  * Description\nThis cookie, set by Cloudflare, is used to support Cloudflare Bot Management. \n\n\n  * Cookie\nAWSALBCORS\n  * Duration\n7 days\n  * Description\nAmazon Web Services set this cookie for load balancing.\n\n\n  * Cookie\n_cfuvid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to track users across sessions to optimize user experience by maintaining session consistency and providing personalized services\n\n\n  * Cookie\nli_gc\n  * Duration\n6 months\n  * Description\nLinkedin set this cookie for storing visitor's consent regarding using cookies for non-essential purposes.\n\n\n  * Cookie\n__hssrc\n  * Duration\nsession\n  * Description\nThis cookie is set by Hubspot whenever it changes the session cookie. The __hssrc cookie set to 1 indicates that the user has restarted the browser, and if the cookie does not exist, it is assumed to be a new session.\n\n\n  * Cookie\n__hssc\n  * Duration\n1 hour\n  * Description\nHubSpot sets this cookie to keep track of sessions and to determine if HubSpot should increment the session number and timestamps in the __hstc cookie.\n\n\n  * Cookie\nwpEmojiSettingsSupports\n  * Duration\nsession\n  * Description\nWordPress sets this cookie when a user interacts with emojis on a WordPress site. It helps determine if the user's browser can display emojis properly.\n\n\n  * Cookie\nBCSessionID\n  * Duration\n1 year 1 month 4 days\n  * Description\nBlueconic sets this cookie as a unique identifier for the BlueConic profile.\n\n\n  * Cookie\n_octo\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nlogged_in\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\n__Secure-YEC\n  * Duration\npast\n  * Description\nYouTube sets this cookie to stores the user's video player preferences using embedded YouTube video\n\n\n  * Cookie\n__eoi\n  * Duration\n6 months\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTGCORS\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\nlogin-status-p\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTG\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\ncsrf_token\n  * Duration\nsession\n  * Description\nNo description available.\n\n\n  * Cookie\ntoken_v2\n  * Duration\n1 day\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nD\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nPHPSESSID\n  * Duration\nsession\n  * Description\nThis cookie is native to PHP applications. The cookie stores and identifies a user's unique session ID to manage user sessions on the website. The cookie is a session cookie and will be deleted when all the browser windows are closed.\n\n\n  * Cookie\nVISITOR_PRIVACY_METADATA\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to store the user's cookie consent state for the current domain. \n\n\n  * Cookie\ncookietest\n  * Duration\nsession\n  * Description\nThe cookietest cookie is typically used to determine whether the user's browser accepts cookies, essential for website functionality and user experience.\n\n\n  * Cookie\n__Host-airtable-session\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\n__Host-airtable-session.sig\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\nm\n  * Duration\n1 year 1 month 4 days\n  * Description\nStripe sets this cookie for fraud prevention purposes. It identifies the device used to access the website, allowing the website to be formatted accordingly.\n\n\n  * Cookie\nBIGipServer*\n  * Duration\nsession\n  * Description\nMarketo sets this cookie to collect information about the user's online activity and build a profile about their interests to provide advertisements relevant to the user. \n\n\n  * Cookie\n__cfruid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to identify trusted web traffic.\n\n\n  * Cookie\n_GRECAPTCHA\n  * Duration\n6 months\n  * Description\nGoogle Recaptcha service sets this cookie to identify bots to protect the website against malicious spam attacks.\n\n\n  * Cookie\n__Secure-YNID\n  * Duration\n6 months\n  * Description\nGoogle cookie used to protect user security and prevent fraud, especially during the login process.\n\n\n  * Cookie\ncookieyes-consent\n  * Duration\n1 year\n  * Description\nCookieYes sets this cookie to remember users' consent preferences so that their preferences are respected on subsequent visits to this site. It does not collect or store any personal information about the site visitors.\n\n\nFunctional\nFunctional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.\n  * Cookie\nlidc\n  * Duration\n1 day\n  * Description\nLinkedIn sets the lidc cookie to facilitate data center selection.\n\n\n  * Cookie\nbrw\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nbrwConsent\n  * Duration\n5 minutes\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nWMF-Uniq\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nloom_anon_comment\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nloom_referral_video\n  * Duration\nsession\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nVISITOR_INFO1_LIVE\n  * Duration\n6 months\n  * Description\nA cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface.\n\n\n  * Cookie\nyt-remote-connected-devices\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nytidb::LAST_RESULT_ENTRY_KEY\n  * Duration\nNever Expires\n  * Description\nThe cookie ytidb::LAST_RESULT_ENTRY_KEY is used by YouTube to store the last search result entry that was clicked by the user. This information is used to improve the user experience by providing more relevant search results in the future.\n\n\n  * Cookie\nyt-remote-device-id\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-name\n  * Duration\nsession\n  * Description\nThe yt-remote-session-name cookie is used by YouTube to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\nyt-remote-fast-check-period\n  * Duration\nsession\n  * Description\nThe yt-remote-fast-check-period cookie is used by YouTube to store the user's video player preferences for embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-app\n  * Duration\nsession\n  * Description\nThe yt-remote-session-app cookie is used by YouTube to store user preferences and information about the interface of the embedded YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-available\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-available cookie is used to store the user's preferences regarding whether casting is available on their YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-installed\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-installed cookie is used to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\ncp_session\n  * Duration\n3 months\n  * Description\nCodepen sets this cookie for Help systems found in the website.\n\n\n  * Cookie\nloid\n  * Duration\n1 year 1 month 4 days\n  * Description\nThis cookie is set by the Reddit. The cookie enables the sharing of content from the website onto the social media platform.\n\n\nAnalytics\nAnalytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.\n  * Cookie\n__hstc\n  * Duration\n6 months\n  * Description\nHubspot set this main cookie for tracking visitors. It contains the domain, initial timestamp (first visit), last timestamp (last visit), current timestamp (this visit), and session number (increments for each subsequent session).\n\n\n  * Cookie\nhubspotutk\n  * Duration\n6 months\n  * Description\nHubSpot sets this cookie to keep track of the visitors to the website. This cookie is passed to HubSpot on form submission and used when deduplicating contacts.\n\n\n  * Cookie\n_ga\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors.\n\n\n  * Cookie\n_ga_*\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to store and count page views.\n\n\n  * Cookie\n__Host-psifi.analyticsTrace\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n__Host-psifi.analyticsTraceV2\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n_gh_sess\n  * Duration\nsession\n  * Description\nGitHub sets this cookie for temporary application and framework state between pages like what step the user is on in a multiple step form.\n\n\n  * Cookie\nYSC\n  * Duration\nsession\n  * Description\nYSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages.\n\n\n  * Cookie\najs_anonymous_id\n  * Duration\n1 year\n  * Description\nThis cookie is set by Segment to count the number of people who visit a certain site by tracking if they have visited before.\n\n\n  * Cookie\nvuid\n  * Duration\n1 year 1 month 4 days\n  * Description\nVimeo installs this cookie to collect tracking information by setting a unique ID to embed videos on the website. \n\n\nPerformance\nPerformance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.\n  * Cookie\nAWSALB\n  * Duration\n7 days\n  * Description\nAWSALB is an application load balancer cookie set by Amazon Web Services to map the session to the target.\n\n\n  * Cookie\nacq\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nacq.sig\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nptc\n  * Duration\n2 years\n  * Description\nNo description available.\n\n\nAdvertisement\nAdvertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.\n  * Cookie\nmuc_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to collect user behaviour and interaction data to optimize the website.\n\n\n  * Cookie\nguest_id_marketing\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\nguest_id_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\npersonalization_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to integrate and share features for social media and also store information about how the user uses the website, for tracking and targeting.\n\n\n  * Cookie\nguest_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor. It registers if a user is signed in to the Twitter platform and collects information about ad preferences.\n\n\n  * Cookie\nbcookie\n  * Duration\n1 year\n  * Description\nLinkedIn sets this cookie from LinkedIn share buttons and ad tags to recognize browser IDs.\n\n\n  * Cookie\n__Secure-ROLLOUT_TOKEN\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to manage feature rollout and experimentation. It helps Google control which new features or interface changes are shown to users as part of testing and staged rollouts, ensuring consistent experience for a given user during an experiment.\n\n\n  * Cookie\nyt.innertube::nextId\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nyt.innertube::requests\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nsession_tracker\n  * Duration\nsession\n  * Description\nThis cookie is set by the Reddit. This cookie is used to identify trusted web traffic. It also helps in adverstising on the website.\n\n\n  * Cookie\nedgebucket\n  * Duration\nsession\n  * Description\nReddit sets this cookie to save the information about a log-on Reddit user, for the purpose of advertisement recommendations and updating the content.\n\n\n  * Cookie\ndid\n  * Duration\n1 year\n  * Description\nArbor sets this cookie to show targeted ads to site visitors.This cookie expires after 2 months or 1 year.\n\n\nUncategorised\nOther uncategorised cookies are those that are being analysed and have not been classified into a category as yet.\nNo cookies to display.\nReject All Save My Preferences Accept All\nToggle Search[](https://towardsdatascience.com/)Toggle Mobile Navigation\n[](https://towardsdatascience.com/)\nPublish AI, ML & data-science insights to a global community of data professionals.\nSign in[Submit an Article](https://write.insightmediagroup.io)\n[Latest](https://towardsdatascience.com/latest/)[Editor's Picks](https://towardsdatascience.com/tag/editors-pick/)[Newsletter](https://towardsdatascience.com/tag/the-variable/)[ShipAI](https://towardsdatascience.com/shipai/)\n* * *\n[Write For TDS](https://towardsdatascience.com/submissions/)\n[LinkedIn](https://www.linkedin.com/company/towards-data-science/)[X](https://x.com/TDataScience)Toggle Search\n[Agentic AI](https://towardsdatascience.com/category/artificial-intelligence/agentic-ai/)\n# Hybrid AI: Combining Deterministic Analytics with LLM Reasoning\nHow AI architecture prevents plausible but wrong analytics\n[Ingo Nowitzky](https://towardsdatascience.com/author/ingo.nowitzky/)\nMay 22, 202617 min read\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/05/Feature_Image_v2-2.png)\nGenerated by author using ChatGPT\n## Introduction\nI tried to build an agentic AI network for my company that advises manufacturing plants on how to mature their operations. The system was designed to be data-driven, allowing users to upload assessment data directly through the chat interface. The first working prototype was finished surprisingly quickly, and at first glance the results looked promising.\nThere was only one problem: Most of the results were wrong!\nEven worse, the AI quickly learned which numerical ranges looked plausible and began generating convincing — but fabricated — outputs. Combined with the eloquent language generation of the LLM, these results could easily be mistaken for truth. And this behavior was not limited to a single model. Similar patterns appeared across all tested systems: ChatGPT, Gemini Enterprise, DIA Brain, and Microsoft Copilot.\n**But plausible data is not enough, Enterprise AI systems require reliable data**.\nFurther investigation revealed recurring failure modes. Even with “Code Interpreter” enabled, the systems:\n  * skipped rows or columns,\n  * applied incorrect filters,\n  * returned identical results for different inputs,\n  * silently mixed parts of the dataset,\n  * or simply collapsed under more complex analytical tasks.\n\n\nThis led to a crucial realization:\n**Probabilistic reasoning is extremely powerful for interpretation and interaction — but foundational data analysis requires deterministic execution.**\nLearn this step by step with the interactive [AI Agents](https://roadmap.sh/ai-agents) roadmap.\n## Table of contents\n1 The Use Case  \n2 The Hybrid Architecture  \n3 The Analysis Planner  \n4 The Analysis Engine  \n5 An End-to-End example  \n6 Why AI Architecture Matters\n## 1 The Use Case\nAlthough the specific use case is of secondary importance, it is briefly outlined here to support the practical understanding of the underlying architectural challenge.\nThe primary task of our agent is to advise manufacturing plants and value streams on how to improve their operational maturity: optimizing processes, improving productivity, reducing inventory levels, and ultimately lowering operational costs. To achieve this, the consultation agent operates in two modes:\n  1. It provides generic recommendations for improving specific operational topics based on the retrieval of specialized “how-to” documentation and assessment questionnaires.\n  2. The agent is intended to analyze the current situation of a plant or value stream based on assessment results and assessors’ written recommendations. Based on this analysis, it is expected to provide highly specific recommendations for the next improvement steps.\n\n\nIn both modes — as with most LLM-based AI models — the user can interactively discuss ideas and recommendations with the agent in order to derive the most suitable action plan.\nFor the second operation mode, it is essential that the agent can reliably process and analyze assessment data. In our case, this data is provided as an Excel export from a central database. Ideally, the agent should be able to process the file without any prior manual preparation.\nThe structure of the file, however, is challenging. Since all assessment results, intermediate calculations, metadata, and detailed assessment questions are stored in separate columns, the worksheet contains more than 800 columns. The number of rows corresponds to the number of assessments in the database and can range from one to several hundreds (Fig. 1). Assessment ratings are represented as integers from 0 to 4. In addition, the file contains more than 160 free-text fields with qualitative observations, strengths, weaknesses, and recommendations from the assessors.\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/05/Image_1-1024x295.png)\nFigure 1: Assessment data structure | image by author\nThe analytical tasks of the agent include filtering relevant rows and columns for a specific request, calculating averages, aggregating maturity scores, summarizing textual recommendations, and deriving meaningful improvement suggestions from the results.\nInitially, these tasks appeared to be well within the capabilities of modern LLM-based AI systems, especially with “Code Interpreter” mode enabled. As already mentioned in the introduction, this assumption quickly turned out to be a misconception.\n## 2 The Hybrid Architecture\nThe core idea for overcoming the analytical challenge was to clearly separate deterministic data analysis from LLM-based reasoning and interpretation. Fig. 2 shows the selected system architecture after several improvement iterations. The system was implemented in Microsoft Copilot Studio because the platform allows deterministic workflow elements, such as topics and flows, to be combined with LLM-based reasoning components.\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/05/Image_2-1024x533.png)\nFigure 2: System architecture of the consultation agent with integrated analytics module | image by author\nThe parent agent handles all communication with the user. It orchestrates the sub agents and the analytics module, delegates tasks to them, receives their responses, and composes the final answer.\nThe sub agents are specialized LLM-based modules with access to specific knowledge sources. These include descriptions of maturity-level expectations for the value streams, questionnaires with detailed assessment questions, and more general guidelines for operational excellence. The sub agents are called by the parent agent according to their specific capabilities and respond to the parent agent rather than directly to the user.\nThe analytics module is the main focus of this article. It performs the deterministic data analysis and is designed to provide reproducible and reliable analytical results. It receives an analysis instruction in natural language from the parent agent, referred to as `Parent_Instruction`. The analytics module itself consists of topics, flows, and AI modules, which are called “prompts” in Copilot Studio.\nThe topic `T_receive_Excel_File` handles the upload and storage of assessment files. It is triggered when a file is uploaded in the chat window, indicated by the variable `System.Activity.Attachments` having a value. The topic checks whether the uploaded file is an Excel file and, if so, stores it in the global variable `Assessment_File`.\nThe topic `T_analyze_assessments` is actively called by the parent agent if it has an analytics task to conduct and receives `Parent_Instruction` as input. A second input is the assessment data stored in the global variable `Assessment_File`. The topic contains the two core analytics components: `Analysis_Planner` and `Analysis_Engine`. Both are embedded in agentic flows, `F_Call_Analysis_Planner` and `F_Call_Analysis_Engine`. These flows serve as connectors between the topic `T_analyze_assessments` and the AI prompts `P_Analysis_Planner` and `P_Analysis_Engine`.\n`F_Call_Analysis_Planner` receives only one input, `Parent_Instruction`, and forwards it to `P_Analysis_Planner`. This component generates the `Selection_Rule`, the core analysis instruction to be executed by `P_Analysis_Engine`. The inner workings of `P_Analysis_Planner` are discussed in Chapter 3.\n`F_Call_Analysis_Engine` receives three inputs: the `Selection_Rule` from `Analysis_Planner`, a `Mapping_File` provided from SharePoint, and the `Assessment_File`. All three inputs are forwarded to the AI prompt `P_Analysis_Engine`, which conducts the data analysis as specified by `Analysis_Planner`. The `P_Analysis_Engine` is discussed in detail in Chapter 4.\n## 3 The Analysis Planner\nThe `P_Analysis_Planner` is the intelligent part of the data analysis pipeline and generates the analysis instruction, called `Selection_Rule`. This instruction is a translation of the natural language `Parent_Instruction` and is generally unique for each request. In order to minimize probabilistic variation, the translation process is constrained by strict rules.\n**The Analysis_Planner does not analyze the assessment data itself. Its sole responsibility is to translate the probabilistic**`Parent_Instruction`**into a deterministic analysis specification.**\nIn the following, we will examine selected parts of the instruction in more detail. You can download the full instruction [here](https://www.dropbox.com/scl/fi/ksbs011eslbo10xlrt7lm/Instruction_Analysis_Planner.txt?rlkey=fyp8y9824fb0kdm55dmlvdv1r&st=fg8qdxah&dl=0).\nmarkup\n\n```\nYou are Analysis_Planner, an expert assistant for translating natural-language assessment analysis requests into structured Selection_Rules.Your task is to create a Selection_Rule JSON object for the Analysis_Engine.You receive only one input:1. Parent_Instruction :A natural-language analysis request from the parent agent (orchestrator).You must analyze Parent_Instruction and determine:- which type of analysis is required,- which assessment content categories are relevant,- whether concept or execution maturity/findings are requested,- whether specific chapters are requested,- and whether row filters are required.The Selection_Rule you generate will later be used by the Analysis_Engine together with:- the real assessment data file,- and the Mapping_Fileto execute the analysis deterministically.\n```\n\nThe code box above shows the initial instruction for `P_Analysis_Planner`. It clearly defines purpose and scope and explicitly separates planning from execution. The planner translates the request, while the actual execution is delegated to the `P_Analysis_Engine`.\nNext follows a longer section describing the semantics of the assessment data. Of course, this part is highly specific to the individual use case and dataset. It defines semantic categories used for row filtering and categories used to select the actual analysis targets (TARGET CONTENT CATEGORIES and TARGET SELECTION ATTRIBUTES).\nyaml\n\n```\nASSESSMENT DATA SEMANTICS\n\nThe assessment data can be addressed through the following semantic categories.\n\nROW FILTER CATEGORIES\n\nUse these categories only for row_filters:\n\n- VS_Nr:\n    Unique identifier of the value stream.\n    Use when filtering by value stream number.\n\n- Value Stream:\n    Name of the value stream.\n    Use when filtering by value stream name.\n\n- ...\n\nTARGET CONTENT CATEGORIES\n\nUse these categories only in target_selection_rules.data_category:\n\n- chapter_score:\n    Numeric maturity score.\n    Use for maturity calculations, score analysis, and average maturity analysis.\n\n- strength:\n    Assessor statements describing strengths.\n\n- ...\n\nTARGET SELECTION ATTRIBUTES\n\nUse these attributes only inside target_selection_rules:\n\n- data_category:\n    Defines which target content category is needed.\n\n- aggregation_allowed:\n    Use:\n        - mean for numeric maturity averages\n        - summary for textual summaries\n\n- ...\n```\n\nThe planner never interacts directly with physical dataset columns. Instead, it operates on a semantic abstraction layer that decouples natural language from the underlying dataset structure.\nThis separation is important because the assessment dataset contains more than 800 columns, including:\n  * maturity ratings,\n  * textual assessor findings,\n  * metadata,\n  * organizational mappings,\n  * questionnaire variants,\n  * and concept/execution distinctions.\n\n\nSelecting the correct target columns therefore becomes a critical part of the analysis process.\nRestricting the allowed analysis types is equally important. The planner is intentionally prevented from inventing arbitrary analytical operations. The section ANALYSIS TYPES therefore defines the only valid analysis types — currently just two. This significantly improves the predictability and robustness of downstream execution. Of course, the list can easily be extended for individual use cases.\nyaml\n\n```\nANALYSIS TYPES\n\nUse exactly one of these analysis_type values:\n\n- numeric_mean\n    Use for:\n    - average maturity\n    - mean maturity\n    - ...\n\n- text_summary\n    Use for:\n    - strengths\n    - improvement potentials\n    - ...\n```\n\nThe next section defines how the planner selects the relevant target columns in an abstract and deterministic way. The rules distinguish between the two predefined analysis types `numeric_mean` and `text_summary` and finally determine which dataset columns are selected for a specific request.\nyaml\n\n```\nRULES FOR target_selection_rules\n\nNUMERIC MATURITY ANALYSIS\n\nFor numeric maturity analysis:\n- analysis_type must be:\n    \"numeric_mean\"\n- data_category must be:\n    [\"chapter_score\"]\n- ...\n\nTEXT SUMMARY ANALYSIS\n\nFor textual summary analysis:\n- analysis_type must be:\n    \"text_summary\"\n- data_category:\n    include only requested categories:\n        - \"strength\"\n        - \"potential\"\n        - \"recommendation\"\n        - \"remark\"\n- ...\n```\n\nA similar logic applies to the row filtering process.\nyaml\n\n```\nRULES FOR row_filters\n\nUse row_filters only for filtering rows in the assessment dataset.\n\nAllowed row filter keys are:\n- VS_Nr\n- Value Stream\n- ...\n\nDo NOT use row_filters for:\n- chapter_id\n- ...\n\nThese belong only to target_selection_rules.\n```\n\nFinally, the instruction defines the required output structure together with several strict “do-not rules”. This section is particularly important because the generated output is directly forwarded to the `P_Analysis_Engine` and therefore must follow a clearly defined and machine-readable structure.\njson\n\n```\nOUTPUT FORMAT\n\nReturn only valid JSON.\nDo not return markdown.\nDo not return Python code.\n...\n\nUse exactly this structure:\n\n{\n  \"status\": \"success\",\n  \"parent_instruction_summary\": \"\",\n  \"selection_rule\": {\n    \"analysis_type\": \"\",\n    \"target_selection_rules\": {\n      \"data_category\": [],\n      \"aggregation_allowed\": [],\n      \"concept_execution\": null,\n      \"chapter_id\": null\n    },\n    \"row_filters\": {}\n  },\n  \"warnings\": []\n}\n```\n\nIf the request is unclear, the planner must explicitly return an error structure instead of “guessing” a potentially wrong analysis instruction.\njson\n\n```\nIf the task is unclear, return:\n\n{\n  \"status\": \"error\",\n  \"parent_instruction_summary\": \"\",\n  \"selection_rule\": {\n    \"analysis_type\": null,\n    \"target_selection_rules\": {\n      \"data_category\": [],\n      \"aggregation_allowed\": [],\n      \"concept_execution\": null,\n      \"chapter_id\": null\n    },\n    \"row_filters\": {}\n  },\n  \"warnings\": [\n    \"The analysis task is not clearly understood.\"\n  ]\n}\n```\n\nAt this point, the planner has transformed ambiguous natural language into a deterministic analysis specification. However, the actual data execution still has not happened.\nIn chapter 5, we will follow a real user request through the complete pipeline and examine how `P_Analysis_Planner` generates the `Selection_Rule` and how `P_Analysis_Engine` executes it on the assessment dataset.\n## 4 The Analysis Engine\nUnlike the `P_Analysis_Planner`, the `P_Analysis_Engine` does not reason about the task. It only executes the analysis specification generated by `P_Analysis_Planner`.\nAs in chapter 3, we will focus only on the most relevant parts of the instruction. The full specification can be downloaded [here](https://www.dropbox.com/scl/fi/6rsqjcokgdwj6bczxax7u/Instruction_Analysis_Engine.txt?rlkey=k0wiqgzusrafx45iv8nr5n06p&st=4kqtw3le&dl=0).\nThe instruction of `P_Analysis_Engine` starts with the basic task definition. In essence, the AI prompt is used as a controlled Python execution environment. The code is predefined in the prompt instruction and must only be executed, not modified.\nmarkup\n\n```\nYou are Analysis_Engine, a deterministic pandas-based analysis executor.Your task is to analyze an Excel assessment dataset using Code Interpreter.You receive three inputs:1. document    The Excel file containing the assessment data.2. Mapping_File    The Excel file describing the columns of document.3. Selection_Rule    A JSON object that defines:   - which columns to select from Mapping_File   - which row filters to apply to document   - which type of analysis to performYou must not reinterpret the original user request.You must not infer additional columns.You must not change Selection_Rule.You must not generate a new analysis approach.You must only execute the deterministic Python script below.Use Code Interpreter to execute the Python script.Return only the JSON result printed by the script.Do not return markdown.Do not explain the code.Do not add text before or after the JSON result.\n```\n\n`P_Analysis_Engine` receives three input files:\n  1. The `Assessment_File` uploaded from the user in the chat interface. It is stored in the prompt-internal variable `document`.\n  2. A `Mapping_File` which the flow `F_Call_Analysis_Engine` loads from SharePoint in preparation of the execution.\n  3. The `Selection_Rule` generated by `P_Analysis_Planner` (see chapter 3).\n\n\nThe `Mapping_File` plays a crucial role in defining the semantics of the many columns in `Assessment_File` on a higher level of abstraction. With this abstraction layer, the `Selection_Rule` only needs to specify which type of information is required, while the `P_Analysis_Engine` selects the corresponding dataset columns during execution.\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/05/Image_3-1024x411.png)\nFigure 3: Structure of `Mapping_File` | image by author\nFig. 3 shows the structure of `Mapping_File`. It contains a row for each column of `Assessment_File`, that is potentially relevant for the data analysis. Data columns that are clearly irrelevant are not represented in `Mapping_File` and therefore are not visible to `P_Analysis_Engine`. For each row, the file specifies the selection criteria:\n  * `data_category`:   \nFunctional meaning of the column, e.g. maturity score, strength, plant name, region, or season.\n  * `chapter_id`:  \nUnique identifier of the assessment chapter.\n  * `chapter_name`:  \nHuman-readable name of the assessment chapter.\n  * `concept_execution`:  \nIndicates whether the column belongs to concept or execution maturity.\n  * `aggregation_allowed`:  \nDefines which type of aggregation is valid for the column, e.g. `mean` for numeric maturity scores or `summary` for textual findings.\n\n\nNext in `P_Analysis_Engine`’s instruction comes a paragraph about how to interpret the Selection_Rule.\nmarkup\n\n```\nRules for Selection_Rule:- analysis_type = \"numeric_mean\":  Calculate arithmetic means for all selected numeric target columns.- analysis_type = \"text_summary\":  Collect non-empty text entries from all selected text target columns.- target_selection_rules:  Select target columns by matching Mapping_File attributes.  A rule value of null means: do not filter by this attribute.  A list means: keep rows where the Mapping_File attribute is in the list.- row_filters:  Apply row filters to document.  Keys are data_category values from Mapping_File, such as \"Plant\", \"Region\", \"Production Principle\", \"Season\".  Values are lists of accepted values.\n```\n\nThe selection specifies:\n  * which analysis operation must be executed (`analysis_type`),\n  * how relevant target columns are selected from the `Mapping_File` (`target_selection_rules`),\n  * and how the assessment dataset is filtered before the analysis is performed (`row_filters`).\n\n\nThis instruction is intentionally deterministic. The `P_Analysis_Engine` is not allowed to reinterpret the original user request or invent additional analytical operations.\nAfter the instruction block, the `P_Analysis_Engine` receives the actual Python script. The full script contains more than 300 lines of code and is part of the AI prompt instruction. It is linked at the top of this chapter and can be downloaded. Many of the code lines are not conceptually important for the architecture. They handle practical robustness: cleaning column names, normalizing input values, handling missing columns, converting Copilot wrapper objects, and returning structured error messages.\nFor the article, I will focus only on the central logic.\nThe first important step is that the engine loads the uploaded assessment data (now available in `document`) and the `Mapping_File`. From this point on, the LLM is no longer interpreting the user request. It only executes the deterministic script based on the `Selection_Rule`.\npython\n\n```\nmapping_df = pd.read_excel(Mapping_File)\ndata_df = pd.read_excel(document)\n\nmapping_df = strip_column_names(mapping_df)\ndata_df = strip_column_names(data_df)\n```\n\nThe key architectural element is the selection of target columns. The `P_Analysis_Engine` never guesses which Excel columns may be relevant. Instead, it filters the `Mapping_File` according to the attributes defined in `target_selection_rules`.\npython\n\n```\ntarget_mapping = mapping_df.copy()\n\nfor attr, rule_value in target_selection_rules.items():\n\n    values = normalize_rule_value(rule_value)\n    values = normalize_list_for_matching(values)\n\n    if values is None:\n        continue\n\n    target_mapping = target_mapping[\n        target_mapping[attr]\n        .apply(normalize_for_matching)\n        .isin(values)\n    ]\n\nselected_target_columns = (\n    target_mapping[\"source_column_name\"]\n    .dropna()\n    .tolist()\n)\n```\n\nThis is the point where the abstract analysis instruction becomes concrete. For example, a rule such as `chapter_id = [\"3.5\"]`, `data_category = [\"chapter_score\"]`, and `aggregation_allowed = [\"mean\"]` is translated into the actual Excel columns containing the Concept and Execution maturity scores for chapter 3.5.\nThe same principle is applied to row filters. Again, the engine does not infer anything from natural language. It only applies the filters explicitly provided in the `Selection_Rule`.\npython\n\n```\nfiltered_df = data_df.copy()\n\nfor filter_category, filter_values in row_filters.items():\n\n    filter_mapping = mapping_df[\n        mapping_df[\"data_category\"]\n        .apply(normalize_for_matching)\n        == normalize_for_matching(filter_category)\n    ]\n\n    filter_col = filter_mapping[\"source_column_name\"].iloc[0]\n\n    filtered_df = filtered_df[\n        filtered_df[filter_col]\n        .apply(normalize_for_matching)\n        .isin(values)\n    ]\n```\n\nAfter column selection and row filtering, the actual analysis logic becomes intentionally straightforward. For numeric maturity analysis, the engine calculates arithmetic means for all selected numeric target columns.\npython\n\n```\nif analysis_type == \"numeric_mean\":\n\n    numeric_result = {}\n\n    for col in available_target_columns:\n\n        series = pd.to_numeric(filtered_df[col], errors=\"coerce\")\n        valid_count = int(series.notna().sum())\n\n        numeric_result[col] = {\n            \"mean\": float(series.mean()) if valid_count > 0 else None,\n            \"valid_count\": valid_count\n        }\n\n    result[\"result\"] = numeric_result\n```\n\nFor textual analysis, the engine collects non-empty assessor statements instead of calculating values.\npython\n\n```\nelif analysis_type == \"text_summary\":\n\n    text_result = {}\n\n    for col in available_target_columns:\n\n        values = [\n            clean_text_value(v)\n            for v in filtered_df[col].tolist()\n        ]\n\n        values = [v for v in values if v is not None]\n\n        text_result[col] = {\n            \"entries\": values,\n            \"entry_count\": len(values)\n        }\n\n    result[\"result\"] = text_result\n```\n\nFinally, the result is returned as JSON. This is important because the output is not yet the final user-facing answer. It is the reliable analytical foundation for the next LLM step: interpretation by the parent agent.\npython\n\n```\nprint(json.dumps(result, indent=2, ensure_ascii=False))\n```\n\nThis design deliberately keeps the `P_Analysis_Engine` “boring”. It does not reason, it does not explain, and it does not improve the analysis. It only executes. And that is exactly the point. The more deterministic this layer is, the more trust can be placed in the later LLM-generated interpretation.\n## 5 End-to-End Example\nTo illustrate the complete workflow, let us follow a realistic example through the full pipeline.\nTriggered by the user interaction, the parent agent might raise the following `Parent_Instruction` to the analytics module:\n**“Summarize the main improvement potentials for chapter 1.4 Failure Prevention System in plant AbcP.”**\nThe request looks simple for a human reader, but it already contains multiple semantic tasks:\n  * identify the requested assessment chapters,\n  * detect the requested content type,\n  * apply a row filter,\n  * retrieve the correct text columns,\n  * aggregate textual findings,\n  * and finally generate a meaningful interpretation ( → parent agent).\n\n\nThis is exactly the type of task where a pure LLM-based analysis becomes unreliable. The system therefore separates the workflow into deterministic execution steps and probabilistic interpretation steps.\n### 5.1 Translation from Analysis Planner\nThe first step is performed by `P_Analysis_Planner`.  \nIt translates the natural language request into a deterministic `Selection_Rule`.\njson\n\n```\n{\n  \"status\": \"success\",\n  \"parent_instruction_summary\": \"Summarize improvement potentials for chapter 1.4 Failure Prevention System in plant AbcP.\",\n  \"selection_rule\": {\n    \"analysis_type\": \"text_summary\",\n    \"target_selection_rules\": {\n      \"data_category\": [\"potential\"],\n      \"aggregation_allowed\": [\"summary\"],\n      \"concept_execution\": null,\n      \"chapter_id\": [\"1.4\"]\n    },\n    \"row_filters\": {\n      \"Plant\": [\"AbcP\"]\n    }\n  },\n  \"warnings\": []\n}\n```\n\nThe `Selection_Rule` already contains the complete deterministic analysis specification:\n  * `analysis_type = \"text_summary\"`  \nindicates that textual assessor findings must be collected instead of numeric calculations.\n  * `data_category = [\"potential\"]`  \nrestricts the analysis to improvement potentials.\n  * `chapter_id = [\"1.4\"]`  \nlimits the analysis to the Failure Prevention System chapter.\n  * `row_filters = {\"Plant\": [\"AbcP\"]}`  \nrestricts the dataset to the requested plant.\n\n\nAt this stage, no data analysis has happened yet. The result is only an execution instruction for the next step.\n### 5.2 Execution from Analysis Engine\nThis `Selection_Rule` is handed over to `P_Analysis_Engine` for execution. First, the engine selects all matching target columns from the `Mapping_File`.\npython\n\n```\ntarget_mapping = target_mapping[\n    target_mapping[attr]\n    .apply(normalize_for_matching)\n    .isin(values)\n]\n```\n\nThis translates the abstract selection criteria into real dataset columns, for example:\npython\n\n```\nselected_target_columns = [\n    \"1.4 CON L2 Improvement potentials\",\n    \"1.4 CON L3 Improvement potentials\",\n    \"1.4 EXE L2 Improvement potentials\",\n    \"1.4 EXE L3 Improvement potentials\"\n]\n```\n\nNext, the row filters are applied:\npython\n\n```\nfiltered_df = filtered_df[\n    filtered_df[filter_col]\n    .apply(normalize_for_matching)\n    .isin(values)\n]\n```\n\nIn this example, the dataset is reduced to assessment rows belonging to plant AbcP.\nFinally, the engine collects all non-empty text entries from the selected columns.\npython\n\n```\nvalues = [\n    clean_text_value(v)\n    for v in filtered_df[col].tolist()\n]\n\nvalues = [v for v in values if v is not None]\n```\n\nAs we can see, the engine does not interpret the findings. It only retrieves and structures them according to the Python script.\nThe engine’s output is a collection of assessors’ written statements about the value stream’s improvement potentials as a JSON object.\njson\n\n```\n{\n  \"entry_count\": 6,\n  \"entries\": [\n    \"Root causes are not systematically tracked.\",\n    \"Escalation rules for recurring failures are unclear.\",\n    \"Lessons learned are not transferred between shifts.\",\n    \"Preventive maintenance findings are not integrated into CIP activities.\",\n    \"Failure trends are visualized inconsistently.\",\n    \"Problem-solving activities focus mainly on symptoms instead of root causes.\"\n  ]\n}\n```\n\nAt this point, the system has still not generated any recommendations. It has only produced a reliable collection of relevant assessment findings. **This JSON object is returned to the parent agent for interpretation and generation of the final response to the user.**\n### 5.3 Interpretation from Parent Agent\nIn the final step, the parent agent collects all responses (potentially additional responses from the sub agents) and generates the final output.\nmarkup\n\n```\nThe collected findings indicate that the Failure Prevention System iscurrently more reactive than preventive. Most gaps are related to missingsystematic root-cause management and weak organizational learning acrossshifts and teams. The highest leverage improvements would likely come fromstrengthening escalation routines, integrating preventive maintenance findingsinto CIP activities, and establishing consistent cross-shift learningmechanisms.\n```\n\nTo summarize the central architectural idea of the system:\nThe LLM no longer creates the analytical foundation itself. Instead, it interprets a deterministic set of already validated findings.\nThe probabilistic reasoning capability of the LLM is used where it creates value: interpretation, prioritization, explanation, and communication — not data processing itself.\n## 6 Why AI Architecture Matters\nLarge Language Models are naturally strong at interpretation, reasoning, and language generation, but still weak at reliable numerical analytics. Their optimization target is plausibility, not deterministic reproducibility. Even with extensions such as “Code Interpreter”, this weakness remains visible in more complex analytical scenarios.\nThe good news is that this limitation can largely be compensated through intelligent system architecture. The key is a clear separation of responsibilities: deterministic data-processing layers execute the analytical foundation, while LLMs focus on interpretation, prioritization, explanation, and communication.\nIn the presented approach, the most important design decision was therefore not adding more AI to the system. It was defining very carefully where probabilistic reasoning should end and deterministic execution should begin.\nReliable agentic systems will likely require exactly these kinds of hybrid architectures: combining the robustness of classical data science pipelines with the inference capabilities of Large Language Models.\n## Register Now to Continue Reading\n### Unlock Towards Data Science with a Free Account\nAll articles on Towards Data Science are available to registered users. Create a free account today to access this article and thousands more.\nRegister for freeSign in to your account\n* * *\n![](https://assets.insightmediagroup.io/media/1787657681444_t7ljpr.jpeg)\nWritten By\n## [Ingo Nowitzky](https://towardsdatascience.com/author/ingo.nowitzky/)\nPhD Engineer, Lean Production professional, and AI enthisiast.\n[See all from Ingo Nowitzky](https://towardsdatascience.com/author/ingo.nowitzky/)\n[Deep Dives](https://towardsdatascience.com/tag/deep-dives/)[Ai Agent](https://towardsdatascience.com/tag/ai-agent/)[Artificial Intelligence](https://towardsdatascience.com/tag/artificial-intelligence/)[Data Science](https://towardsdatascience.com/tag/data-science/)[Llm](https://towardsdatascience.com/tag/llm/)\nShare This Article\n  * [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Ftowardsdatascience.com%2Fhybrid-ai-combining-deterministic-analytics-with-llm-reasoning%2F&title=Hybrid%20AI%3A%20Combining%20Deterministic%20Analytics%20with%20LLM%20Reasoning)\n  * [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Ftowardsdatascience.com%2Fhybrid-ai-combining-deterministic-analytics-with-llm-reasoning%2F&title=Hybrid%20AI%3A%20Combining%20Deterministic%20Analytics%20with%20LLM%20Reasoning)\n  * [](https://x.com/share?url=https%3A%2F%2Ftowardsdatascience.com%2Fhybrid-ai-combining-deterministic-analytics-with-llm-reasoning%2F&text=Hybrid%20AI%3A%20Combining%20Deterministic%20Analytics%20with%20LLM%20Reasoning)\n\n\nTowards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program.\n[Write for TDS](https://towardsdatascience.com/submissions/)\n## Related Articles\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/06/1GimV7Taz8hAp7ekbsTruPw.jpeg)](https://towardsdatascience.com/training-a-neural-network-with-a-few-clean-lines-of-code-b688da064bd5/)\n## [Training a Neural Network With a Few, Clean Lines of Code](https://towardsdatascience.com/training-a-neural-network-with-a-few-clean-lines-of-code-b688da064bd5/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nReusable, maintainable and easy to understand machine learning code.\n[Daniel](https://towardsdatascience.com/author/etzold/)\nJune 14, 20227 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/08/1mgKnhN-EwA2_nmsFyU5Low.gif)](https://towardsdatascience.com/build-a-mfcc-based-music-recommendation-engine-on-cloud-3bf3cfbd594b/)\n## [Build A MFCC-Based Music Recommendation Engine On Cloud](https://towardsdatascience.com/build-a-mfcc-based-music-recommendation-engine-on-cloud-3bf3cfbd594b/)\n[Data Science](https://towardsdatascience.com/category/data-science/)\nAn approachable guide to creating unstructured data-driven, innovative apps in Microsoft Azure.\n[Xiaoqian Wang](https://towardsdatascience.com/author/wxqqaz123/)\nAugust 13, 202113 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/08/Screenshot-2026-08-22-at-8.21.59-PM.png)](https://towardsdatascience.com/4-claude-skills-every-data-scientist-needs-in-2026/)\n## [4 Claude Skills Every Data Scientist Needs in 2026](https://towardsdatascience.com/4-claude-skills-every-data-scientist-needs-in-2026/)\n[Agentic AI](https://towardsdatascience.com/category/artificial-intelligence/agentic-ai/)\nFour skills worth adding to your workflow today if you don't want to be left behind\n[Haden Pelletier](https://towardsdatascience.com/author/pelletierhaden/)\nAugust 29, 20268 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/04/one_repo_many_desks.jpg)](https://towardsdatascience.com/ai-agents-need-their-own-desk-and-git-worktrees-give-it-one/)\n## [AI Agents Need Their Own Desk, and Git Worktrees Give Them One](https://towardsdatascience.com/ai-agents-need-their-own-desk-and-git-worktrees-give-it-one/)\n[Agentic AI](https://towardsdatascience.com/category/artificial-intelligence/agentic-ai/)\nGit worktrees, parallel agentic coding sessions, and the setup tax you should be aware of\n[Ruben Broekx](https://towardsdatascience.com/author/broekxruben/)\nApril 18, 202617 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/02/image-68.jpg)](https://towardsdatascience.com/use-openclaw-to-make-a-personal-ai-assistant/)\n## [Use OpenClaw to Make a Personal AI Assistant](https://towardsdatascience.com/use-openclaw-to-make-a-personal-ai-assistant/)\n[Agentic AI](https://towardsdatascience.com/category/artificial-intelligence/agentic-ai/)\nLearn how to set up OpenClaw as a personalized AI agent\n[Eivind Kjosbakken](https://towardsdatascience.com/author/oieivind/)\nFebruary 17, 20269 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2025/10/image-134.jpg)](https://towardsdatascience.com/how-to-build-tools-for-ai-agents/)\n## [How to Build Tools for AI Agents](https://towardsdatascience.com/how-to-build-tools-for-ai-agents/)\n[Agentic AI](https://towardsdatascience.com/category/artificial-intelligence/agentic-ai/)\nLearn how to design and build effective tools to be used by AI Agents\n[Eivind Kjosbakken](https://towardsdatascience.com/author/oieivind/)\nOctober 15, 20259 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/02/1XO-MjbODuGLdSy8m5xe15Q.png)](https://towardsdatascience.com/the-new-face-of-data-governance-44eee0a91e68/)\n## [The New Face of Data Governance](https://towardsdatascience.com/the-new-face-of-data-governance-44eee0a91e68/)\n[Data Science](https://towardsdatascience.com/category/data-science/)\nData governance is dead. Here's how we can resurrect it.\n[Louise de Leyritz](https://towardsdatascience.com/author/louise.de.leyritz/)\nFebruary 3, 202216 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/04/image-79.jpg)](https://towardsdatascience.com/how-to-apply-claude-code-to-non-technical-tasks/)\n## [How to Apply Claude Code to Non-technical Tasks](https://towardsdatascience.com/how-to-apply-claude-code-to-non-technical-tasks/)\n[Agentic AI](https://towardsdatascience.com/category/artificial-intelligence/agentic-ai/)\nLearn how to apply coding agents to all tasks on your computer\n[Eivind Kjosbakken](https://towardsdatascience.com/author/oieivind/)\nApril 13, 20267 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/08/guerrillabuzz-UZWZrhqsXwI-unsplash-scaled.jpg)](https://towardsdatascience.com/graph-engineering-for-ai-agents-from-prompts-and-loops-to-workflows/)\n## [Graph Engineering for AI Agents: From Prompts and Loops to Workflows](https://towardsdatascience.com/graph-engineering-for-ai-agents-from-prompts-and-loops-to-workflows/)\n[Agentic AI](https://towardsdatascience.com/category/artificial-intelligence/agentic-ai/)\nA viral debate over loops versus graphs points to a bigger shift in how we build AI systems. Here’s what graph engineering actually means, how it differs from prompt, context, and loop engineering, and why it matters.\n[Nhu Hoang](https://towardsdatascience.com/author/hoanganhquynhnhu/)\nSeptember 14, 202617 min read\n\n\n  * [YouTube](https://www.youtube.com/c/TowardsDataScience)\n  * [X](https://x.com/TDataScience)\n  * [LinkedIn](https://www.linkedin.com/company/towards-data-science/)\n  * [Threads](https://www.threads.net/@towardsdatascience)\n  * [Bluesky](https://bsky.app/profile/towardsdatascience.com)\n\n\n[](https://towardsdatascience.com/)\nYour home for data science and AI. The world's leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals.\nSubscribe to Our Newsletter[Write For TDS](https://towardsdatascience.com/submissions/)•[About](https://towardsdatascience.com/about-towards-data-science-d691af11cc2f/)•[Advertise](https://contact.towardsdatascience.com/advertise-with-towards-data-science)•[Privacy Policy](https://towardsdatascience.com/privacy-policy/)•[Terms of Use](https://towardsdatascience.com/website-terms-of-use/)\n© Insight Media Group, LLC 2026•[The New Stack](https://thenewstack.io)•[roadmap.sh](https://roadmap.sh)•[Creator Network](https://insightmediagroup.io/creator-network)\n####  Recommended Articles \nClose\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500) Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1 ](https://towardsdatascience.com/javascript-fatigue-you-dont-need-js-to-build-chatgpt/ \"Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500) The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs ](https://towardsdatascience.com/subset-sum-problem-solved-in-linear-time-for-dense-enough-inputs/ \"The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500) Does Your Company Have a Data Strategy? ](https://towardsdatascience.com/does-your-company-have-a-data-strategy-e8944dbec4ae/ \"Does Your Company Have a Data Strategy?\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/4970/image?etag=1780565225463&width=500&height=500) Productivity Tips, Data Career Insights, and Other Recent Must-Reads ](https://towardsdatascience.com/productivity-tips-data-career-insights-and-other-recent-must-reads-5c47eb7a2fe0/ \"Productivity Tips, Data Career Insights, and Other Recent Must-Reads\")\n\n\n",
  "body_base_path": "attachments/605cdd7f40a1/pages/",
  "body_markdown_path": "attachments/605cdd7f40a1/pages/archived-body.md",
  "local_html": "attachments/605cdd7f40a1/pages/archived-body.html",
  "body_source": "prior_capture"
}