Spaces:
Sleeping
Sleeping
| """ | |
| Data models for the Shopify Store Audit & Remediation Environment. | |
| Defines the Action and Observation types that agents use to interact | |
| with a simulated Shopify store, mirroring real Admin GraphQL API patterns. | |
| """ | |
| from typing import Any, Dict, List | |
| from openenv.core.env_server.types import Action, Observation | |
| from pydantic import Field | |
| class ShopifyStoreAuditAction(Action): | |
| """Agent action that mirrors a Shopify Admin API operation. | |
| Commands map to real Shopify GraphQL mutations/queries: | |
| - query_products, query_product β products / product query | |
| - query_collections, query_collection β collections query | |
| - query_inventory β inventoryLevels query | |
| - query_orders β orders query | |
| - query_store_health β custom diagnostic summary | |
| - update_product β productUpdate mutation | |
| - update_variant β productVariantUpdate mutation | |
| - update_product_seo β productUpdate (seo fields) | |
| - update_image_alt_text β productImageUpdate mutation | |
| - update_collection β collectionUpdate mutation | |
| - add_product_to_collection β collectionAddProducts mutation | |
| - remove_product_from_collection β collectionRemoveProducts mutation | |
| - adjust_inventory β inventoryAdjustQuantities mutation | |
| - update_metafield β metafieldsSet mutation | |
| - publish_product β publishablePublish mutation | |
| """ | |
| command: str = Field( | |
| ..., | |
| description="API command to execute, e.g. 'query_products', 'update_product'", | |
| ) | |
| params: Dict[str, Any] = Field( | |
| default_factory=dict, | |
| description="Command parameters (varies by command)", | |
| ) | |
| class ShopifyStoreAuditObservation(Observation): | |
| """Observation returned after each environment step. | |
| Contains both human-readable feedback and structured data so that | |
| LLM agents can reason about the store state and decide next actions. | |
| """ | |
| message: str = Field(default="", description="Human-readable result description") | |
| data: Dict[str, Any] = Field( | |
| default_factory=dict, description="Structured API response data" | |
| ) | |
| issues_remaining: int = Field(default=0, description="Unfixed issues count") | |
| issues_fixed: int = Field(default=0, description="Issues fixed so far") | |
| total_issues: int = Field(default=0, description="Total issues in this task") | |
| store_health_score: float = Field( | |
| default=0.0, description="Store health 0.0-1.0" | |
| ) | |
| available_commands: List[str] = Field( | |
| default_factory=list, description="Commands the agent can use" | |
| ) | |
| task_name: str = Field(default="", description="Current task identifier") | |