
    'j {                        d Z ddlZddlZddlZddlZddlZddlmZ	 ddl
mZ ddlmZ ddlmZ ddlmZmZmZ ddlmZ dd	lmZ dd
lmZ dZddddddZdZdee          d e             dZedz   ez   Z eej        d         eddde          Z ddde!de!dz  de"dz  de#e$e!e!f                  dz  d e%e$dz  e!f         f
d!Z&d"e!d e%e!e#e$e!e!f                  f         fd#Z'e j(        d$ee         d"e!d e!fd%            Z)e j(        d$ee         d e!fd&            Z*e j(        d$ee         de!d e!fd'            Z+e j(        	 d0d$ee         de!d)e!d e!fd*            Z,e j(        	 	 	 	 	 d1d$ee         d+e!de!d,e!d-e!d.e!d e!fd/            Z-dS )2u;   Chanakya routing agent — tools for consulting sub-agents.    N)logger)
RunContext)RequestContext)EnterpriseAgent)TATASTEEL_QUERY_URLUI_AGENT_STREAM_URLget_http_client)search_and_fetch)	summarise)make_decision_framework_promptu  You are Enterprise Brain, the central intelligence hub.
You have four capabilities: ask_tatasteel, ask_tatasteel_decision_support, ask_ui_agent, and web_search.

━━━ CAPABILITIES ━━━
  ask_tatasteel — queries the live construction project database.
    Use for: contracts, early warnings, compensation events, quotations, project
    figures, rankings, trends, counts, or any data in the project database.
    When both primary data and market context are needed, batch this in parallel with web_search.

  ask_ui_agent — ALWAYS call this after ask_tatasteel, no exceptions.
    Renders results as styled frontend widgets with charts and narrative.
    Pass market_context and storyline_hints so the response is fully enriched.

  web_search — searches the internet for real-time market context.
    Stores market_context for ask_ui_agent.
    When both primary data and market context are needed, batch this in parallel with ask_tatasteel.

  ask_tatasteel_decision_support — runs a follow-up Tata Steel analysis query
    aimed at action, prioritisation, delay reduction, cost reduction, tradeoff,
    or contractor focus. Stores decision-support data for ask_ui_agent.

