{"id":2974,"date":"2025-05-29T15:07:20","date_gmt":"2025-05-29T15:07:20","guid":{"rendered":"https:\/\/techtrendfeed.com\/?p=2974"},"modified":"2025-05-29T15:07:21","modified_gmt":"2025-05-29T15:07:21","slug":"from-knowledge-to-tales-code-brokers-for-kpi-narratives","status":"publish","type":"post","link":"https:\/\/techtrendfeed.com\/?p=2974","title":{"rendered":"From Knowledge to Tales: Code Brokers for KPI Narratives"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div>\n<p class=\"wp-block-paragraph\">, we frequently want to research what\u2019s happening with KPIs: whether or not we\u2019re reacting to anomalies on our dashboards or simply routinely doing a numbers replace. Primarily based on my years of expertise as a KPI analyst, I might estimate that greater than 80% of those duties are pretty commonplace and could be solved simply by following a easy guidelines.\u00a0<\/p>\n<p class=\"wp-block-paragraph\">Right here\u2019s a high-level plan for investigating a KPI change (<em>you will discover extra particulars within the article <\/em><a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/towardsdatascience.com\/anomaly-root-cause-analysis-101-98f63dd12016\/\" rel=\"noreferrer noopener\" target=\"_blank\"><em>\u201cAnomaly Root Trigger Evaluation 101\u201d<\/em><\/a>):<\/p>\n<ul class=\"wp-block-list\">\n<li class=\"wp-block-list-item\"><strong>Estimate the top-line change within the metric<\/strong> to know the magnitude of the shift.\u00a0<\/li>\n<li class=\"wp-block-list-item\"><strong>Examine knowledge high quality<\/strong> to make sure that the numbers are correct and dependable.<\/li>\n<li class=\"wp-block-list-item\"><strong>Collect context<\/strong> about inside and exterior occasions which may have influenced the change.<\/li>\n<li class=\"wp-block-list-item\"><strong>Slice and cube the metric<\/strong> to establish which segments are contributing to the metric\u2019s shift.<\/li>\n<li class=\"wp-block-list-item\"><strong>Consolidate your findings in an government abstract<\/strong> that features hypotheses and estimates of their impacts on the primary KPI.<\/li>\n<\/ul>\n<p class=\"wp-block-paragraph\">Since we&#8217;ve got a transparent plan to execute, such duties can probably be automated utilizing AI brokers. The code brokers we lately <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/towardsdatascience.com\/code-agents-the-future-of-agentic-ai\/\">mentioned<\/a> could possibly be a superb match there, as their capacity to jot down and execute code will assist them to analyse knowledge effectively, with minimal back-and-forth. So, let\u2019s attempt constructing such an agent utilizing the HuggingFace smolagents framework.\u00a0<\/p>\n<p class=\"wp-block-paragraph\">Whereas engaged on our job, we are going to focus on extra superior options of the smolagents framework:<\/p>\n<ul class=\"wp-block-list\">\n<li class=\"wp-block-list-item\">Strategies for tweaking all types of prompts to make sure the specified behaviour.<\/li>\n<li class=\"wp-block-list-item\">Constructing a multi-agent system that may clarify the <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/towardsdatascience.com\/tag\/kpi\/\" title=\"Kpi\">Kpi<\/a> modifications and hyperlink them to root causes.\u00a0<\/li>\n<li class=\"wp-block-list-item\">Including reflection to the movement with supplementary planning steps.<\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\">MVP for explaining KPI\u00a0modifications<\/h2>\n<p class=\"wp-block-paragraph\">As typical, we are going to take an iterative strategy and begin with a easy MVP, specializing in the slicing and dicing step of the evaluation. We are going to analyse the modifications of a easy metric (income) break up by one dimension (nation). We are going to use the dataset from my earlier article, <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/towardsdatascience.com\/making-sense-of-kpi-changes\/\" rel=\"noreferrer noopener\" target=\"_blank\">\u201cMaking sense of KPI modifications\u201d<\/a>.<\/p>\n<p class=\"wp-block-paragraph\">Let\u2019s load the info first.\u00a0<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">raw_df = pd.read_csv('absolute_metrics_example.csv', sep = 't')\ndf = raw_df.groupby('nation')[['revenue_before', 'revenue_after_scenario_2']].sum()\n  .sort_values('revenue_before', ascending = False).rename(\n    columns = {'revenue_after_scenario_2': 'after', \n      'revenue_before': 'earlier than'})<\/code><\/pre>\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/contributor.insightmediagroup.io\/wp-content\/uploads\/2025\/05\/1LUjgjB_A66gFtaGYGYl-uQ-1.png\" alt=\"\" class=\"wp-image-605002\"\/><figcaption class=\"wp-element-caption\">Picture by creator<\/figcaption><\/figure>\n<p class=\"wp-block-paragraph\">Subsequent, let\u2019s initialise the mannequin. I\u2019ve chosen the OpenAI GPT-4o-mini as my most well-liked possibility for easy duties. Nevertheless, the smolagents framework <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/huggingface.co\/docs\/smolagents\/guided_tour\" target=\"_blank\" rel=\"noreferrer noopener\">helps<\/a> all types of fashions, so you should utilize the mannequin you like. Then, we simply must create an agent and provides it the duty and the dataset.<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">from smolagents import CodeAgent, LiteLLMModel\n\nmannequin = LiteLLMModel(model_id=\"openai\/gpt-4o-mini\", \n  api_key=config['OPENAI_API_KEY']) \n\nagent = CodeAgent(\n    mannequin=mannequin, instruments=[], max_steps=10,\n    additional_authorized_imports=[\"pandas\", \"numpy\", \"matplotlib.*\", \n      \"plotly.*\"], verbosity_level=1 \n)\n\njob = \"\"\"\nHere's a dataframe displaying income by section, evaluating values \nearlier than and after.\nMay you please assist me perceive the modifications? Particularly:\n1. Estimate how the overall income and the income for every section \nhave modified, each in absolute phrases and as a share.\n2. Calculate the contribution of every section to the overall \nchange in income.\n\nPlease spherical all floating-point numbers within the output \nto 2 decimal locations.\n\"\"\"\n\nagent.run(\n    job,\n    additional_args={\"knowledge\": df},\n)<\/code><\/pre>\n<p class=\"wp-block-paragraph\">The agent returned fairly a believable outcome. We acquired detailed statistics on the metric modifications in every section and their influence on the top-line KPI.<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-json\">{'total_before': 1731985.21, 'total_after': \n1599065.55, 'total_change': -132919.66, 'segment_changes': \n{'absolute_change': {'different': 4233.09, 'UK': -4376.25, 'France': \n-132847.57, 'Germany': -690.99, 'Italy': 979.15, 'Spain': \n-217.09}, 'percentage_change': {'different': 0.67, 'UK': -0.91, \n'France': -55.19, 'Germany': -0.43, 'Italy': 0.81, 'Spain': \n-0.23}, 'contribution_to_change': {'different': -3.18, 'UK': 3.29, \n'France': 99.95, 'Germany': 0.52, 'Italy': -0.74, 'Spain': 0.16}}}<\/code><\/pre>\n<p class=\"wp-block-paragraph\">Let\u2019s check out the code generated by the agent. It&#8217;s high-quality, however there\u2019s one potential situation. The <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/towardsdatascience.com\/tag\/llm\/\" title=\"Llm\">Llm<\/a> recreated the dataframe based mostly on the enter knowledge as a substitute of referencing it instantly. This strategy shouldn&#8217;t be ideally suited (particularly when working with large datasets), as it will probably result in errors and better token utilization.<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">import pandas as pd                                                                                                        \n \n# Creating the DataFrame from the offered knowledge                 \nknowledge = {                                                        \n    'earlier than': [632767.39, 481409.27, 240704.63, 160469.75,      \n120352.31, 96281.86],                                           \n    'after': [637000.48, 477033.02, 107857.06, 159778.76,       \n121331.46, 96064.77]                                            \n}                                                               \nindex = ['other', 'UK', 'France', 'Germany', 'Italy', 'Spain']  \ndf = pd.DataFrame(knowledge, index=index)                            \n                                                                \n# Calculating complete income earlier than and after                    \ntotal_before = df['before'].sum()                               \ntotal_after = df['after'].sum()                                 \n                                                                \n# Calculating absolute and share change for every section   \ndf['absolute_change'] = df['after'] - df['before']              \ndf['percentage_change'] = (df['absolute_change'] \/              \ndf['before']) * 100                                             \n                                                                \n# Calculating complete income change                              \ntotal_change = total_after - total_before                       \n                                                                \n# Calculating contribution of every section to the overall change  \ndf['contribution_to_change'] = (df['absolute_change'] \/         \ntotal_change) * 100                                             \n                                                                \n# Rounding outcomes                                              \ndf = df.spherical(2)                                                \n                                                                \n# Printing the calculated outcomes                               \nprint(\"Complete income earlier than:\", total_before)                    \nprint(\"Complete income after:\", total_after)                      \nprint(\"Complete change in income:\", total_change)                 \nprint(df)<\/code><\/pre>\n<p class=\"wp-block-paragraph\">It\u2019s price fixing this downside earlier than shifting on to constructing a extra advanced system.<\/p>\n<h2 class=\"wp-block-heading\">Tweaking prompts<\/h2>\n<p class=\"wp-block-paragraph\">Because the LLM is simply following the directions given to it, we are going to handle this situation by tweaking the immediate.<\/p>\n<p class=\"wp-block-paragraph\">Initially, I tried to make the duty immediate extra express, clearly instructing the LLM to make use of the offered variable.<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">job = \"\"\"Here's a dataframe displaying income by section, evaluating \nvalues earlier than and after. The information is saved in df variable. \nPlease, use it and do not attempt to parse the info your self. \n\nMay you please assist me perceive the modifications?\nParticularly:\n1. Estimate how the overall income and the income for every section \nhave modified, each in absolute phrases and as a share.\n2. Calculate the contribution of every section to the overall change in income.\n\nPlease spherical all floating-point numbers within the output to 2 decimal locations.\n\"\"\"<\/code><\/pre>\n<p class=\"wp-block-paragraph\">It didn\u2019t work. So, the subsequent step is to look at the system immediate and see why it really works this manner.\u00a0<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">print(agent.prompt_templates['system_prompt'])\n\n#... \n# Listed here are the principles it is best to at all times observe to unravel your job:\n# 1. All the time present a 'Thought:' sequence, and a 'Code:n```py' sequence ending with '```<end_code>' sequence, else you'll fail.\n# 2. Use solely variables that you've got outlined.\n# 3. All the time use the suitable arguments for the instruments. DO NOT cross the arguments as a dict as in 'reply = wiki({'question': \"What's the place the place James Bond lives?\"})', however use the arguments instantly as in 'reply = wiki(question=\"What's the place the place James Bond lives?\")'.\n# 4. Take care to not chain too many sequential instrument calls in the identical code block, particularly when the output format is unpredictable. As an illustration, a name to look has an unpredictable return format, so do not need one other instrument name that depends upon its output in the identical block: relatively output outcomes with print() to make use of them within the subsequent block.\n# 5. Name a instrument solely when wanted, and by no means re-do a instrument name that you simply beforehand did with the very same parameters.\n# 6. Do not identify any new variable with the identical identify as a instrument: for example do not identify a variable 'final_answer'.\n# 7. By no means create any notional variables in our code, as having these in your logs will derail you from the true variables.\n# 8. You need to use imports in your code, however solely from the next checklist of modules: ['collections', 'datetime', 'itertools', 'math', 'numpy', 'pandas', 'queue', 'random', 're', 'stat', 'statistics', 'time', 'unicodedata']\n# 9. The state persists between code executions: so if in a single step you've got created variables or imported modules, these will all persist.\n# 10. Do not hand over! You are accountable for fixing the duty, not offering instructions to unravel it.\n# Now Start!<\/end_code><\/code><\/pre>\n<p class=\"wp-block-paragraph\">On the finish of the immediate, we&#8217;ve got the instruction <code>\"# 2. Use solely variables that you've got outlined!\"<\/code>. This may be interpreted as a strict rule to not use some other variables. So, I modified it to <code>\"# 2. Use solely variables that you've got outlined or ones offered in further arguments! By no means attempt to copy and parse further arguments.\"<\/code>\u00a0<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">modified_system_prompt = agent.prompt_templates['system_prompt']\n    .exchange(\n        '2. Use solely variables that you've got outlined!', \n        '2. Use solely variables that you've got outlined or ones offered in further arguments! By no means attempt to copy and parse further arguments.'\n    )\nagent.prompt_templates['system_prompt'] = modified_system_prompt<\/code><\/pre>\n<p class=\"wp-block-paragraph\">This modification alone didn\u2019t assist both. Then, I examined the duty message.\u00a0<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-\">\u256d\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 New run \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502                                                                \u2502\n\u2502 Here's a pandas dataframe displaying income by section,         \u2502\n\u2502 evaluating values earlier than and after.                             \u2502\n\u2502 May you please assist me perceive the modifications?               \u2502\n\u2502 Particularly:                                                  \u2502\n\u2502 1. Estimate how the overall income and the income for every     \u2502\n\u2502 section have modified, each in absolute phrases and as a          \u2502\n\u2502 share.                                                    \u2502\n\u2502 2. Calculate the contribution of every section to the overall     \u2502\n\u2502 change in income.                                             \u2502\n\u2502                                                                \u2502\n\u2502 Please spherical all floating-point numbers within the output to 2   \u2502\n\u2502 decimal locations.                                                \u2502\n\u2502                                                                \u2502\n\u2502 You've been supplied with these further arguments, that   \u2502\n\u2502 you'll be able to entry utilizing the keys as variables in your python      \u2502\n\u2502 code:                                                          \u2502\n\u2502 {'df':             earlier than      after                           \u2502\n\u2502 nation                                                        \u2502\n\u2502 different    632767.39  637000.48                                  \u2502\n\u2502 UK       481409.27  477033.02                                  \u2502\n\u2502 France   240704.63  107857.06                                  \u2502\n\u2502 Germany  160469.75  159778.76                                  \u2502\n\u2502 Italy    120352.31  121331.46                                  \u2502\n\u2502 Spain     96281.86   96064.77}.                                \u2502\n\u2502                                                                \u2502\n\u2570\u2500 LiteLLMModel - openai\/gpt-4o-mini \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f<\/code><\/pre>\n<p class=\"wp-block-paragraph\">It has an instruction associated the the utilization of further arguments <code>\"You've been supplied with these further arguments, which you can entry utilizing the keys as variables in your python code\"<\/code>. We are able to attempt to make it extra particular and clear. Sadly, this parameter shouldn&#8217;t be uncovered externally, so I needed to find it in <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/github.com\/huggingface\/smolagents\/blob\/24df5adec79ab2e7d19db298a6f794825ae2e701\/src\/smolagents\/agents.py#L326\" target=\"_blank\" rel=\"noreferrer noopener\">the supply code<\/a>. To search out the trail of a Python bundle, we are able to use the next code.<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">import smolagents \nprint(smolagents.__path__)<\/code><\/pre>\n<p class=\"wp-block-paragraph\">Then, I discovered the <code>brokers.py<\/code> file and modified this line to incorporate a extra particular instruction.<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">self.job += f\"\"\"\nYou've been supplied with these further arguments out there as variables \nwith names {\",\".be a part of(additional_args.keys())}. You possibly can entry them instantly. \nHere's what they include (only for informational functions): \n{str(additional_args)}.\"\"\"<\/code><\/pre>\n<p class=\"wp-block-paragraph\">It was a little bit of hacking, however that&#8217;s generally what occurs with the LLM frameworks. Don\u2019t neglect to reload the bundle afterwards, and we\u2019re good to go. Let\u2019s take a look at whether or not it really works now. <\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">job = \"\"\"\nHere's a pandas dataframe displaying income by section, evaluating values \nearlier than and after. \n\nYour job might be perceive the modifications to the income (after vs earlier than) \nin numerous segments and supply government abstract.\nPlease, observe the next steps:\n1. Estimate how the overall income and the income for every section \nhave modified, each in absolute phrases and as a share.\n2. Calculate the contribution of every section to the overall change \nin income.\n\nSpherical all floating-point numbers within the output to 2 decimal locations. \n\"\"\"\nagent.logger.stage = 1 # Decrease verbosity stage\nagent.run(\n    job,\n    additional_args={\"df\": df},\n)<\/code><\/pre>\n<p class=\"wp-block-paragraph\">Hooray! The issue has been fastened. The agent now not copies the enter variables and references <code>df<\/code> variable instantly as a substitute. Right here\u2019s the newly generated code.<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">import pandas as pd                                             \n                                                                  \n# Calculate complete income earlier than and after                      \ntotal_before = df['before'].sum()                               \ntotal_after = df['after'].sum()                                 \ntotal_change = total_after - total_before                       \npercentage_change_total = (total_change \/ total_before * 100)   \nif total_before != 0 else 0                                     \n                                                                \n# Spherical values                                                  \ntotal_before = spherical(total_before, 2)                           \ntotal_after = spherical(total_after, 2)                             \ntotal_change = spherical(total_change, 2)                           \npercentage_change_total = spherical(percentage_change_total, 2)     \n                                                                \n# Show outcomes                                               \nprint(f\"Complete Income Earlier than: {total_before}\")                  \nprint(f\"Complete Income After: {total_after}\")                    \nprint(f\"Complete Change: {total_change}\")                          \nprint(f\"Proportion Change: {percentage_change_total}%\")<\/code><\/pre>\n<p class=\"wp-block-paragraph\">Now, we\u2019re prepared to maneuver on to constructing the precise agent that can clear up our job.<\/p>\n<h2 class=\"wp-block-heading\">AI agent for KPI narratives<\/h2>\n<p class=\"wp-block-paragraph\">Lastly, it\u2019s time to work on the AI agent that can assist us clarify KPI modifications and create an government abstract.<\/p>\n<p class=\"wp-block-paragraph\">Our agent will observe this plan for the basis trigger evaluation:<\/p>\n<ul class=\"wp-block-list\">\n<li class=\"wp-block-list-item\">Estimate the top-line KPI change.\u00a0<\/li>\n<li class=\"wp-block-list-item\">Slice and cube the metric to know which segments are driving the shift.\u00a0<\/li>\n<li class=\"wp-block-list-item\">Lookup occasions within the change log to see whether or not they can clarify the metric modifications.<\/li>\n<li class=\"wp-block-list-item\">Consolidate all of the findings within the complete government abstract.<\/li>\n<\/ul>\n<p class=\"wp-block-paragraph\">After loads of experimentation and a number of other tweaks, I\u2019ve arrived at a promising outcome. Listed here are the important thing changes I made (we are going to focus on them intimately later):<\/p>\n<ul class=\"wp-block-list\">\n<li class=\"wp-block-list-item\">I leveraged <strong>the multi-agent setup<\/strong> by including one other staff member\u200a\u2014\u200athe change log Agent, who can entry the change log and help in explaining KPI modifications.<\/li>\n<li class=\"wp-block-list-item\">I experimented with <strong>extra highly effective fashions <\/strong>like <code>gpt-4o<\/code> and <code>gpt-4.1-mini<\/code> since <code>gpt-4o-mini<\/code> wasn\u2019t enough. Utilizing stronger fashions not solely improved the outcomes, but in addition considerably lowered the variety of steps: with <code>gpt-4.1-mini<\/code>I acquired the ultimate outcome after simply six steps, in comparison with 14\u201316 steps with <code>gpt-4o-mini<\/code>. This means that investing in dearer fashions may be worthwhile for agentic workflows.<\/li>\n<li class=\"wp-block-list-item\">I offered the agent with <strong>the advanced instrument <\/strong>to analyse KPI modifications for easy metrics. The instrument performs all of the calculations, whereas LLM can simply interpret the outcomes. I mentioned the strategy to KPI modifications evaluation intimately in <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/towardsdatascience.com\/making-sense-of-kpi-changes\/\" target=\"_blank\" rel=\"noreferrer noopener\">my earlier article<\/a>.\u00a0<\/li>\n<li class=\"wp-block-list-item\">I reformulated the immediate into a really <strong>clear step-by-step information<\/strong> to assist the agent keep on monitor.\u00a0<\/li>\n<li class=\"wp-block-list-item\">I added <strong>planning steps<\/strong> that encourage the LLM agent to suppose by its strategy first and revisit the plan each three iterations.\u00a0<\/li>\n<\/ul>\n<p class=\"wp-block-paragraph\">After all of the changes, I acquired the next abstract from the agent, which is fairly good.<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-\">Govt Abstract:\nBetween April 2025 and Could 2025, complete income declined sharply by\nroughly 36.03%, falling from 1,731,985.21 to 1,107,924.43, a\ndrop of -624,060.78 in absolute phrases.\nThis decline was primarily pushed by vital income \nreductions within the 'new' buyer segments throughout a number of \nnations, with declines of roughly 70% in these segments.\n\nEssentially the most impacted segments embody:\n- other_new: earlier than=233,958.42, after=72,666.89, \nabs_change=-161,291.53, rel_change=-68.94%, share_before=13.51%, \ninfluence=25.85, impact_norm=1.91\n- UK_new: earlier than=128,324.22, after=34,838.87, \nabs_change=-93,485.35, rel_change=-72.85%, share_before=7.41%, \ninfluence=14.98, impact_norm=2.02\n- France_new: earlier than=57,901.91, after=17,443.06, \nabs_change=-40,458.85, rel_change=-69.87%, share_before=3.34%, \ninfluence=6.48, impact_norm=1.94\n- Germany_new: earlier than=48,105.83, after=13,678.94, \nabs_change=-34,426.89, rel_change=-71.56%, share_before=2.78%, \ninfluence=5.52, impact_norm=1.99\n- Italy_new: earlier than=36,941.57, after=11,615.29, \nabs_change=-25,326.28, rel_change=-68.56%, share_before=2.13%, \ninfluence=4.06, impact_norm=1.91\n- Spain_new: earlier than=32,394.10, after=7,758.90, \nabs_change=-24,635.20, rel_change=-76.05%, share_before=1.87%, \ninfluence=3.95, impact_norm=2.11\n\nPrimarily based on evaluation from the change log, the primary causes for this \ndevelopment are:\n1. The introduction of recent onboarding controls applied on Could \n8, 2025, which lowered new buyer acquisition by about 70% to \nforestall fraud.\n2. A postal service strike within the UK beginning April 5, 2025, \ninflicting order supply delays and elevated cancellations \nimpacting the UK new section.\n3. A rise in VAT by 2% in Spain as of April 22, 2025, \naffecting new buyer pricing and inflicting greater cart \nabandonment.\n\nThese elements mixed clarify the outsized damaging impacts \nnoticed in new buyer segments and the general income decline.<\/code><\/pre>\n<p class=\"wp-block-paragraph\">The LLM agent additionally generated a bunch of illustrative charts (they have been a part of our development explaining instrument). For instance, this one reveals the impacts throughout the mixture of nation and maturity.<\/p>\n<figure class=\"wp-block-image alignwide\"><img decoding=\"async\" src=\"https:\/\/contributor.insightmediagroup.io\/wp-content\/uploads\/2025\/05\/1D1ZraDpBPaZ7GQCJAvd0qw.png\" alt=\"\" class=\"wp-image-605003\"\/><figcaption class=\"wp-element-caption\">Picture by creator<\/figcaption><\/figure>\n<p class=\"wp-block-paragraph\">The outcomes look actually thrilling. Now let\u2019s dive deeper into the precise implementation to know the way it works underneath the hood.\u00a0<\/p>\n<h3 class=\"wp-block-heading\">Multi-AI agent\u00a0setup<\/h3>\n<p class=\"wp-block-paragraph\">We are going to begin with our change log agent. This agent will question the change log and attempt to establish potential root causes for the metric modifications we observe. Since this agent doesn\u2019t must do advanced operations, we implement it as a ToolCallingAgent. As a result of this agent might be known as by one other agent, we have to outline its <code>identify<\/code> and <code>description<\/code> attributes.<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">@instrument \ndef get_change_log(month: str) -&gt; str: \n    \"\"\"\n    Returns the change log (checklist of inside and exterior occasions which may have affected our KPIs) for the given month \n\n    Args:\n        month: month within the format %Y-%m-01, for instance, 2025-04-01\n    \"\"\"\n    return events_df[events_df.month == month].drop('month', axis = 1).to_dict('data')\n\nmannequin = LiteLLMModel(model_id=\"openai\/gpt-4.1-mini\", api_key=config['OPENAI_API_KEY'])\nchange_log_agent = ToolCallingAgent(\n    instruments=[get_change_log],\n    mannequin=mannequin,\n    max_steps=10,\n    identify=\"change_log_agent\",\n    description=\"Helps you discover the related info within the change log that may clarify modifications on metrics. Present the agent with all of the context to obtain data\",\n)<\/code><\/pre>\n<p class=\"wp-block-paragraph\">Because the supervisor agent might be calling this agent, we gained\u2019t have any management over the question it receives. Due to this fact, I made a decision to change the system immediate to incorporate further context.<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">change_log_system_prompt = '''\nYou are a grasp of the change log and also you assist others to elucidate \nthe modifications to metrics. If you obtain a request, search for the checklist of occasions \noccurred by month, then filter the related info based mostly \non offered context and return again. Prioritise probably the most possible elements \naffecting the KPI and restrict your reply solely to them.\n'''\n\nmodified_system_prompt = change_log_agent.prompt_templates['system_prompt'] \n  + 'nnn' + change_log_system_prompt\n\nchange_log_agent.prompt_templates['system_prompt'] = modified_system_prompt<\/code><\/pre>\n<p class=\"wp-block-paragraph\">To allow the first agent to delegate duties to the change log agent, we merely must specify it within the <code>managed_agents<\/code> area.<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">agent = CodeAgent(\n    mannequin=mannequin,\n    instruments=[calculate_simple_growth_metrics],\n    max_steps=20,\n    additional_authorized_imports=[\"pandas\", \"numpy\", \"matplotlib.*\", \"plotly.*\"],\n    verbosity_level = 2, \n    planning_interval = 3,\n    managed_agents = [change_log_agent]\n)<\/code><\/pre>\n<p class=\"wp-block-paragraph\">Let\u2019s see the way it works. First, we are able to have a look at the brand new system immediate for the first agent. It now contains details about staff members and directions on easy methods to ask them for assist.<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-\">You can even give duties to staff members.\nCalling a staff member works the identical as for calling a instrument: merely, \nthe one argument you can provide within the name is 'job'.\nProvided that this staff member is an actual human, try to be very verbose \nin your job, it must be an extended string offering informations \nas detailed as crucial.\nHere's a checklist of the staff members which you can name:\n```python\ndef change_log_agent(\"Your question goes right here.\") -&gt; str:\n    \"\"\"Helps you discover the related info within the change log that \n    can clarify modifications on metrics. Present the agent with all of the context \n    to obtain data\"\"\"\n```<\/code><\/pre>\n<p class=\"wp-block-paragraph\">The execution log reveals that the first agent efficiently delegated the duty to the second agent and obtained the next response.<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-\">&lt;-- Main agent calling the change log agent --&gt;\n\n\u2500 Executing parsed code: \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \n  # Question change_log_agent with the detailed job description     \n  ready                                                        \n  context_for_change_log = (                                      \n      \"We analyzed modifications in income from April 2025 to Could      \n  2025. We discovered massive decreases \"                                \n      \"primarily within the 'new' maturity segments throughout nations:    \n  Spain_new, UK_new, Germany_new, France_new, Italy_new, and      \n  other_new. \"                                                    \n      \"The income fell by round 70% in these segments, which    \n  have outsized damaging influence on complete income change. \"        \n      \"We need to know the 1-3 most possible causes for this      \n  vital drop in income within the 'new' buyer segments      \n  throughout this era.\"                                            \n  )                                                               \n                                                                  \n  rationalization = change_log_agent(job=context_for_change_log)     \n  print(\"Change log agent rationalization:\")                          \n  print(rationalization)                                              \n \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \n\n&lt;-- Change log agent execution begin --&gt;\n\u256d\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 New run - change_log_agent \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502                                                                     \u2502\n\u2502 You are a useful agent named 'change_log_agent'.                    \u2502\n\u2502 You've been submitted this job by your supervisor.                  \u2502\n\u2502 ---                                                                 \u2502\n\u2502 Job:                                                               \u2502\n\u2502 We analyzed modifications in income from April 2025 to Could 2025.         \u2502\n\u2502 We discovered massive decreases primarily within the 'new' maturity segments      \u2502\n\u2502 throughout nations: Spain_new, UK_new, Germany_new, France_new,       \u2502\n\u2502 Italy_new, and other_new. The income fell by round 70% in these   \u2502\n\u2502 segments, which have outsized damaging influence on complete income      \u2502\n\u2502 change. We need to know the 1-3 most possible causes for this       \u2502\n\u2502 vital drop in income within the 'new' buyer segments throughout   \u2502\n\u2502 this era.                                                        \u2502\n\u2502 ---                                                                 \u2502\n\u2502 You are serving to your supervisor clear up a wider job: so be sure to     \u2502\n\u2502 not present a one-line reply, however give as a lot info as      \u2502\n\u2502 potential to offer them a transparent understanding of the reply.          \u2502\n\u2502                                                                     \u2502\n\u2502 Your final_answer WILL HAVE to include these elements:                 \u2502\n\u2502 ### 1. Job final result (quick model):                                \u2502\n\u2502 ### 2. Job final result (extraordinarily detailed model):                   \u2502\n\u2502 ### 3. Extra context (if related):                            \u2502\n\u2502                                                                     \u2502\n\u2502 Put all these in your final_answer instrument, all the pieces that you simply do     \u2502\n\u2502 not cross as an argument to final_answer might be misplaced.               \u2502\n\u2502 And even when your job decision shouldn't be profitable, please return   \u2502\n\u2502 as a lot context as potential, in order that your supervisor can act upon      \u2502\n\u2502 this suggestions.                                                      \u2502\n\u2502                                                                     \u2502\n\u2570\u2500 LiteLLMModel - openai\/gpt-4.1-mini \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f<\/code><\/pre>\n<p class=\"wp-block-paragraph\">Utilizing the smolagents framework, we are able to simply arrange a easy multi-agent system, the place a supervisor agent coordinates and delegates duties to staff members with particular abilities.\u00a0<\/p>\n<h3 class=\"wp-block-heading\">Iterating on the\u00a0immediate<\/h3>\n<p class=\"wp-block-paragraph\">We\u2019ve began with a really high-level immediate outlining the aim and a imprecise route, however sadly, it didn\u2019t work constantly. LLMs usually are not good sufficient but to determine the strategy on their very own. So, I created an in depth step-by-step immediate describing the entire plan and together with the detailed specs of the expansion narrative instrument we\u2019re utilizing.\u00a0<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">job = \"\"\"\nHere's a pandas dataframe displaying the income by section, evaluating values \nearlier than (April 2025) and after (Could 2025). \n\nYou are a senior and skilled knowledge analyst. Your job might be to know \nthe modifications to the income (after vs earlier than) in numerous segments \nand supply government abstract.\n\n## Comply with the plan:\n1. Begin by udentifying the checklist of dimensions (columns in dataframe that \nusually are not \"earlier than\" and \"after\")\n2. There may be a number of dimensions within the dataframe. Begin high-level \nby taking a look at every dimension in isolation, mix all outcomes \ncollectively into the checklist of segments analysed (remember to avoid wasting \nthe dimension used for every section). \nUse the offered instruments to analyse the modifications of metrics: {tools_description}. \n3. Analyse the outcomes from earlier step and hold solely segments \nwhich have outsized influence on the KPI change (absolute of impact_norm \nis above 1.25). \n4. Examine what dimensions are current within the checklist of great section, \nif there are a number of ones - execute the instrument on their combos \nand add to the analysed segments. If after including an extra dimension, \nall subsegments present shut different_rate and impact_norm values, \nthen we are able to exclude this break up (regardless that impact_norm is above 1.25), \nbecause it would not clarify something. \n5. Summarise the numerous modifications you recognized. \n6. Attempt to clarify what's going on with metrics by getting data \nfrom the change_log_agent. Please, present the agent the total context \n(what segments have outsized influence, what's the relative change and \nwhat's the interval we're taking a look at). \nSummarise the data from the changelog and point out \nsolely 1-3 probably the most possible causes of the KPI change \n(ranging from probably the most impactful one).\n7. Put collectively 3-5 sentences commentary what occurred high-level \nand why (based mostly on the data obtained from the change log). \nThen observe it up with extra detailed abstract: \n- Prime-line complete worth of metric earlier than and after in human-readable format, \nabsolute and relative change \n- Listing of segments that meaningfully influenced the metric positively \nor negatively with the next numbers: values earlier than and after, \nabsoltue and relative change, share of section earlier than, influence \nand normed influence. Order the segments by absolute worth \nof absolute change because it represents the ability of influence. \n\n## Instruction on the calculate_simple_growth_metrics instrument:\nBy default, it is best to use the instrument for the entire dataset not the section, \nbecause it provides you with the total details about the modifications.\n\nRight here is the steering easy methods to interpret the output of the instrument\n- distinction - absolutely the distinction between after and earlier than values\n- difference_rate - the relative distinction (if it is shut for \n  all segments then the dimension shouldn't be informative)\n- influence - the share of KPI differnce defined by this section \n- segment_share_before - share of section earlier than\n- impact_norm - influence normed on the share of segments, we're  \n  in very excessive or very low numbers since they present outsized influence, \n  rule of thumb - impact_norm between -1.25 and 1.25 is not-informative \n\nShould you're utilizing the instrument on the subset of dataframe bear in mind, \nthat the outcomes will not be aplicable to the total dataset, so keep away from utilizing it \nuntil you need to explicitly have a look at subset (i.e. change in France). \nShould you determined to make use of the instrument on a specific section \nand share these ends in the manager abstract, explicitly define \nthat we're diving deeper into a specific section.\n\"\"\".format(tools_description = tools_description)\nagent.run(\n    job,\n    additional_args={\"df\": df},\n)<\/code><\/pre>\n<p class=\"wp-block-paragraph\">Explaining all the pieces in such element was fairly a frightening job, nevertheless it\u2019s crucial if we would like constant outcomes.<\/p>\n<h4 class=\"wp-block-heading\">Planning steps<\/h4>\n<p class=\"wp-block-paragraph\">The smolagents framework allows you to add planning steps to your agentic movement. This encourages the agent to start out with a plan and replace it after the desired variety of steps. From my expertise, this reflection may be very useful for sustaining concentrate on the issue and adjusting actions to remain aligned with the preliminary plan and aim. I positively suggest utilizing it in circumstances when advanced reasoning is required.<\/p>\n<p class=\"wp-block-paragraph\">Setting it up is as simple as specifying <code>planning_interval = 3<\/code> for the code agent.<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">agent = CodeAgent(\n    mannequin=mannequin,\n    instruments=[calculate_simple_growth_metrics],\n    max_steps=20,\n    additional_authorized_imports=[\"pandas\", \"numpy\", \"matplotlib.*\", \"plotly.*\"],\n    verbosity_level = 2, \n    planning_interval = 3,\n    managed_agents = [change_log_agent]\n)<\/code><\/pre>\n<p class=\"wp-block-paragraph\">That\u2019s it. Then, the agent offers reflections beginning with desirous about the preliminary plan.<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-\">\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 Preliminary plan \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nListed here are the info I do know and the plan of motion that I'll \nobserve to unravel the duty:\n```\n## 1. Info survey\n\n### 1.1. Info given within the job\n- We have now a pandas dataframe `df` displaying income by section, for \ntwo time factors: earlier than (April 2025) and after (Could 2025).\n- The dataframe columns embody:\n  - Dimensions: `nation`, `maturity`, `country_maturity`, \n`country_maturity_combined`\n  - Metrics: `earlier than` (income in April 2025), `after` (income in\nCould 2025)\n- The duty is to know the modifications in income (after vs \nearlier than) throughout completely different segments.\n- Key directions and instruments offered:\n  - Establish all dimensions besides earlier than\/after for segmentation.\n  - Analyze every dimension independently utilizing \n`calculate_simple_growth_metrics`.\n  - Filter segments with outsized influence on KPI change (absolute \nnormed influence &gt; 1.25).\n  - Study combos of dimensions if a number of dimensions have\nvital segments.\n  - Summarize vital modifications and interact `change_log_agent` \nfor contextual causes.\n  - Present a closing government abstract together with top-line modifications \nand segment-level detailed impacts.\n- Dataset snippet reveals segments combining nations (`France`, \n`UK`, `Germany`, `Italy`, `Spain`, `different`) and maturity standing \n(`new`, `current`).\n- The mixed segments are uniquely recognized in columns \n`country_maturity` and `country_maturity_combined`.\n\n### 1.2. Info to search for\n- Definitions or descriptions of the segments if unclear (e.g., \nwhat defines `new` vs `current` maturity).\n  - Possible not necessary to proceed, however could possibly be requested from \nenterprise documentation or change log.\n- Extra particulars on the change log (accessible by way of \n`change_log_agent`) that might present possible causes for income\nmodifications.\n- Affirmation on dealing with mixed dimension splits - how precisely\n`country_maturity_combined` is shaped and must be interpreted in\nmixed dimension evaluation.\n- Knowledge dictionary or description of metrics if any further KPI \nmoreover income is related (unlikely given knowledge).\n- Dates verify interval of research: April 2025 (earlier than) and Could \n2025 (after). No must look these up since given.\n\n### 1.3. Info to derive\n- Establish all dimension columns out there for segmentation:\n  - By excluding 'earlier than' and 'after', seemingly candidates are \n`nation`, `maturity`, `country_maturity`, and \n`country_maturity_combined`.\n- For every dimension, calculate change metrics utilizing the given \ninstrument:\n  - Absolute and relative distinction in income per section.\n  - Affect, section share earlier than, and normed influence for every \nsection.\n- Establish which segments have outsized influence on KPI change \n(|impact_norm| &gt; 1.25).\n- If a number of dimensions have vital segments, mix \ndimensions (e.g., nation + maturity) and reanalyze.\n- Decide if mixed dimension splits present significant \ndifferentiation or not, based mostly on delta price and impact_norm \nconsistency.\n- Summarize route and magnitude of KPI modifications at top-line \nstage (combination income earlier than and after).\n- Establish prime segments driving constructive and damaging modifications \nbased mostly on ordered absolute absolute_change.\n- Collect contextual insights from the change log agent concerning \npossible causes tied to vital segments and the Could 2025 vs \nApril 2025 interval.\n\n## 2. Plan\n\n1. Establish all dimension columns current within the dataframe by \nitemizing columns and excluding 'earlier than' and 'after'.\n2. For every dimension recognized (`nation`, `maturity`, \n`country_maturity`, `country_maturity_combined`):\n   - Use `calculate_simple_growth_metrics` on the total dataframe \ngrouped by that dimension.\n   - Extract segments with calculated metrics together with \nimpact_norm.\n3. Mixture outcomes from all single-dimension analyses and filter\nsegments the place |impact_norm| &gt; 1.25.\n4. Decide which dimensions these vital segments belong \nto.\n5. If a couple of dimension is represented in these vital \nsegments, analyze the mixed dimension shaped by these \ndimensions (for instance, mixture of `nation` and `maturity` \nor use current mixed dimension columns).\n6. Repeat metric calculation utilizing \n`calculate_simple_growth_metrics` on the mixed dimension.\n7. Study if the mixed dimension splits create significant \ndifferentiation - if all subsegments present shut difference_rate \nand impact_norm, exclude the break up.\n8. Put together a abstract of great modifications:\n   - Prime-line KPIs earlier than and after (absolute and relative \nmodifications).\n   - Listing of impactful segments sorted by absolute absolute_change\nthat influenced general income.\n9. Present the checklist of segments with particulars (values earlier than, \nafter, absolute and relative change, share earlier than, influence, \nimpact_norm).\n10. Utilizing this summarized info, question `change_log_agent` \nwith full context:\n    - Embrace vital segments, their relative modifications, and \ndurations (April to Could 2025).\n11. Course of the agent's response to establish 1-3 foremost possible \ncauses of the KPI modifications.\n12. Draft government abstract commentary:\n    - Excessive-level overview of what occurred and why, based mostly on log \ndata.\n    - Detailed abstract together with top-line modifications and \nsegment-level metrics influence.\n13. Ship the ultimate reply utilizing `final_answer` instrument containing \nthe above government abstract and data-driven insights.<\/code><\/pre>\n<p class=\"wp-block-paragraph\">Then, after every three steps, the agent revisits and updates the plan.\u00a0<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-\">\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 Up to date plan \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nI nonetheless want to unravel the duty I used to be given:\n```\n\nHere's a pandas dataframe displaying the income by section, \nevaluating values earlier than (April 2025) and after (Could 2025). \n\nYou are a senior and skilled knowledge analyst. Your job might be \nperceive the modifications to the income (after vs earlier than) in \ncompletely different segments \nand supply government abstract.\n\n&lt;... repeating the total preliminary job ...&gt;\n```\n\nListed here are the info I do know and my new\/up to date plan of motion to \nclear up the duty:\n```\n## 1. Up to date info survey\n\n### 1.1. Info given within the job\n- We have now a pandas dataframe with income by section, displaying \nvalues \"earlier than\" (April 2025) and \"after\" (Could 2025).\n- Columns within the dataframe embody a number of dimensions and the \n\"earlier than\" and \"after\" income values.\n- The aim is to know income modifications by section and supply\nan government abstract.\n- Steerage and guidelines about easy methods to analyze and interpret outcomes \nfrom the `calculate_simple_growth_metrics` instrument are offered.\n- The dataframe accommodates columns: nation, maturity, \ncountry_maturity, country_maturity_combined, earlier than, after.\n\n### 1.2. Info that we've got discovered\n- The size to investigate are: nation, maturity, \ncountry_maturity, and country_maturity_combined.\n- Analyzed income modifications by dimension.\n- Solely the \"new\" maturity section has vital influence \n(impact_norm=1.96 &gt; 1.25), with a big damaging income change (~\n-70.6%).\n- Within the mixed section \"country_maturity,\" the \"new\" segments \nthroughout nations (Spain_new, UK_new, Germany_new, France_new, \nItaly_new, other_new) all have outsized damaging impacts with \nimpact_norm values all above 1.9.\n- The mature\/current segments in these nations have smaller \nnormed impacts beneath 1.25.\n- Nation-level and maturity-level section dimension alone are \nmuch less revealing than the mixed nation+maturity section \ndimension which highlights the brand new segments as strongly impactful.\n- Complete income dropped considerably from earlier than to after, principally\npushed by new segments shrinking drastically.\n\n### 1.3. Info nonetheless to search for\n- Whether or not splitting the info by further dimensions past \nnation and maturity (e.g., country_maturity_combined) explains \nadditional heterogeneous impacts or if the sample is uniform.\n- Clarification\/context from change log about what induced the main \ndrop predominantly in new segments in all nations.\n- Confirming whether or not any nation throughout the new section behaved \notherwise or mitigated losses.\n\n### 1.4. Info nonetheless to derive\n- A concise government abstract describing the top-level income \nchange and figuring out which segments clarify the declines.\n- Clarification involving the change log agent with abstract of \npossible causes for these outsized reductions in income within the \nnew segments throughout nations for April-Could 2025.\n\n## 2. Plan\n\n### 2.1. Confirm if including the extra dimension \n'country_maturity_combined' splits the impactful \"new\" segments \ninto subsegments with considerably completely different impacts or if the \nchange charges and normed impacts are comparatively homogeneous. If \nhomogeneous, we don't achieve deeper perception and will disregard \nadditional splitting.\n\n### 2.2. Summarize all vital segments recognized with \noutsized impact_norm \u2265 1.25, together with their earlier than and after \nvalues, absolute and relative modifications, section shares earlier than, \ninfluence, and normalized influence, ordered by absolute worth of the \nchange.\n\n### 2.3. Question the change_log_agent with the total context: \nvital segments are the brand new country_maturity segments with \nmassive damaging modifications (~ -70%), timeframe April 2025 to Could 2025,\nand request prime 1-3 most possible causes for the KPI income drop \nin these segments.\n\n### 2.4. Primarily based on the change log agent's response, synthesize a \n3-5 sentence high-level commentary explaining what occurred \nbroadly and why.\n\n### 2.5. Draft an in depth government abstract together with:\n- Complete income earlier than and after in human-readable format with \nabsolute and relative change.\n- A listing of great segments driving these modifications, so as \nby absolute influence, with detailed numbers (earlier than, after, absolute\nand relative change, section share earlier than, influence, normed influence).\n\n### 2.6. Use the `final_answer` instrument to supply the finalized \ngovernment abstract report.<\/code><\/pre>\n<p class=\"wp-block-paragraph\">I actually like how the agent is inspired to reiterate on the preliminary job and keep targeted on the primary downside. Common reflection like that is useful in actual life as properly, as groups typically get slowed down within the course of and lose sight of the why behind what they\u2019re doing. It\u2019s fairly cool to see managerial finest practices being built-in into agentic frameworks.<\/p>\n<p class=\"wp-block-paragraph\">That\u2019s it! We\u2019ve constructed a code agent able to analysing KPI modifications for easy metrics and explored all the important thing nuances of the method.<\/p>\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><em>You will discover the whole code and execution logs on <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/github.com\/miptgirl\/miptgirl_medium\/blob\/main\/growth_narrative_llm_agent\/code_agents_mvp.ipynb\" target=\"_blank\" rel=\"noreferrer noopener\">GitHub<\/a>.<\/em><\/p>\n<\/blockquote>\n<h2 class=\"wp-block-heading\">Abstract<\/h2>\n<p class=\"wp-block-paragraph\">We\u2019ve experimented rather a lot with code brokers and are actually prepared to attract conclusions. For our experiments, we used the HuggingFace smolagents framework for code brokers\u200a\u2014\u200aa really useful toolset that gives:\u00a0<\/p>\n<ul class=\"wp-block-list\">\n<li class=\"wp-block-list-item\">simple integration with completely different LLMs (from native fashions by way of Ollama to public suppliers like Anthropic or OpenAI),<\/li>\n<li class=\"wp-block-list-item\">excellent logging that makes it simple to know the entire thought means of the agent and debug points,<\/li>\n<li class=\"wp-block-list-item\">capacity to construct advanced programs leveraging multi-AI agent setups or planning options with out a lot effort.<\/li>\n<\/ul>\n<p class=\"wp-block-paragraph\">Whereas smolagents is at present my favorite agentic framework, it has its limitations:\u00a0<\/p>\n<ul class=\"wp-block-list\">\n<li class=\"wp-block-list-item\">It could lack flexibility at occasions. For instance, I needed to modify the immediate instantly within the supply code to get the behaviour I needed.<\/li>\n<li class=\"wp-block-list-item\">It solely helps hierarchical multi-agent set-up (the place one supervisor can delegate duties to different brokers), however doesn\u2019t cowl sequential workflow or consensual decision-making processes.<\/li>\n<li class=\"wp-block-list-item\">There\u2019s no assist for long-term reminiscence out of the field, which means you\u2019re ranging from scratch with each job.<\/li>\n<\/ul>\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><em>Thank you numerous for studying this text. I hope this text was insightful for you.<\/em><\/p>\n<\/blockquote>\n<h2 class=\"wp-block-heading\">Reference<\/h2>\n<p class=\"wp-block-paragraph\">This text is impressed by the \u201c<a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/www.deeplearning.ai\/short-courses\/building-code-agents-with-hugging-face-smolagents\/\" rel=\"noreferrer noopener\" target=\"_blank\">Constructing Code Brokers with Hugging Face smolagents<\/a>\u201d quick course by DeepLearning.AI.<\/p>\n<\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>, we frequently want to research what\u2019s happening with KPIs: whether or not we\u2019re reacting to anomalies on our dashboards or simply routinely doing a numbers replace. Primarily based on my years of expertise as a KPI analyst, I might estimate that greater than 80% of those duties are pretty commonplace and could be solved [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":2976,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[55],"tags":[617,977,157,2865,1561,2864],"class_list":["post-2974","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-machine-learning","tag-agents","tag-code","tag-data","tag-kpi","tag-narratives","tag-stories"],"_links":{"self":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts\/2974","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2974"}],"version-history":[{"count":1,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts\/2974\/revisions"}],"predecessor-version":[{"id":2975,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts\/2974\/revisions\/2975"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/media\/2976"}],"wp:attachment":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2974"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2974"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2974"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}<!-- This website is optimized by Airlift. Learn more: https://airlift.net. Template:. Learn more: https://airlift.net. Template: 69d9690a190636c2e0989534. Config Timestamp: 2026-04-10 21:18:02 UTC, Cached Timestamp: 2026-05-18 18:24:43 UTC -->