The AI agent provides a natural language interface to AWS Verified Permissions, allowing you to ask questions about access permissions without constructing manual API calls.
How It Works
The AI agent architecture keeps your Anthropic API key secure while providing intelligent access checking:Security Note: Your Anthropic API Key is stored as an encrypted environment variable in Lambda and is never exposed to the frontend.
Prerequisites
Deploy with Anthropic API Key
During SAM deployment, you must provide a valid Anthropic API Key:When prompted for
AnthropicApiKey, enter your key starting with sk-ant-.Ensure API credits
Your Anthropic account needs available credits:
- Minimum recommended: $5
- Get credits at console.anthropic.com
- The demo uses Claude Haiku (~$0.25 per 1M tokens)
Update frontend configuration
Make sure
frontend/avp-agent.html has your correct API Gateway URL (see Running the Demo).Accessing the Agent
With the local server running:Example Queries
The agent understands natural language questions about AWS Verified Permissions access. Here are example queries you can try:Single User Access Checks
Can Alice read the Q4 report?
Can Alice read the Q4 report?
- Identify the user: Alice (alice)
- Identify the action: Read
- Identify the resource: Q4-Report-2024
- Call AVP to check access
- Return the decision with explanation
Check Bob's delete permissions
Check Bob's delete permissions
- User: bob
- Action: Delete
- Resource: HR-Payroll-2024
Carol's access to Sales Dashboard
Carol's access to Sales Dashboard
Multi-User Queries
Compare all users for one resource
Compare all users for one resource
- Recognize this requires checking multiple users
- Test Alice, Bob, and Carol
- Test Read, Edit, and Delete actions
- Present a comparative summary
Who can edit what?
Who can edit what?
Analytical Queries
Audit a specific user
Audit a specific user
Find permission gaps
Find permission gaps
Cross-department access check
Cross-department access check
Understanding Agent Responses
The agent interface displays two key sections:Chat Area
Shows the conversation between you and the agent:- Your queries in standard text
- Agent responses with authorization decisions
- Explanations of why AVP made each decision
Reasoning Log
Displays the agent’s internal process:- How it interpreted your question
- Which tools it decided to use
- API calls to AVP with parameters
- Raw AVP responses (ALLOW/DENY)
- Synthesis of multiple checks
Available Users and Resources
The agent has access to these demo entities:Users
| ID | Name | Role | Department | Clearance |
|---|---|---|---|---|
alice | Alice Garcia | Analyst | Finance | 2 |
bob | Bob Torres | Admin | Finance | 3 |
carol | Carol Mendez | Auditor | HR | 1 |
Resources
| ID | Department | Classification |
|---|---|---|
Q4-Report-2024 | Finance | confidential |
HR-Payroll-2024 | HR | restricted |
Sales-Dashboard | Sales | internal |
Actions
Read- View accessEdit- Modify accessDelete- Deletion rights
How the Agent Reasons
The agent uses Claude Haiku with tool calling capabilities:Parse natural language
Your query is sent to Claude, which extracts:
- User identifiers (names or roles)
- Actions (verbs like “read”, “edit”, “delete”)
- Resources (document names)
- Query type (single check vs. audit)
Plan tool calls
The agent decides which AVP checks are needed:
- Single user + resource + action = 1 call
- “All users” = 3 calls (alice, bob, carol)
- “All actions” = 3 calls (Read, Edit, Delete)
- “Everything” = 9 calls (3 users × 3 actions)
Execute checks
For each needed check, the agent calls the This invokes Lambda → AVP → returns ALLOW or DENY
check_avp_access tool:Agent Limitations
Maximum Iterations
The agent has a maximum of 10 reasoning iterations (see agent.py:133). Complex queries with many checks may hit this limit.Language
By default, the agent responds in Spanish. To change this, modify the system prompt inlambda/agent.py:128:
Cost Considerations
Each query to the agent incurs:| Component | Cost per Query | Notes |
|---|---|---|
| Lambda execution | ~$0.0000002 | Usually Free Tier |
| AVP IsAuthorized | ~$0.00000015 | Per check (3-9 checks typical) |
| Anthropic API | ~$0.001-0.005 | Claude Haiku, depends on response length |
Troubleshooting
Agent returns 'Error in Anthropic API'
Agent returns 'Error in Anthropic API'
Causes:
- Invalid or expired API key
- Insufficient credits in Anthropic account
- API key not configured during deployment
- Verify your key at console.anthropic.com
- Check account credits
- Redeploy with valid key:
Agent says 'Usuario no existe'
Agent says 'Usuario no existe'
You referenced a user that doesn’t exist in the demo. Valid users are:
alice(Alice Garcia)bob(Bob Torres)carol(Carol Mendez)
Reasoning log shows tool errors
Reasoning log shows tool errors
Check the log for specific error messages:
- “Recurso no existe”: Resource name incorrect (use Q4-Report-2024, HR-Payroll-2024, or Sales-Dashboard)
- “Error en AVP”: Check Policy Store ID is correct
- “Error interno”: Lambda execution error, check CloudWatch logs
Agent gives incomplete answers
Agent gives incomplete answers
The agent may hit the 10-iteration limit for very complex queries. Try:
- Breaking your question into smaller parts
- Being more specific (“Alice’s access to Q4 report” vs. “what can everyone do?”)
- Asking follow-up questions instead of one large query
Next Steps
Demo Scenarios
Complete walkthrough of all authorization scenarios
Cleanup
Remove demo infrastructure when finished