━━━ WORKFLOW FOR DATABASE QUESTIONS ━━━

  STEP 1 — INTENT ANALYSIS (think first, call no tools yet):
    a. Decode business terms in the question — what is the user
       really asking? Translate jargon into the underlying data question.
    b. Classify the question type: comparison, ranking, trend, proportion, single KPI.
    c. Identify the underlying decision the user needs to make — not just the data they asked for.
       Surface questions often mask prioritisation needs. Ask: what does this person need to act on?
    d. Map the question to the closest Decision Context (DC-01 through DC-09) from
       the Decision-Enabling Framework. Then generate exactly 5 follow-up questions
       anchored to that DC:
       - 2 from the open decision options of the matched DC — what the persona still
         needs to decide after receiving this answer
       - 2 from the required data signals of the matched DC that the primary query did
         not yet surface — data gaps that would complete the decision picture
       - 1 bridging question pointing to the adjacent DC the persona should address
         once the current decision is resolved
       All 5 must be answerable from the database and must advance the persona's mandate.
       Never frame NCE auto-approval as a cost or schedule risk in follow-up questions —
       cost and schedule impact comes only from accepted quotations (change_to_prices,
       change_to_days); auto-approval affects the PM's reject right, not the budget.
       CRITICAL — follow-up questions are shown verbatim to end users. They MUST be written
       in plain business language. Never include raw SQL column names (e.g. change_to_prices,
       change_to_days, reply_due_date, record_number, vendor, nce_number). Translate every
       technical term: "change_to_prices" → "cost impact", "change_to_days" → "time impact",
       "reply_due_date" → "response deadline", "record_number" → "reference", "vendor" →
       "contractor". If a question reads like a SQL query, rewrite it.
    e. Compose a dc_mapping_explanation (3–6 lines) that states:
       - Which DC was matched and why (e.g. "Mapped to DC-08 — Finance budget coverage,
         because the question asks how to prevent budget overruns from a Finance lens")
       - For each of the 5 follow-up questions, one sentence explaining which decision
         option or required data signal from the matched DC it comes from
       Pass this as dc_mapping_explanation when calling ask_ui_agent. It is rendered as
       a visible section so the user can see how the follow-up questions were derived.

  STEP 2 — Call ask_tatasteel with the primary question to get data and explanation.
    This first ask_tatasteel call is the main answer dataset.

  STEP 3 — In the SAME model turn, batch these two independent tool calls in parallel when both are needed:
    - ask_tatasteel for the primary answer dataset
    - web_search for external market / industry context
    Only call web_search when the question requires context the database cannot provide — industry
    benchmarks, market rates, contractor reputation, or sector news. Skip it when the database alone
    fully answers the question.

  STEP 4 — After ask_tatasteel and web_search complete, decide whether actionability needs extra support:
    - Call ask_tatasteel_decision_support zero, one, or more times with tightly-scoped follow-up analytical questions.
    - Do this AFTER reviewing the primary answer and any market context.

  STEP 5 — Call ask_ui_agent with ALL enrichment:
    • question: the original user question (verbatim)
    • market_context: optional; leave blank if web_search already stored it
    • storyline_hints: the 5 follow-up questions from Step 1d, pipe-delimited
    • dc_mapping_explanation: the DC mapping explanation from Step 1e

━━━ VISUALIZATION FOLLOW-UPS ━━━
(when user asks to change/switch/modify the chart or visualization)
  The previous data is already cached — do NOT call ask_tatasteel or web_search again.
  Call ask_ui_agent DIRECTLY with a visualization_hint that describes:
    - The chart type currently shown (find [Visualisation shown: ...] in prior reply)
    - What the user wants, e.g. 'user wants bar chart'
  Example: 'Currently showing contract-value-orb. User wants a different visualization.'
  Skipping ask_tatasteel AND web_search is REQUIRED — avoids needless round-trips.

CURRENCY CONVERSION REQUESTS (e.g. 'convert to dollars', 'show in euros', 'change to rupees'):
  The underlying data does not change — do NOT call ask_tatasteel.
  Call ask_ui_agent DIRECTLY with the user's question. The UI agent will retrieve
  the previous rows from conversation history and re-render them in the new currency.

━━━ DIRECT ANSWERS (use no tools) ━━━
  - Greetings, general conversation, help requests.
  - Questions about yourself or your capabilities.
  - Anything answerable from conversation history alone.
  - General knowledge not requiring project database data.
  NOTE: 'change the visualization', 'show as a different chart' are NOT direct answers
  — always use tools for these.

CONVERSATION HISTORY: You have full access to prior messages.
Use it to answer follow-up questions accurately without re-querying the database.
zFocus on delivery cost and timelines as primary drivers of project success.
Prioritize interventions that reduce notification cycle time and cost exposure.
zFocus on identifying and mitigating contractual and schedule risks.
Prioritize early warnings, compensation events, and potential disputes before they escalate.
zFocus on vendor performance metrics and accountability.
Prioritize vendor compliance, delivery consistency, and quality benchmarks.
zFocus on cash flow optimization and financial planning.
Prioritize quotation approvals, payment schedules, and working capital efficiency.
zFocus on scope management and change control.
Prioritize variation identification, scope creep prevention, and contract alignment.
)cost_and_timelinerisk_mitigationvendor_performance	cash_flowscope_controlr   ut   TATA STEEL DEPLOYMENT CONTEXT:
This Enterprise Brain deployment is for Tata Steel.

━━━ PERSPECTIVE ━━━
u  

━━━ USER CONTEXT ━━━
Users span the full organisational hierarchy — board members, C-suite executives (CTO, CFO, COO,
CEO), programme directors, construction management heads, finance leads, commercial managers,
contract administrators, and project managers. All are familiar with NEC contract terminology
and steel industry operations. NEVER define or explain NCE, EW, CE, NEC, quotation, compensation
event, variation, or any standard industry term — treat all domain terminology as shared knowledge.
Do not add disclaimers or jargon explanations at any level of seniority.

