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
19 changes: 6 additions & 13 deletions prow/agent-workflows/agents/ack_model_agent/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

A. OPERATION ANALYSIS
- Identify all available operations for the resource
- Classify operations by type (create, read, update, delete, list, tag operations)
- Classify operations by type (create, read, update, delete, tag operations)
- Extract ALL input/output fields for each operation (not just shape names)
- Document complete field structures including nested objects
- Determine required vs optional parameters with constraints
Expand Down Expand Up @@ -67,14 +67,12 @@
Create these comprehensive data structures with COMPLETE field analysis:

# Core Operations Inventory
In case there are multiple operations with the same name, choose the one that is most similar to the other operations. Prefer single resource operations over multiple resource operations unless that leads to a mismatch in the field names.
operations_catalog = {
"create_operations": ["CreateRepository", "PutRepository"],
"read_operations": ["GetRepository", "DescribeRepository", "DescribeRepositories"],
"update_operations": ["UpdateRepository", "ModifyRepository"],
"create_operations": ["CreateRepository"],
"read_operations": ["GetRepository"], (prefer "Get" over "Describe")
"update_operations": ["UpdateRepository"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this have a similar "(prefer "Update" over "Modify") hint?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually there is only one update call, READ tends to have read one and read many, but we can never be sure with these. We can add it if we see it missing updates..

"delete_operations": ["DeleteRepository"],
"tag_operations": ["TagResource", "UntagResource", "GetTagsForResource"],
"other_operations": ["GetRepositoryPolicy", "SetRepositoryPolicy"]
"tag_operations": ["TagResource", "UntagResource", "GetTagsForResource"]
}

# Field Catalog with Classifications
Expand Down Expand Up @@ -220,12 +218,7 @@
4. save_error_catalog(error_catalog, service, resource)
5. save_resource_characteristics(resource_characteristics, service, resource)

5. Report Analysis Summary
- Operations discovered and classified
- Field types and characteristics identified
- Error conditions cataloged
- Resource behavior patterns noted
- Data completeness assessment
5. Report Analysis Summary - Small Summary of the the resource files

Response Format:
1. "Analyzing AWS {service} {resource} resource..."
Expand Down
27 changes: 26 additions & 1 deletion prow/agent-workflows/agents/ack_model_agent/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,38 @@ def save_operations_catalog(operations_catalog: Dict[str, List[str]], service: s
"""Save comprehensive catalog of all operations related to the resource.

Args:
operations_catalog: Dictionary mapping operation types to lists of operation names
operations_catalog: Dictionary with exactly these 5 keys:
- create_operations: operation that create the resource
- read_operations: operation that read the resource
- update_operations: operation that update the resource
- delete_operations: operation that delete the resource
- tag_operations: List of operations that manage tags on the resource
service: AWS service name (e.g., 's3', 'dynamodb')
resource: Resource name (e.g., 'Bucket', 'Table')

Returns:
str: Confirmation message with file path where catalog was saved
"""
# Validate that operations_catalog has exactly the required 5 keys
required_keys = {"create_operations", "read_operations", "update_operations", "delete_operations", "tag_operations"}
provided_keys = set(operations_catalog.keys())

if provided_keys != required_keys:
missing_keys = required_keys - provided_keys
extra_keys = provided_keys - required_keys
error_msg = f"Operations catalog must have exactly these 5 keys: {required_keys}."
if missing_keys:
error_msg += f" Missing: {missing_keys}."
if extra_keys:
error_msg += f" Extra: {extra_keys}."
return f"Error: {error_msg}"

# Validate that first 4 keys have exactly 1 operation each
single_operation_keys = {"create_operations", "read_operations", "update_operations", "delete_operations"}
for key in single_operation_keys:
if len(operations_catalog[key]) != 1:
return f"Error: {key} must have exactly 1 operation, got {len(operations_catalog[key])}: {operations_catalog[key]}"

ensure_ack_directories()
resource_dir = ensure_service_resource_directories(service, resource)
cache_file = os.path.join(resource_dir, "operations_catalog.json")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def _load_supported_services(self) -> List[str]:
"""Load the list of supported AWS services from jobs_config.yaml."""
try:
# Go up to test-infra root, then to prow/jobs/jobs_config.yaml
config_path = Path(__file__).parent.parent.parent.parent / "prow" / "jobs" / "jobs_config.yaml"
config_path = Path(__file__).parent.parent.parent.parent / "jobs" / "jobs_config.yaml"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: Were you seeing an issue loading this file?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup!


with open(config_path, 'r') as f:
config = yaml.safe_load(f)
Expand Down