aieng-eval-agents 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. aieng_eval_agents-0.2.0/.gitignore +30 -0
  2. aieng_eval_agents-0.2.0/PKG-INFO +32 -0
  3. aieng_eval_agents-0.2.0/README.md +1 -0
  4. aieng_eval_agents-0.2.0/aieng/agent_evals/__init__.py +37 -0
  5. aieng_eval_agents-0.2.0/aieng/agent_evals/aml_investigation/__init__.py +26 -0
  6. aieng_eval_agents-0.2.0/aieng/agent_evals/aml_investigation/agent.py +262 -0
  7. aieng_eval_agents-0.2.0/aieng/agent_evals/aml_investigation/data/__init__.py +28 -0
  8. aieng_eval_agents-0.2.0/aieng/agent_evals/aml_investigation/data/cases.py +512 -0
  9. aieng_eval_agents-0.2.0/aieng/agent_evals/aml_investigation/data/utils.py +246 -0
  10. aieng_eval_agents-0.2.0/aieng/agent_evals/aml_investigation/graders/__init__.py +8 -0
  11. aieng_eval_agents-0.2.0/aieng/agent_evals/aml_investigation/graders/_common.py +61 -0
  12. aieng_eval_agents-0.2.0/aieng/agent_evals/aml_investigation/graders/item.py +182 -0
  13. aieng_eval_agents-0.2.0/aieng/agent_evals/aml_investigation/graders/run.py +190 -0
  14. aieng_eval_agents-0.2.0/aieng/agent_evals/aml_investigation/graders/trace.py +352 -0
  15. aieng_eval_agents-0.2.0/aieng/agent_evals/aml_investigation/task.py +160 -0
  16. aieng_eval_agents-0.2.0/aieng/agent_evals/async_client_manager.py +168 -0
  17. aieng_eval_agents-0.2.0/aieng/agent_evals/async_utils.py +158 -0
  18. aieng_eval_agents-0.2.0/aieng/agent_evals/configs.py +179 -0
  19. aieng_eval_agents-0.2.0/aieng/agent_evals/db_manager.py +137 -0
  20. aieng_eval_agents-0.2.0/aieng/agent_evals/display.py +339 -0
  21. aieng_eval_agents-0.2.0/aieng/agent_evals/evaluation/__init__.py +47 -0
  22. aieng_eval_agents-0.2.0/aieng/agent_evals/evaluation/experiment.py +213 -0
  23. aieng_eval_agents-0.2.0/aieng/agent_evals/evaluation/graders/__init__.py +21 -0
  24. aieng_eval_agents-0.2.0/aieng/agent_evals/evaluation/graders/_utils.py +210 -0
  25. aieng_eval_agents-0.2.0/aieng/agent_evals/evaluation/graders/config.py +44 -0
  26. aieng_eval_agents-0.2.0/aieng/agent_evals/evaluation/graders/llm_judge.py +270 -0
  27. aieng_eval_agents-0.2.0/aieng/agent_evals/evaluation/graders/trace_groundedness.py +369 -0
  28. aieng_eval_agents-0.2.0/aieng/agent_evals/evaluation/trace.py +492 -0
  29. aieng_eval_agents-0.2.0/aieng/agent_evals/evaluation/types.py +179 -0
  30. aieng_eval_agents-0.2.0/aieng/agent_evals/knowledge_qa/__init__.py +40 -0
  31. aieng_eval_agents-0.2.0/aieng/agent_evals/knowledge_qa/agent.py +490 -0
  32. aieng_eval_agents-0.2.0/aieng/agent_evals/knowledge_qa/data/__init__.py +13 -0
  33. aieng_eval_agents-0.2.0/aieng/agent_evals/knowledge_qa/data/deepsearchqa.py +239 -0
  34. aieng_eval_agents-0.2.0/aieng/agent_evals/knowledge_qa/deepsearchqa_grader.py +367 -0
  35. aieng_eval_agents-0.2.0/aieng/agent_evals/knowledge_qa/event_extraction.py +291 -0
  36. aieng_eval_agents-0.2.0/aieng/agent_evals/knowledge_qa/plan_parsing.py +377 -0
  37. aieng_eval_agents-0.2.0/aieng/agent_evals/knowledge_qa/system_instructions.py +77 -0
  38. aieng_eval_agents-0.2.0/aieng/agent_evals/langfuse.py +461 -0
  39. aieng_eval_agents-0.2.0/aieng/agent_evals/progress.py +95 -0
  40. aieng_eval_agents-0.2.0/aieng/agent_evals/report_generation/__init__.py +0 -0
  41. aieng_eval_agents-0.2.0/aieng/agent_evals/report_generation/agent.py +226 -0
  42. aieng_eval_agents-0.2.0/aieng/agent_evals/report_generation/evaluation/__init__.py +0 -0
  43. aieng_eval_agents-0.2.0/aieng/agent_evals/report_generation/evaluation/offline.py +386 -0
  44. aieng_eval_agents-0.2.0/aieng/agent_evals/report_generation/evaluation/online.py +78 -0
  45. aieng_eval_agents-0.2.0/aieng/agent_evals/report_generation/file_writer.py +83 -0
  46. aieng_eval_agents-0.2.0/aieng/agent_evals/report_generation/prompts.py +74 -0
  47. aieng_eval_agents-0.2.0/aieng/agent_evals/tools/__init__.py +54 -0
  48. aieng_eval_agents-0.2.0/aieng/agent_evals/tools/_redirect.py +165 -0
  49. aieng_eval_agents-0.2.0/aieng/agent_evals/tools/file.py +488 -0
  50. aieng_eval_agents-0.2.0/aieng/agent_evals/tools/search.py +371 -0
  51. aieng_eval_agents-0.2.0/aieng/agent_evals/tools/sql_database.py +360 -0
  52. aieng_eval_agents-0.2.0/aieng/agent_evals/tools/web.py +442 -0
  53. aieng_eval_agents-0.2.0/pyproject.toml +52 -0
  54. aieng_eval_agents-0.2.0/tests/aieng/__init__.py +0 -0
  55. aieng_eval_agents-0.2.0/tests/aieng/agent_evals/__init__.py +0 -0
  56. aieng_eval_agents-0.2.0/tests/aieng/agent_evals/aml_investigation/data/__init__.py +0 -0
  57. aieng_eval_agents-0.2.0/tests/aieng/agent_evals/aml_investigation/data/test_cases.py +259 -0
  58. aieng_eval_agents-0.2.0/tests/aieng/agent_evals/aml_investigation/data/test_utils.py +119 -0
  59. aieng_eval_agents-0.2.0/tests/aieng/agent_evals/evaluation/__init__.py +1 -0
  60. aieng_eval_agents-0.2.0/tests/aieng/agent_evals/evaluation/graders/__init__.py +1 -0
  61. aieng_eval_agents-0.2.0/tests/aieng/agent_evals/evaluation/graders/test_llm_judge.py +201 -0
  62. aieng_eval_agents-0.2.0/tests/aieng/agent_evals/evaluation/graders/test_trace_groundedness.py +313 -0
  63. aieng_eval_agents-0.2.0/tests/aieng/agent_evals/evaluation/test_trace.py +183 -0
  64. aieng_eval_agents-0.2.0/tests/aieng/agent_evals/knowledge_qa/__init__.py +0 -0
  65. aieng_eval_agents-0.2.0/tests/aieng/agent_evals/knowledge_qa/data/__init__.py +1 -0
  66. aieng_eval_agents-0.2.0/tests/aieng/agent_evals/knowledge_qa/data/test_deepsearchqa.py +216 -0
  67. aieng_eval_agents-0.2.0/tests/aieng/agent_evals/knowledge_qa/test_agent.py +720 -0
  68. aieng_eval_agents-0.2.0/tests/aieng/agent_evals/knowledge_qa/test_deepsearchqa_grader.py +156 -0
  69. aieng_eval_agents-0.2.0/tests/aieng/agent_evals/knowledge_qa/test_event_extraction.py +657 -0
  70. aieng_eval_agents-0.2.0/tests/aieng/agent_evals/knowledge_qa/test_plan_parsing.py +382 -0
  71. aieng_eval_agents-0.2.0/tests/aieng/agent_evals/test_async_client_manager.py +84 -0
  72. aieng_eval_agents-0.2.0/tests/aieng/agent_evals/test_db_manager.py +161 -0
  73. aieng_eval_agents-0.2.0/tests/aieng/agent_evals/test_langfuse.py +183 -0
  74. aieng_eval_agents-0.2.0/tests/aieng/agent_evals/tools/__init__.py +1 -0
  75. aieng_eval_agents-0.2.0/tests/aieng/agent_evals/tools/test_file.py +676 -0
  76. aieng_eval_agents-0.2.0/tests/aieng/agent_evals/tools/test_search.py +479 -0
  77. aieng_eval_agents-0.2.0/tests/aieng/agent_evals/tools/test_sql_database.py +237 -0
  78. aieng_eval_agents-0.2.0/tests/aieng/agent_evals/tools/test_web.py +509 -0