TATA STEEL WEB SEARCH SCOPING:
- Use for: industry benchmarks, Tata Steel UK news, NEC contract norms,
  UK construction cost trends, contractor market intelligence, steel sector news.

u  

━━━ TATA STEEL INTENT EXAMPLES:
- Decode NEC terms such as NCE, EW, and CE into the underlying data question.
- Example follow-up lines for Tata Steel questions:
  Question: 'NCE variance across vendors'
  Storylines:
    • 'Which vendors have the highest NCE-to-CE conversion rate?'
    • 'How has NCE volume trended month-over-month for the top 3 vendors?'
    • 'What is the average financial value of NCEs per vendor?'
    • 'Which vendor cluster should be reviewed first to avoid the largest cost exposure?'
    • 'Which intervention would most likely reduce notification cycle time over the next month?'

TATA STEEL STORYLINE FORMAT EXAMPLE:
'Which vendors have highest NCE-to-CE rate? | How has NCE volume trended? | What is average NCE value per vendor? | Which vendor cluster should be reviewed first to avoid the largest cost exposure? | Which intervention would most likely reduce notification cycle time over the next month?'

PERSPECTIVE FILTERING RULE:
  All market context, external trends, and decision-support insights MUST be evaluated against
  the active PERSPECTIVE and either:
    a) Filtered OUT if irrelevant to the perspective focus, OR
    b) Explicitly LINKED to the perspective's primary drivers if included.
  Do not include external context (market trends, industry benchmarks, labor market) unless it
  directly informs or accelerates action aligned with the current perspective.


LITELLM_PROVIDER_BASE_URLzchanakya-alphachanakya)api_baseinstructionsretrieslogfire_envservice_name	deps_type)message_history_wirequestion
user_emailconversation_idr   returnc                  K   	 t                      }|                    t          | |||d           d {V }nD# t          j        $ r Y dS t
          $ r&}t          j        d|           d d| fcY d }~S d }~ww xY w|j        dk    rd d|j         dfS |	                                }|
                    d	          d
k    r1|
                    di           }d d|
                    dd           fS |dfS )N)r   r   r   historyjson)Nz3Could not reach the Tatasteel agent. Is it running?z[ASK_TATASTEEL] HTTP error: {}z"Error contacting Tatasteel agent:    zTatasteel agent returned HTTP .statusfailureerrorzTatasteel agent error: messagezunknown error )r	   postr   httpxConnectError	Exception_logr(   status_coder#   get)	r   r   r   r   clientrespexcpayloaderrs	            D/var/www/html/ai-enterprise-brain/backend/chanakya/rt_agent/agent.py_query_tatasteelr8      sq     @ ""[[$(#2/	  ! 
 
 
 
 
 
 
 
  K K KJJJ @ @ @
3S999?#?????????@ 3Id6FIIIIIiikkG{{8	))kk'2&&Tswwy//R/RTTTTB;s!   5: A;	A;A60A;6A;queryc                    K   t          j        t          |            d {V }t          j        t          | |           d {V \  }}||fS )N)asyncio	to_threadr
   r   )r9   rawtextclaimss       r7   _run_web_searchr@      s_      !"2E::
:
:
:
:
:
:C *9eSAAAAAAAALD&<    ctxc                    K   | j         r| j         j        nd}||                    dddd           d{V  t          |           d{V \  }}| j         || j         _        || j         _        |S )u4  Search the web and return grounded, source-cited market context bullets.

    Each bullet is backed by a verbatim quote from the search results.
    Claims without a verifiable source are excluded automatically.
    Use the returned text verbatim as market_context — do NOT re-summarise or augment it.
    Nprogress	searchingzReading web sources...typestepr)   )depsprogress_queueputr@   
