Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion BACKLOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,4 @@
| D25 | P1 | @dev | merged | Bump version to 0.3.0 — update CHANGELOG.md, pyproject.toml, add governance to README |
| T14 | P1 | @tester | merged | Write tests for governance extraction (Guardrail classification, ToolPermission, L3 annotations) |
| T15 | P1 | @tester | merged | Write tests for audit engine (GPR-L1/L2/L3 scoring, elevation tracking, CSV/JSON export) |
| T16 | P1 | @tester | in-progress | Write tests for Bedrock + Vertex parsers (fixtures + round-trip with emitters) |
| T16 | P1 | @tester | pr-created | Write tests for Bedrock + Vertex parsers (fixtures + round-trip with emitters) |
8 changes: 8 additions & 0 deletions tests/fixtures/bedrock/bedrock-agent.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"agentName": "CustomerSupportBot",
"description": "An AI-powered customer support agent for e-commerce.",
"instruction": "You are a helpful customer support agent for an e-commerce platform. Help customers with orders, returns, and product questions. Always be polite and professional.",
"foundationModel": "anthropic.claude-3-5-sonnet-20241022-v2:0",
"agentId": "ABCDEF123456",
"agentAliasId": "ALIAS001"
}
36 changes: 36 additions & 0 deletions tests/fixtures/bedrock/cloudformation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
AWSTemplateFormatVersion: "2010-09-09"
Description: AgentShift - Bedrock Agent CloudFormation Template

Resources:
CustomerSupportBotAgent:
Type: AWS::Bedrock::Agent
Properties:
AgentName: CustomerSupportBot
Description: An AI-powered customer support agent for e-commerce.
FoundationModel: anthropic.claude-3-5-sonnet-20241022-v2:0
Instruction: |
You are a helpful customer support agent for an e-commerce platform.
Help customers with orders, returns, and product questions.
Always be polite and professional.
ActionGroups:
- ActionGroupName: order-management
Description: Manage customer orders
ApiSchema:
Payload: '{"openapi":"3.0.0","info":{"title":"Order Management","version":"1.0.0"},"paths":{"/get-order":{"get":{"operationId":"getOrder","description":"Get order details","responses":{"200":{"description":"OK"}}}}}}'
KnowledgeBases:
- KnowledgeBaseId: kb-12345
Description: Product catalog knowledge base

ProductCatalogKB:
Type: AWS::Bedrock::KnowledgeBase
Properties:
Name: product-catalog-kb
Description: Product catalog for e-commerce
StorageConfiguration:
Type: OPENSEARCH_SERVERLESS

Outputs:
AgentId:
Value: PLACEHOLDER_AGENT_ID
AliasId:
Value: PLACEHOLDER_ALIAS_ID
27 changes: 27 additions & 0 deletions tests/fixtures/bedrock/guardrail-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"guardrailId": "GUARD001",
"name": "e-commerce-guardrail",
"topicPolicyConfig": {
"topicsConfig": [
{
"name": "competitor-comparison",
"definition": "Do not make comparisons with or recommendations about competitor products.",
"type": "DENY"
},
{
"name": "political-content",
"definition": "Avoid discussing political topics unrelated to product or service.",
"type": "DENY"
}
]
},
"contentPolicyConfig": {
"filtersConfig": [
{
"type": "HATE",
"inputStrength": "HIGH",
"outputStrength": "HIGH"
}
]
}
}
77 changes: 77 additions & 0 deletions tests/fixtures/bedrock/openapi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"openapi": "3.0.0",
"info": {
"title": "Customer Support Actions",
"version": "1.0.0"
},
"components": {
"securitySchemes": {
"ApiKeyAuth": {
"type": "apiKey",
"name": "X-API-KEY",
"in": "header"
}
}
},
"security": [
{"ApiKeyAuth": []}
],
"paths": {
"/get-order": {
"post": {
"operationId": "getOrder",
"description": "Get details for a specific order by order ID.",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"orderId": {
"type": "string",
"description": "The unique order identifier"
}
},
"required": ["orderId"]
}
}
}
},
"responses": {
"200": {
"description": "Order details"
}
}
}
},
"/process-return": {
"post": {
"operationId": "processReturn",
"description": "Process a return request for an order.",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"orderId": {
"type": "string"
},
"reason": {
"type": "string"
}
},
"required": ["orderId", "reason"]
}
}
}
},
"responses": {
"200": {
"description": "Return confirmation"
}
}
}
}
}
}
21 changes: 21 additions & 0 deletions tests/fixtures/vertex/agent.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "projects/my-project/locations/us-central1/agents/weather-assistant-001",
"displayName": "WeatherAssistant",
"description": "A weather information assistant that provides current conditions and forecasts.",
"goal": "You are a helpful weather assistant. Provide accurate, timely weather information for any location worldwide.",
"instructions": [
"Behavior:\n- Always state the location when reporting weather\n- Include temperature in both Celsius and Fahrenheit\n- Mention precipitation probability",
"Restrictions:\nDo not provide weather advisories or emergency alerts. Refer users to official sources for severe weather.",
"Persona:\nFriendly and concise. Use simple language that non-meteorologists can understand."
],
"defaultLanguageCode": "en",
"tools": [
{
"name": "weather-api-tool",
"description": "Fetch current weather data",
"type": "FUNCTION"
}
],
"createTime": "2024-01-15T10:00:00Z",
"updateTime": "2024-01-20T12:00:00Z"
}
53 changes: 53 additions & 0 deletions tests/fixtures/vertex/tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[
{
"displayName": "Weather API",
"description": "Fetch current weather conditions and forecasts from external weather service.",
"functionDeclarations": [
{
"name": "get_current_weather",
"description": "Get current weather conditions for a location.",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "City name or coordinates"
},
"units": {
"type": "string",
"enum": ["metric", "imperial"],
"description": "Temperature units"
}
},
"required": ["location"]
}
},
{
"name": "get_forecast",
"description": "Get weather forecast for the next N days.",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string"
},
"days": {
"type": "integer",
"description": "Number of days for forecast (1-10)"
}
},
"required": ["location", "days"]
}
}
]
},
{
"displayName": "Weather Data Store",
"description": "Historical weather data store for trend analysis.",
"datastoreSpec": {
"dataStores": [
"projects/my-project/locations/us-central1/collections/default/dataStores/weather-history-ds-001"
]
}
}
]
Loading
Loading