Spaces:
Sleeping
Sleeping
| title: API Triage Agent | |
| emoji: π€ | |
| colorFrom: blue | |
| colorTo: purple | |
| sdk: docker | |
| pinned: false | |
| # API Triage Agent | |
| ## Environment Description : | |
| An AI agent that diagnoses and resolves API integration failures by inspecting logs, identifying error types, and taking corrective actions. Simulates real-world API debugging scenarios. | |
| ## Motivation | |
| API failures are common in production. This environment teaches an agent to handle authentication errors, missing fields, rate limits, wrong endpoints, and server errors β just like a real support engineer. | |
| ## Action Space (8 actions) | |
| | Action | Description | | |
| |--------|-------------| | |
| | `inspect_logs` | Examine error logs for clues | | |
| | `inspect_request` | Check the failed API request | | |
| | `refresh_token` | Fix authentication errors (401) | | |
| | `add_field` | Add missing required fields (400) | | |
| | `wait_retry` | Handle rate limits (429) and timeouts (408) | | |
| | `change_endpoint` | Fix wrong API endpoint (404) | | |
| | `escalate` | Report server errors (500) to human | | |
| | `resolve` | End episode after successful fix | | |
| ## Observation Space | |
| | Field | Type | Description | | |
| |-------|------|-------------| | |
| | `step` | int | Current step number | | |
| | `max_steps` | int | Maximum steps allowed (10) | | |
| | `incident_summary` | str | Short problem description | | |
| | `logs` | list | Error messages from API | | |
| | `response_code` | int | HTTP status code | | |
| | `fix_applied` | bool | Whether fix has been applied | | |
| | `is_resolved` | bool | Whether episode ended | | |
| ## Tasks (Easy β Medium β Hard) | |
| ### Easy Task: Authentication Error | |
| - **Incident:** `auth_error` | |
| - **Correct fix:** `refresh_token` β `resolve` | |
| - **Score achieved:** 1.0 | |
| ### Medium Task: Missing Field Error | |
| - **Incident:** `missing_fields` | |
| - **Correct fix:** `add_field` β `resolve` | |
| - **Score achieved:** 1.0 | |
| ### Hard Task: Server Error | |
| - **Incident:** `server_error` | |
| - **Correct fix:** `escalate` β `resolve` | |
| - **Score achieved:** 1.0 | |
| ## Reward System (5 factors) | |
| | Factor | Reward | | |
| |--------|--------| | |
| | Correct fix action | +5 | | |
| | Wrong action | -2 | | |
| | Diagnostic action | +0.5 | | |
| | Resolve with fix (success) | +15 | | |
| | Resolve without fix | -10 | | |
| | Max steps reached | -5 | | |
| ## Setup Instructions | |
| ### 1. Create virtual environment | |
| ```bash | |
| python -m venv venv | |
| source venv/bin/activate # Linux/Mac | |
| venv\Scripts\activate # Windows | |
| # 2. must do (install dependencies) - pip install -r requirements.txt | |
| # also run these : python demo.py , pytest tests/test_env.py -v , python tests/test_graders.py , openenv validate | |