web_claimsmarket_context_text)rB   r9   rJ   r>   r?   s        r7   
web_searchrN      s       GJh+X38+B+BTXN!  *kVn!o!oppppppppp(////////LD&
x$'+$KrA   c                 r    | j         sdS d| j         j        pd d| j         j        pd d| j         j        pd S )zEReturn the calling user's identity and role from the request context.z6user_email=(unknown), role=(unknown), tenant=(unknown)zuser_email=z	(unknown)z, role=z	, tenant=)rI   r   roletenant)rB   s    r7   get_my_contextrR     sa     8 HGG	3ch)8[ 	3 	3,	3 	3(/0[	3 	3rA   c                 L  K   | j         r| j         j        nd}| j         r| j         j        nd}| j         r| j         j        r| j         j        nd                                }d| d| }t          j        d||           t          j                    }| j         r| j         j	        nd}||
                    dddd	           d{V  t          |||| j         r| j         j        nd
           d{V \  }}	||	S |                    dd          }
|                    dg           }|                    dd          }t          j        dt          |
          t          |          |           |4|                    dg           D ]}|
                    |           d{V  | j         |g| j         _        | j         j        *|| j         _        | j         j                                         |                    d          | j         _        |                    d          | j         _        |                    d          pg | j         _        | j         j                            d|t          |          |
||t1          t          j                    |z
  dz            d           |
S )a'  Query the Tatasteel agent via HTTP /query and return the explanation text.

    Calls tatasteel synchronously to get SQL results (rows + explanation).
    The payload is stored in ``ctx.deps.tatasteel_result`` so ``ask_ui_agent``
    can pick it up directly without a second tatasteel call.
    NPM
[PERSONA: ] z*[ASK_TATASTEEL] question={!r} persona={!r}rD   queryingzQuerying Tata Steel database...rF   r   r   r   explanation(no explanation)rowsgenerated_sqlr*   z5[ASK_TATASTEEL] explanation={} chars, rows={}, sql={}progress_stepssql_explanation	query_logask_tatasteel  )rH   r   r[   rY   r\   rows_allduration_ms)rI   r   r   rP   stripr/   debug_time	monotonicrJ   rK   r8   r   r1   lentatasteel_resulttatasteel_primary_result"tatasteel_decision_support_resultscleartatasteel_generated_sqltatasteel_sql_explanationtatasteel_query_logflow_logappendround)rB   r   r   r   personatagged_question	_ts_startrJ   r5   err_msgrY   r[   sql
step_events                 r7   r`   r`     s      ),:$$dJ25(Dch..O #DSX]Dsx}}KKMMG8788h88OJ;XwOOO!!I GJh+X38+B+BTXN!  *jUv!w!wxxxxxxxxx-'>AhPSX::D	        GW ++m-?@@K;;vr""D
++or
*
*CJFKHXHXZ]^bZcZcehiii !!++&6;; 	1 	1J $$Z0000000000 x%,I!8,407CH-H7==???+2;;+G+G(-4[[9J-K-K*'.{{;'?'?'E2$  # II&  %/"3"3i"?4!GHH"
 "
 	 	 	 rA   r*   focusc                 |  K   | j         r| j         j        nd}| j         r| j         j        nd}| j         r| j         j        r| j         j        nd                                }d| d| }t          j        d|||           t          j                    }t          |||| j         r| j         j
        nd           d{V \  }}	||	S |                    dg           pg }
|                    dd	          }|                    d
d          }| j         | j         j                            ||pd|
|||                    d          |                    d          pg d           | j         j                            d||pdt          |
          |||
t!          t          j                    |z
  dz            d           |S )z@Run a follow-up Tata Steel query used only for decision support.NrT   rU   rV   zF[ASK_TATASTEEL_DECISION_SUPPORT] question={!r} focus={!r} persona={!r}rX   r[   rY   rZ   r\   r*   r^   r_   )r   ry   r[   rY   r\   r^   r_   ask_tatasteel_decision_supportra   )rH   r   ry   r[   rY   r\   rb   rc   )rI   r   r   rP   rd   r/   re   rf   rg   r8   r   r1   rk   rq   rp   rh   rr   )rB   r   ry   r   r   rs   rt   startr5   rv   r[   rY   rw   s                r7   r{   r{   U  s      ),:$$dJ25(Dch..O #DSX]Dsx}}KKMMG8788h88OJWYachjqrrrOE-'>AhPSX::D	        GW ;;vr""(bD++m-?@@K
++or
*
*C
x3:: ]d& &{{+<== [117R<
 <
 	 	 	 	  4 ]dII&  %/"3"3e";t!CDD	"
 	"
 		 		 		 rA   visualization_hintmarket_contextstoryline_hintsdc_mapping_explanationc                   K   | j         r+| j         j        r| j         j                                        }n>| j         r1| j         j        r%| j         j        d                                         }ng ddd}| j         r| j         j        nd}| j         r| j         j        nd}|p|                    dd          }	|r|	 d| dn|	}