@@ -0,0 +1,30 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+
12
+ # Lint & Test
13
+ .mypy_cache/
14
+ .pytest_cache/
15
+ .ruff_cache/
16
+
17
+ # Vscode
18
+ .vscode
19
+
20
+ # macos
21
+ *.DS_Store
22
+
23
+ # ipynb checkpoints
24
+ **.ipynb_checkpoints
25
+
26
+ .env
27
+ .gradio
28
+ .adk
29
+ *.db
30
+ implementations/report_generation/reports/*
@@ -0,0 +1,32 @@
1
+ Metadata-Version: 2.4
2
+ Name: aieng-eval-agents
3
+ Version: 0.2.0
4
+ Summary: Agentic AI Evaluation reference implementation from Vector Institute AI Engineering
5
+ Author-email: Vector AI Engineering <ai_engineering@vectorinstitute.ai>
6
+ License-Expression: MIT
7
+ Requires-Python: <4.0,>=3.12
8
+ Requires-Dist: google-adk>=1.23.0
9
+ Requires-Dist: google-genai>=1.52.0
10
+ Requires-Dist: gradio>=6.0.2
11
+ Requires-Dist: html-to-markdown>=2.24.0
12
+ Requires-Dist: httpx>=0.27.0
13
+ Requires-Dist: kagglehub>=0.4.1
14
+ Requires-Dist: langfuse>=3.10.3
15
+ Requires-Dist: openai-agents>=0.6.1
16
+ Requires-Dist: openai>=2.8.1
17
+ Requires-Dist: openinference-instrumentation-google-adk>=0.1.0
18
+ Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.20.0
19
+ Requires-Dist: opentelemetry-sdk>=1.20.0
20
+ Requires-Dist: pandas>=2.3.0
21
+ Requires-Dist: pydantic-settings>=2.12.0
22
+ Requires-Dist: pydantic>=2.12.0
23
+ Requires-Dist: pypdf
24
+ Requires-Dist: python-dotenv>=1.0.0
25
+ Requires-Dist: rich>=13.9.0
26
+ Requires-Dist: sqlalchemy>=2.0.46
27
+ Requires-Dist: sqlglot>=28.6.0
28
+ Requires-Dist: tenacity>=8.2.0
29
+ Requires-Dist: weaviate-client>=4.18.3
30
+ Description-Content-Type: text/markdown
31
+
32
+ ## aieng-eval-agents
@@ -0,0 +1 @@
1
+ ## aieng-eval-agents
@@ -0,0 +1,37 @@
1
+ """Agent evaluation utilities and implementations.
2
+
3
+ This package provides tools for building and evaluating AI agents,
4
+ including display utilities for Jupyter notebooks.
5
+ """
6
+
7
+ from .display import (
8
+ create_console,
9
+ display_comparison,
10
+ display_evaluation_result,
11
+ display_example,
12
+ display_info,
13
+ display_metrics_table,
14
+ display_response,
15
+ display_source_table,
16
+ display_success,
17
+ display_warning,
18
+ )
19
+ from .progress import create_progress, track_with_progress
20
+
21
+
22
+ __all__ = [
23
+ # Display utilities
24
+ "create_console",
25
+ "display_response",
26
+ "display_source_table",
27
+ "display_comparison",
28
+ "display_example",
29
+ "display_evaluation_result",
30
+ "display_metrics_table",
31
+ "display_success",
32
+ "display_info",
33
+ "display_warning",
34
+ # Progress utilities
35
+ "create_progress",
36
+ "track_with_progress",
37
+ ]
@@ -0,0 +1,26 @@
1
+ """Utilities for AML Investigation agent."""
2
+
3
+ from .agent import create_aml_investigation_agent
4
+ from .data.cases import (
5
+ AnalystOutput,
6
+ CaseFile,
7
+ CaseRecord,
8
+ GroundTruth,
9
+ LaunderingPattern,
10
+ build_cases,
11
+ parse_patterns_file,
12
+ )
13
+ from .task import AmlInvestigationTask
14
+
15
+
16
+ __all__ = [
17
+ "AmlInvestigationTask",
18
+ "AnalystOutput",
19
+ "CaseFile",
20
+ "CaseRecord",
21
+ "LaunderingPattern",
22
+ "GroundTruth",
23
+ "build_cases",
24
+ "create_aml_investigation_agent",
25
+ "parse_patterns_file",
26
+ ]
@@ -0,0 +1,262 @@
1
+ """AML investigation agent.
2
+
3
+ This module defines the primary factory used to build the AML investigation agent.
4
+
5
+ The returned agent is a Google ADK ``LlmAgent`` configured to:
6
+
7
+ - Investigate one AML case at a time.
8
+ - Use read-only SQL tools for schema discovery and data retrieval.
9
+ - Return structured output that conforms to ``AnalystOutput``.
10
+
11
+ Examples
12
+ --------
13
+ >>> from aieng.agent_evals.aml_investigation.agent import create_aml_investigation_agent
14
+ >>> agent = create_aml_investigation_agent()
15
+ >>> agent.name
16
+ 'AmlInvestigationAnalyst'
17
+ """
18
+
19
+ from aieng.agent_evals.aml_investigation.data import AnalystOutput
20
+ from aieng.agent_evals.async_client_manager import AsyncClientManager
21
+ from aieng.agent_evals.db_manager import DbManager
22
+ from aieng.agent_evals.langfuse import init_tracing
23
+ from google.adk.agents import LlmAgent
24
+ from google.adk.agents.base_agent import AfterAgentCallback, BeforeAgentCallback
25
+ from google.adk.agents.llm_agent import AfterModelCallback, BeforeModelCallback
26
+ from google.adk.tools.function_tool import FunctionTool
27
+ from google.genai.types import GenerateContentConfig, HttpOptions, ThinkingConfig
28
+
29
+
30
+ _DEFAULT_AGENT_DESCRIPTION = "Conducts multi-step investigations for money laundering patterns using database queries."
31
+
32
+ ANALYST_PROMPT = """\
33
+ You are an Anti‑Money Laundering (AML) Investigation Analyst at a financial institution. \
34
+ Your job is to investigate a case by reviewing activity in the available database and explaining whether the \
35
+ observed behavior within the case window is consistent with a money laundering pattern or a benign explanation.
36
+
37
+ You have access to tools for querying the database. Use them strategically. Do NOT guess or invent transactions.
38
+
39
+ ## Core Principles
40
+ - Start with the hypothesis that activity is legitimate/benign unless evidence contradicts this.
41
+ - Laundering requires multiple indicators from different categories, not single factors alone.
42
+ - Entity type, business model, and transaction purpose determine whether patterns are suspicious.
43
+ - Base conclusions on observable transaction patterns, not speculation or absence of information.
44
+
45
+ ## Input
46
+ You will be given a JSON object with these fields:
47
+ - `case_id`: unique case identifier.
48
+ - `seed_transaction_id`: identifier for the primary transaction that triggered the case.
49
+ - `seed_timestamp`: timestamp of the seed transaction (end of the investigation window).
50
+ - `window_start`: timestamp of the beginning of the investigation window.
51
+ - `trigger_label`: upstream alert or review label that initiated the case. This may be noisy and should not be taken \
52
+ at face value.
53
+
54
+ **Time Scope**: Only analyze events with timestamps between `window_start` and `seed_timestamp` (inclusive).
55
+
56
+ ## Investigation Workflow
57
+
58
+ ### Step 1: Seed Transaction Review
59
+ Query the seed transaction and extract:
60
+ - Involved parties and their entity types (Corporation, Sole Proprietorship, Partnership, Individual)
61
+ - Amounts, currencies, payment channels
62
+ - Timestamps and jurisdictions
63
+
64
+ ### Step 2: Scope and Collect
65
+ **Note**: You have limited context window and limited number of queries to the database. Be strategic with the queries \
66
+ you run to avoid hitting limits before gathering enough evidence to make a determination.
67
+
68
+ **For each account you investigate**:
69
+
70
+ 1. **Always start with aggregates**:
71
+ ```
72
+ - COUNT(*) transactions
73
+ - COUNT(DISTINCT counterparty)
74
+ - SUM(amount) by direction
75
+ - Distribution by payment type/time
76
+ ```
77
+
78
+ 2. **Pull details selectively**:
79
+ - If count ≤ 20 transactions: Safe to SELECT all
80
+ - If count > 20: Query top counterparties, then pull samples for suspicious patterns
81
+ - Never pull thousands of raw transactions - use aggregates + samples
82
+
83
+ 3. **Expand strategically**:
84
+ - Follow promising leads from aggregates (unusual counterparties, timing clusters)
85
+ - Maximum 2-3 hops from seed unless clear layering chain
86
+
87
+ ### Step 3: Assess Benign Explanations (Default Hypothesis)
88
+ Attempt to explain observed activity as legitimate first:
89
+ - State which evidence supports the benign hypothesis
90
+ - Identify what additional data would strengthen this explanation
91
+ - Only proceed to Step 4 if benign explanations are insufficient
92
+
93
+ ### Step 4: Test Laundering Hypotheses (If Needed)
94
+ If benign explanations fail to account for the evidence:
95
+ - Test whether the evidence supports known laundering typologies
96
+ - Cite concrete indicators that rule out benign explanations
97
+
98
+ ## Typologies / Heuristics
99
+ Consider the following typologies when assessing laundering patterns:
100
+
101
+ - FAN-IN: *Many* distinct source accounts -> *One* destination account (consolidation/aggregation)
102
+ - FAN-OUT: *One* source account -> *Many* distinct destination accounts (distribution/dispersion)
103
+ - GATHER-SCATTER: *Many* sources -> *One* hub -> *Many* destinations (in that temporal order)
104
+ - First phase: Hub gathers from multiple sources
105
+ - Second phase: Hub scatters to multiple destinations
106
+ - Time gap between phases: typically hours to days.
107
+ - SCATTER-GATHER: *One* source -> *Many* intermediaries -> *One* destination (in that temporal order)
108
+ - First phase: Source scatters to multiple intermediaries
109
+ - Second phase: Intermediaries gather to final destination
110
+ - Creates layering through multiple parallel paths.
111
+ - STACK / LAYERING: Sequential hops through multiple accounts (linear chain). The purpose is typically to obscure the \
112
+ origin through distance/complexity.
113
+ - CYCLE: Funds return to their origin point, creating a circular flow.
114
+ - BIPARTITE: Structured flows between two distinct, segregated groups with no within-group transactions. The segregation \
115
+ and lack of within-group transactions is the defining characteristic. It's not just two-way flows, it's structured \
116
+ isolation between groups.
117
+ - RANDOM: Complex pattern with no discernible structure. Use only when activity is clearly suspicious but doesn't fit \
118
+ other typologies.
119
+ - NONE: No laundering pattern is supported by evidence in the investigation window.
120
+
121
+ ## Output Format
122
+ Return a single JSON object matching the configured output schema exactly. Populate every field.
123
+ Use `pattern_type = "NONE"` when no laundering pattern is supported by evidence in the investigation window.
124
+
125
+ **Rules for flagging transactions IDs**:
126
+ - **Causal Chain Only**: Include *only* the transactions that form the identified laundering pattern.
127
+ - **Exclude Noise**: If an account has more transactions but only 3 are part of the laundering chain, output *only* those 3 IDs.
128
+ - When flagging transaction IDs, the seed transaction should be the last transaction in the chain (i.e., the most recent transaction), \
129
+ since the investigation window ends with the seed transaction.
130
+
131
+ ## Handling Uncertainty
132
+ If you lack sufficient information to make a determination, explicitly state what data is missing. \
133
+ Do not fabricate transaction details or make unsupported inferences. When uncertain between benign and suspicious, \
134
+ default to "NONE" and document why evidence is insufficient
135
+ """
136
+
137
+
138
+ def create_aml_investigation_agent(
139
+ name: str = "AmlInvestigationAnalyst",
140
+ *,
141
+ description: str | None = None,
142
+ instructions: str | None = None,
143
+ temperature: float | None = None,
144
+ top_p: float | None = None,
145
+ top_k: float | None = None,
146
+ max_output_tokens: int | None = None,
147
+ presence_penalty: float | None = None,
148
+ frequency_penalty: float | None = None,
149
+ seed: int | None = None,
150
+ before_agent_callback: BeforeAgentCallback | None = None,
151
+ after_agent_callback: AfterAgentCallback | None = None,
152
+ before_model_callback: BeforeModelCallback | None = None,
153
+ after_model_callback: AfterModelCallback | None = None,
154
+ timeout_sec: int | None = None,
155
+ enable_tracing: bool = True,
156
+ ) -> LlmAgent:
157
+ """Create a configured AML investigation agent.
158
+
159
+ This factory builds a Google ADK ``LlmAgent`` with domain-specific instructions,
160
+ read-only SQL tools, and a strict structured output schema.
161
+
162
+ Parameters
163
+ ----------
164
+ name : str, default="AmlInvestigationAnalyst"
165
+ Name assigned to the agent. This name appears in traces and logs and can
166
+ help distinguish multiple agents in a shared environment.
167
+ description : str | None, optional
168
+ Optional short description of the agent's purpose. If not provided, a
169
+ default AML investigation description is used.
170
+ instructions : str | None, optional
171
+ Optional system prompt for the agent. If omitted, the module-level
172
+ ``ANALYST_PROMPT`` is used.
173
+ temperature : float | None, optional
174
+ Sampling temperature for model generation. ``None`` uses provider/model
175
+ defaults.
176
+ top_p : float | None, optional
177
+ Nucleus sampling parameter. ``None`` uses provider/model defaults.
178
+ top_k : float | None, optional
179
+ Top-k sampling parameter. ``None`` uses provider/model defaults.
180
+ max_output_tokens : int | None, optional
181
+ Maximum number of tokens the model can generate in a single response.
182
+ ``None`` uses provider/model defaults.
183
+ presence_penalty : float | None, optional
184
+ Penalty to encourage introducing new tokens. ``None`` uses
185
+ provider/model defaults.
186
+ frequency_penalty : float | None, optional
187
+ Penalty to discourage repeated tokens. ``None`` uses provider/model
188
+ defaults.
189
+ seed : int | None, optional
190
+ Optional random seed for more repeatable generations where supported by
191
+ the model/provider.
192
+ before_agent_callback : BeforeAgentCallback | None, optional
193
+ Callback executed before each agent run.
194
+ after_agent_callback : AfterAgentCallback | None, optional
195
+ Callback executed after each agent run.
196
+ before_model_callback : BeforeModelCallback | None, optional
197
+ Callback executed before each model call.
198
+ after_model_callback : AfterModelCallback | None, optional
199
+ Callback executed after each model call.
200
+ timeout_sec : int | None, optional
201
+ Optional timeout in seconds for model calls. If specified, model calls
202
+ that exceed this duration will be cancelled.
203
+ enable_tracing : bool, optional, default=True
204
+ Whether to initialize Langfuse tracing for this agent. If ``True``, Langfuse
205
+ tracing is initialized with the agent's name as the service name.
206
+
207
+ Returns
208
+ -------
209
+ LlmAgent
210
+ Configured AML investigation agent with:
211
+
212
+ - Planner model from global configuration.
213
+ - Read-only SQL tools for schema and query execution.
214
+ - ``AnalystOutput`` as the enforced response schema.
215
+ - Reasoning/thought collection enabled through thinking config.
216
+
217
+ Examples
218
+ --------
219
+ >>> # Build the agent with defaults:
220
+ >>> agent = create_aml_investigation_agent()
221
+ >>> isinstance(agent, LlmAgent)
222
+ True
223
+ >>> # Build the agent with a custom name and deterministic settings:
224
+ >>> agent = create_aml_investigation_agent(
225
+ ... name="aml_eval_agent",
226
+ ... temperature=0.0,
227
+ ... seed=42,
228
+ ... )
229
+ >>> agent.name
230
+ 'aml_eval_agent'
231
+ """
232
+ # Get the client manager singleton instance
233
+ client_manager = AsyncClientManager.get_instance()
234
+ db = DbManager().aml_db(agent_name=name)
235
+
236
+ # Initialize tracing if enabled and a name is provided
237
+ if enable_tracing:
238
+ init_tracing(service_name=name)
239
+
240
+ return LlmAgent(
241
+ name=name,
242
+ description=description or _DEFAULT_AGENT_DESCRIPTION,
243
+ before_agent_callback=before_agent_callback,
244
+ after_agent_callback=after_agent_callback,
245
+ model=client_manager.configs.default_planner_model,
246
+ instruction=instructions or ANALYST_PROMPT,
247
+ tools=[FunctionTool(db.get_schema_info), FunctionTool(db.execute)],
248
+ generate_content_config=GenerateContentConfig(
249
+ http_options=HttpOptions(timeout=timeout_sec * 1000) if timeout_sec is not None else None,
250
+ temperature=temperature,
251
+ top_p=top_p,
252
+ top_k=top_k,
253
+ max_output_tokens=max_output_tokens,
254
+ presence_penalty=presence_penalty,
255
+ frequency_penalty=frequency_penalty,
256
+ seed=seed,
257
+ thinking_config=ThinkingConfig(include_thoughts=True),
258
+ ),
259
+ output_schema=AnalystOutput,
260
+ before_model_callback=before_model_callback,
261
+ after_model_callback=after_model_callback,
262
+ )
@@ -0,0 +1,28 @@
1
+ """Data models and utilities for AML investigation agent."""
2
+
3
+ from .cases import AnalystOutput, CaseFile, CaseRecord, GroundTruth, LaunderingPattern, build_cases, parse_patterns_file
4
+ from .utils import (
5
+ Filenames,
6
+ IllicitRatios,
7
+ TransactionsSizes,
8
+ apply_lookback_window,
9
+ download_dataset_file,
10
+ normalize_transactions_data,
11
+ )
12
+
13
+
14
+ __all__ = [
15
+ "AnalystOutput",
16
+ "CaseFile",
17
+ "CaseRecord",
18
+ "Filenames",
19
+ "IllicitRatios",
20
+ "LaunderingPattern",
21
+ "TransactionsSizes",
22
+ "GroundTruth",
23
+ "apply_lookback_window",
24
+ "build_cases",
25
+ "parse_patterns_file",
26
+ "download_dataset_file",
27
+ "normalize_transactions_data",
28
+ ]