Spaces:
Sleeping
Sleeping
| """Client for the API Triage Agent environment. | |
| Implements the EnvClient interface for connecting to the | |
| API Triage environment server over HTTP. | |
| """ | |
| try: | |
| from openenv.core.env_client import EnvClient | |
| class APITriageClient(EnvClient): | |
| """Client for the API Triage Agent OpenEnv environment.""" | |
| pass | |
| except ImportError: | |
| # Fallback if openenv-core not installed locally | |
| class APITriageClient: # type: ignore | |
| """Stub client for local development without openenv-core.""" | |
| def __init__(self, base_url: str = "http://localhost:7860"): | |
| self.base_url = base_url | |
| def reset(self): | |
| import requests | |
| return requests.post(f"{self.base_url}/reset").json() | |
| def step(self, action: str): | |
| import requests | |
| return requests.post( | |
| f"{self.base_url}/step", | |
| json={"action": action} | |
| ).json() | |
| def state(self): | |
| import requests | |
| return requests.get(f"{self.base_url}/state").json() | |