|rd |                    d	          D             ng }|p| j         r| j         j        nd}|                    d
d          }|                    dg           |                    dd          |
||||pd|pd|pd| j         r| j         j	        nd| j         r"| j         j
        rd | j         j
        D             nd|                    d          pd|                    d          pd|                    d          pdd}| j         r| j         j        nd}||                    dddd           d{V  t          |                    dg                     }|                    dg           }t          j        d|           t!          j                    }	 t%                      }|                    dt(          |          4 d{V }|j        dk    rHdd|j         dd}||                    |           d{V  d|j         d cddd          d{V  S d}|                                2 3 d{V }|s
||z  }d!|v r|                    d!d"          \  }}|                    d#          D ]v}|                    d$          r]	 t1          j        |d%d                   }|                    d&          d'k    r| j         rt5          |                    d(          pg           }| j         j        pg }|rat9          |          D ]P\  }}|                    d)|                    d*d          |                    d          pd|dk    r|ng d+           Qn:| j         j        r.|                    d)| j         j        | j         j        |d+           | j         j
        pg }|D ]p} |                     dd          }!|                     d,          p|                     d          pd}"|                     d          pg }#|                     d-          pg }$|$rt          |$          d"z
  }%t9          |$          D ]r\  }&}|                    d          p|"pd}'|!rd.|! d/|'                                  }'|                    d)|                    d*d          |'pd|&|%k    r|#ng d+           s|                     d0          rP|"pd}'|!rd.|! d/|'                                  }'|                    d)|                     d0d          |'pd|#d+           r|r9d1 |D             }(|(r+|                    d2d!!                    |(          d3           | j         j"        r"|                    d| j         j"        d3           i |d(|i}||                    |           d{V  |                    d&          d'k    r| j         r|| j         _#        e# tH          $ r Y rw xY wxd!|v 6 	 ddd          d{V  n# 1 d{V swxY w Y   n# tJ          j&        $ r' dd4dd}||                    |           d{V  Y d5S tH          $ rT})t          j'        d6|)           dtQ          |)          dd}||                    |           d{V  d7|) cY d})~)S d})~)ww xY w| j         r9| j         j#        r-t          | j         j#                            d(g                     nd}*g }+| j         r,| j         j#        r | j         j#                            d(g           }+tS          d8 |+D             d          },| j         U| j         j*                            d9|pd|
