Skip to content

Commit 610c282

Browse files
committed
Merge branch 'feature/code-intel-gql-subscription' into 'develop'
Agent Companion Chat Experience See merge request genaiic-reusable-assets/engagement-artifacts/genaiic-idp-accelerator!391
2 parents 82e6045 + c5e18ae commit 610c282

File tree

66 files changed

+8610
-2344
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+8610
-2344
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ White-glove customization, deployment, and integration support for production us
4747
- **AI-Powered Evaluation**: Framework to assess accuracy against baseline data
4848
- **Extraction Confidence Assessment**: LLM-powered assessment of extraction confidence with multimodal document analysis
4949
- **Document Knowledge Base Query**: Ask questions about your processed documents
50+
- **IDP Accelerator Help Chat Bot**: Ask questions about the IDP code base or features
5051

5152
## Architecture Overview
5253

@@ -170,6 +171,7 @@ For detailed deployment and testing instructions, see the [Deployment Guide](./d
170171
- [Evaluation Framework](./docs/evaluation.md) - Accuracy assessment system with analytics database and reporting
171172
- [Knowledge Base](./docs/knowledge-base.md) - Document knowledge base query feature
172173
- [Monitoring](./docs/monitoring.md) - Monitoring and logging capabilities
174+
- [IDP Accelerator Help Chat Bot](./docs/code-intelligence.md) - Chat bot for asking question about the IDP code base and features
173175
- [Reporting Database](./docs/reporting-database.md) - Analytics database for evaluation metrics and metering data
174176
- [Troubleshooting](./docs/troubleshooting.md) - Troubleshooting and performance guides
175177

docs/agent-analysis.md

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ The Agent Analysis feature provides intelligent data exploration and analysis ca
1818
- **Secure Code Execution**: Python visualization code runs in isolated AWS Bedrock AgentCore sandboxes
1919
- **MCP Integration**: Connect external systems and tools via Model Context Protocol (MCP) servers
2020

21-
2221
https://github.com/user-attachments/assets/e2dea2c5-5eb1-42f6-9af5-469afd2135a7
2322

24-
2523
## Key Features
2624

2725
- **Multi-Agent System**: Specialized agents for different types of queries (analytics, calculations, etc.)
@@ -49,7 +47,6 @@ The Agent Analysis feature uses a multi-agent architecture with:
4947
2. **Analytics Agent**: Handles data analysis, SQL generation, and visualization creation
5048
3. **External MCP Agents**: Custom agents connected via Model Context Protocol servers
5149

52-
5350
### Agent Workflow
5451

5552
1. **Question Processing**: User submits a natural language question through the web UI
@@ -85,7 +82,7 @@ The Agent Analysis feature implements a security-first design:
8582
```
8683
User Question → Analytics Request Handler → Analytics Processor → Agent Tools:
8784
├── Database Info Tool
88-
├── Athena Query Tool
85+
├── Athena Query Tool
8986
├── Code Sandbox Tool
9087
└── Python Execution Tool
9188
@@ -97,24 +94,28 @@ Results ← Web UI ← AppSync Subscription ← DynamoDB ← Agent Response
9794
The analytics agent has access to four specialized tools:
9895

9996
### 1. Database Information Tool
97+
10098
- **Purpose**: Discovers database schema and table structures
10199
- **Usage**: Automatically called to understand available tables and columns
102100
- **Output**: Table names, column definitions, and data types
103101

104102
### 2. Athena Query Tool
103+
105104
- **Purpose**: Executes SQL queries against the analytics database
106-
- **Features**:
105+
- **Features**:
107106
- Automatic column name quoting for Athena compatibility
108107
- Query result storage in S3
109108
- Error handling and retry logic
110109
- Support for both exploratory and final queries
111110

112111
### 3. Code Sandbox Tool
112+
113113
- **Purpose**: Securely transfers query results to AgentCore sandbox
114114
- **Security**: Isolated environment with no Lambda file system access
115115
- **Data Format**: CSV files containing query results
116116

117117
### 4. Python Execution Tool
118+
118119
- **Purpose**: Generates visualizations and tables from query data
119120
- **Libraries**: Pandas, Matplotlib, and other standard Python libraries
120121
- **Output**: JSON-formatted charts and tables for web display
@@ -132,23 +133,27 @@ The analytics agent has access to four specialized tools:
132133
The Agent Analysis interface allows you to select from multiple available agents:
133134

134135
**Multi-Agent Selection:**
136+
135137
- Select multiple agents simultaneously for complex analysis workflows
136138
- Use "Select All Agents" / "Deselect All Agents" for bulk selection
137139
- Each agent brings specialized capabilities to your analysis
138140

139141
**Available Agent Types:**
142+
140143
- **Analytics Agent**: Database queries, SQL generation, and data visualization
141-
- **Dummy Agent**: Simple calculations and testing capabilities
144+
- **Dummy Agent**: Simple calculations and testing capabilities
142145
- **External MCP Agents**: Custom tools and systems integrated via MCP servers
143146

144147
**Agent Selection Tips:**
148+
145149
- Select specific agents when you know what type of analysis you need
146150
- Choose multiple agents for comprehensive analysis requiring different capabilities
147151
- The system intelligently routes your question to the most appropriate selected agents
148152

149153
### MCP Integration
150154

151155
**Custom System Integration:**
156+
152157
- Click "🚀 NEW: Integrate your own systems with MCP!" to learn about connecting external tools
153158
- Add custom agents without code changes or redeployments
154159
- Integrate APIs, databases, and specialized tools via Model Context Protocol servers
@@ -160,21 +165,25 @@ For detailed MCP setup instructions, see the [Custom MCP Agent Documentation](./
160165
The agent can answer various types of questions about your processed documents:
161166

162167
**Document Volume Questions:**
168+
163169
- "How many documents were processed last month?"
164170
- "What's the trend in document processing over time?"
165171
- "Which document types are most common?"
166172

167173
**Processing Performance Questions:**
174+
168175
- "What's the average processing time by document type?"
169176
- "Which documents failed processing and why?"
170177
- "Show me processing success rates by day"
171178

172179
**Content Analysis Questions:**
180+
173181
- "What are the most common vendor names in invoices?"
174182
- "Show me the distribution of invoice amounts"
175183
- "Which documents have the highest confidence scores?"
176184

177185
**Comparative Analysis Questions:**
186+
178187
- "How do confidence scores vary by document type?"
179188
- "What's the relationship between document size and processing time?"
180189

@@ -203,6 +212,7 @@ The agent can return three types of results:
203212
3. **Text Responses**: Direct answers to simple questions
204213

205214
Each result includes:
215+
206216
- The original question
207217
- SQL queries that were executed
208218
- The final visualization or answer
@@ -213,6 +223,7 @@ Each result includes:
213223
The solution includes sample W2 tax documents for testing the analytics feature:
214224

215225
### Sample Documents Location
226+
216227
- **Path**: `/samples/w2/`
217228
- **Files**: 20 sample W2 documents (W2_XL_input_clean_1000.pdf through W2_XL_input_clean_1019.pdf)
218229
- **Purpose**: Realistic test data for exploring analytics capabilities
@@ -221,21 +232,24 @@ The solution includes sample W2 tax documents for testing the analytics feature:
221232
### Testing Steps
222233

223234
1. **Upload Sample Documents**:
235+
224236
- Use the Web UI to upload documents from the `/samples/w2/` folder
225237
- Or copy them directly to the S3 input bucket
226238

227239
2. **Wait for Processing**:
240+
228241
- Monitor document processing through the Web UI dashboard
229242
- Ensure all documents complete successfully
230243

231244
3. **Try Sample Queries**:
245+
232246
```
233247
"How many W2 documents have been processed?"
234-
248+
235249
"Make a bar chart histogram of total earnings in all W2s with bins $25000 wide"
236-
250+
237251
"What employee from the state of California paid the most tax?"
238-
252+
239253
"What is the ratio of state tax paid to federal tax paid for the following states: Vermont, Nevada, Indiana, and Oregon?"
240254
```
241255

@@ -244,14 +258,16 @@ The solution includes sample W2 tax documents for testing the analytics feature:
244258
The Agent Analysis feature is configured through CloudFormation parameters:
245259

246260
### Model Selection
261+
247262
```yaml
248-
DocumentAnalysisAgentModelId:
263+
ChatCompanionModelId:
249264
Type: String
250265
Default: "us.anthropic.claude-3-7-sonnet-20250219-v1:0"
251266
Description: Model to use for Document Analysis Agent (analytics queries)
252267
```
253268
254269
**Supported Models:**
270+
255271
- `us.anthropic.claude-3-7-sonnet-20250219-v1:0` (Default - Recommended)
256272
- `us.anthropic.claude-3-5-sonnet-20241022-v2:0`
257273
- `us.anthropic.claude-3-haiku-20240307-v1:0`
@@ -261,6 +277,7 @@ DocumentAnalysisAgentModelId:
261277
### Infrastructure Components
262278

263279
The feature automatically creates:
280+
264281
- **DynamoDB Table**: Tracks analytics job status and results
265282
- **Lambda Functions**: Request handler and processor functions
266283
- **AppSync Resolvers**: GraphQL API endpoints for web UI integration
@@ -269,10 +286,11 @@ The feature automatically creates:
269286
### Environment Variables
270287

271288
Key configuration settings:
289+
272290
- `ANALYTICS_TABLE`: DynamoDB table for job tracking
273291
- `ATHENA_DATABASE`: Database containing processed document data
274292
- `ATHENA_OUTPUT_LOCATION`: S3 location for query results
275-
- `DOCUMENT_ANALYSIS_AGENT_MODEL_ID`: AI model for agent processing
293+
- `CHAT_COMPANION_MODEL_ID`: AI model for agent processing
276294

277295
## Best Practices
278296

@@ -295,21 +313,25 @@ Key configuration settings:
295313
### Common Issues
296314

297315
**Agent Not Responding:**
316+
298317
- Check CloudWatch logs for the Analytics Processor Lambda function
299318
- Verify Bedrock model access is enabled for your selected model
300319
- Ensure sufficient Lambda timeout (15 minutes) for complex queries
301320

302321
**SQL Query Errors:**
322+
303323
- Agent automatically retries failed queries up to 5 times
304324
- Check that column names are properly quoted in generated SQL
305325
- Verify database permissions for Athena access
306326

307327
**Visualization Errors:**
328+
308329
- Check that query results contain expected data types
309330
- Verify Python code generation in AgentCore sandbox
310331
- Review agent messages for detailed error information
311332

312333
**Performance Issues:**
334+
313335
- Consider using simpler queries for large datasets
314336
- Try breaking complex questions into smaller parts
315337
- Monitor Athena query performance and optimize if needed
@@ -333,6 +355,7 @@ The Agent Analysis feature uses several AWS services that incur costs:
333355
- **Amazon DynamoDB**: Storage and request costs for job tracking
334356

335357
To optimize costs:
358+
336359
- Choose appropriate Bedrock models based on accuracy vs. cost requirements
337360
- Monitor usage through AWS Cost Explorer
338361

@@ -341,11 +364,13 @@ To optimize costs:
341364
The Agent Analysis feature has access to _all_ tables that the GenAIIDP stores in Athena. Therefore it integrates seamlessly with other GenAIIDP capabilities:
342365

343366
### Evaluation Framework Integration
367+
344368
- Query evaluation metrics and accuracy scores
345369
- Analyze patterns in document processing quality
346370
- Compare performance across different processing patterns
347371

348372
### Assessment Feature Integration
373+
349374
- Explore confidence scores across document types
350375
- Identify low-confidence extractions requiring review
351376
- Analyze relationships between confidence and accuracy

0 commit comments

Comments
 (0)