|pd||||*|,pd|+tW          t!          j                    |z
  d:z            d;           d<|* d=| d>S )?u  Render the most recent tatasteel query result as a frontend widget.

    ALWAYS call this after ask_tatasteel — for every database question without
    exception. The UI agent renders charts when rows are present and formatted text
    cards when they are not. Never return a raw tatasteel explanation directly.

    The payload from the last ask_tatasteel call is forwarded automatically — you do
    not need to pass rows or explanation explicitly.

    Args:
        visualization_hint: Optional hint about preferred chart style (e.g. "bar chart",
                            "show as table", "trend line").  Leave empty to let the UI
                            agent pick the best fit automatically.
        question: The current user question. Pass this verbatim so the UI agent
                  receives the exact wording (especially for follow-up viz requests
                  like "change the chart").
        market_context: Bullet-point summary of web search results — industry
                        benchmarks, Tata Steel UK news, NEC norms, market trends.
                        Pass verbatim from your web_search summary (150–300 words).
        storyline_hints: Pipe-delimited list of 5 follow-up enquiry questions derived
                         from the matched Decision Context (DC-01 through DC-09).
        dc_mapping_explanation: Plain-text explanation (3–6 lines) stating which DC was
                         matched and why each of the 5 follow-up questions was derived from
                         that DC's decision options or required data signals. This is rendered
                         as a visible "How follow-ups were derived" section in the UI.
    r   r*   )r[   rY   r   Nr   z
[Visualization context: ]c                 ^    g | ]*}|                                 |                                 +S  )rd   ).0ss     r7   
<listcomp>z ask_ui_agent.<locals>.<listcomp>  s-    DDDq!''))DDDDrA   |currency_codeGBPr[   rY   c                 J    g | ] }d  |                                 D             !S )c                 "    i | ]\  }}|d v	||S ))r\   r^   r_   r   )r   kvs      r7   
<dictcomp>z+ask_ui_agent.<locals>.<listcomp>.<dictcomp>  s)    jjj$!Qq8i/i/iA/i/i/irA   )itemsr   ps     r7   r   z ask_ui_agent.<locals>.<listcomp>  s?        kj!''))jjj  rA   what_to_act_onurgencycost_of_inaction)r[   rY   r   r   r   r   r~   r   dc_explanationr!   decision_support_contextr   r   r   rD   	renderingzPreparing response...rF   z/[ASK_UI_AGENT] calling UI agent stream, rows={}POSTr"   r$   r(   zUI agent returned PIPELINE_ERROR)rG   r)   codezUI agent returned HTTP r%   r      
zdata:    rG   donedata	sql_queryrw   )rG   contentrY   r[   r^   r_   u   Decision support —  r\   c                     g | ]R}|                     d d                                          *|                     d d                                          SS )rY   r*   )r1   rd   r   s     r7   r   z ask_ui_agent.<locals>.<listcomp>0  sb     8. 8. 8.4534553K3K3Q3Q3S3S8.01mR0H0H0N0N0P0P8. 8. 8.rA   decision_context)rG   r   zCould not reach the UI agent.z,Could not reach the UI agent. Is it running?z[ASK_UI_AGENT] error: {}zError contacting UI agent: c              3      K   | ]G}|                     d           dk    |                     di                                d d          V  HdS )rG   visualizationr   r*   N)r1   )r   ws     r7   	<genexpr>zask_ui_agent.<locals>.<genexpr>W  sU      gg!aeeFmmWfFfFfy"			!	!&"	-	-FfFfFfFfggrA   ask_ui_agentra   )rH   r}   r   r~   
storylinesui_request_forwarded
input_rowsoutput_widgetsviz_typewidgets_allrc   zVisualization generated with z widget(s) for z data rows.),rI   rj   copyri   r   r   r1   splitrM   r   rk   rJ   rK   rh   r/   re   rf   rg   r	   streamr   r0   
aiter_text
startswithr#   loadslistro   	enumeraterq   rm   rn   rd   joinrL   	ui_resultr.   r,   r-   r(   strnextrp   rr   )-rB   r}   r   r~   r   r   r5   r   r   base_questionfinal_questionparsed_storylinesresolved_market_contextr   
ui_requestrJ   	row_countprimary_rows	_ui_startr2   r3   r6   
sse_bufferchunksse_msglineparsed	done_datar_   idxentrydecision_supportpacketpacket_questionpacket_explanationpacket_rowspacket_logslast_idxlog_idxexplds_partsr4   widget_countr   r   s-                                                r7   r   r     s     F x BCH5 B(388::	 Bch/ B(+A.3355
 bbAA(+:$$dJ25(Dch..O ;J ; ;M 	=II4FIIII  	DDO11#66DDDD 
 -bQTQY1a1M1M_a KK77M FB''{{="55" *&19T,408D47HF3800$ x	  HG	  D   
 !++&677?4;;y))1T#KK(:;;Ct+ J0 GJh+X38+B+BTXN!  *kVm!n!noooooooooGKK++,,I;;vr**LJ@)LLL!!Ia3 ""==)<:=NN T	) T	) T	) T	) T	) T	) T	)RV#s**#*7^DL\7^7^hxyyC%1,00555555555HT5EHHHT	) T	) T	) T	) T	) T	) T	) T	) T	) T	) T	) T	) T	) T	)  
#'??#4#4 M) M) M) M) M) M) M)%  ! %'J J...8.>.>vq.I.I+$+MM$$7$7 G) G)D#x88 F)E!)-1ZQRR-A-AF'-zz&'9'9V'C'C'C48F9K9K9Qr4R4R	47H4P4VTV	+4 )/>G	>R>R -3 -3
U090@0@<G?DyyPR?S?SCH99]C[C[Cc_cLOSTHHLLZ\	B2 B2 13 13 13 13-3 .1X-M )/,5,<,<8C;>8;[?Bx?a8D	>. >. -/ -/ -/ <?8;f;ljl(86F )3 )3F>DjjUW>X>XOAGL]A^A^  BDbhblblmzb{b{  BD  @D,>:@**V:L:L:RPRK:@**[:Q:Q:WUWK/: -3;>{;K;Ka;OFOP[F\F\ 	17 	17NGU;@99];S;S;oWi;omoD7F 5x?oWf?o?oim?o?o?u?u?w?w4=4D4D@KCH99UTVCWCWGK|tOVZbObObhj	F6 F6 57 57 57 57		17 28O1L1L 	-37I7OR3B 1t;kSb;k;kei;k;k;q;q;s;sD090@0@<G?Ezz/[]?^?^CG<4<G	B2 B2 13 13 13 ,< 
)38. 8.9I8. 8. 8.H
 08 -3090@0@<N?E{{8?T?TB2 B2 13 13 13 ,/8+> )v,5,<,<m`c`h`s=t=t,u,u,u1NF1NFI1N1N'5'A.<.@.@.H.H(H(H(H(H(H(H(H'-zz&'9'9V'C'C'C=C(:'0 !) !) !)$(D!)KF) !J..	 $5#4T	) T	) T	) T	) T	) T	) T	) T	) T	) T	) T	) T	) T	) T	) T	) T	) T	) T	) T	) T	) T	) T	) T	) T	) T	) T	) T	)j  > > >+JTdee% $$S)))))))))=== 3 3 3
-s3333s88=MNN% $$S)))))))))2S222222223 ?Bhd38K]d3sx)--fb99:::cdL !K
x 9CH& 9h(,,VR88gg{ggg
 H
 x  ""4"<&5=+$.#* (D& %/"3"3i"?4!GHH"
 "
 	 	 	 _<^^	^^^^s   #1[% A[[% ([>Z?A[M	Z%#[%
Z3	/[2Z3	3[[% 
[[%  [![% %2]7	]7#A	]2,]72]7)r*   )r*   r*   r*   r*   r*   ).__doc__r;   r#   ostimerf   r,   logurur   r/   pydantic_air   backend.chanakya.a2a_contextr   backend.chanakya.baser   backend.chanakya.rt_agent._httpr   r   r	   'backend.chanakya.rt_agent.web_groundingr
   (backend.chanakya.rt_agent.web_summariserr   -backend.chanakya.tatasteel.decision_frameworkr   _CHANAKYA_GENERAL_PROMPT_TATASTEEL_PERSPECTIVES_DEFAULT_PERSPECTIVE_CHANAKYA_TATASTEEL_PROMPT_CHANAKYA_AGENT_PROMPTenvironr   r   intr   dicttupler8   r@   toolrN   rR   r`   r{   r   r   rA   r7   <module>r      s   A A   				      ! ! ! ! ! ! " " " " " " 7 7 7 7 7 7 1 1 1 1 1 1 e e e e e e e e e e D D D D D D > > > > > > X X X X X Xe P#  . + *
 -.* *&  !!'* * * X 2F:=WW 
 ?Z34'   $ 9=   d
 4Z	
 tCH~.5 4$;   D sDc3h4H/H)I    
 
*^4 S S    & 

>2 s     
9Z7 93 93 9 9 9 9x 
 / /	N	#// / 		/ / / /d 
 !"$a_ a_	N	#a_a_ a_ 	a_
 a_  a_ 	a_ a_ a_ a_ a_ a_rA   