Datasets:
Download runner/agentgridworld/deployment.py from bytkim/AgentGridWorld-Hard: direct link, hf CLI and curl.
- Browser
- Download file 1.04 kB
-
https://huggingface.co/datasets/bytkim/AgentGridWorld-Hard/resolve/main/runner/agentgridworld/deployment.py
- Command line
-
hf download hf://datasets/bytkim/AgentGridWorld-Hard/runner/agentgridworld/deployment.py
-
curl -L -o deployment.py https://huggingface.co/datasets/bytkim/AgentGridWorld-Hard/resolve/main/runner/agentgridworld/deployment.py
1.04 kB
| """Provider receipt only: deliberately outside game observations and model requests.""" | |
| from .model import save | |
| async def record_environment(environment, logs_dir): | |
| image = getattr(environment, '_image', None) | |
| sandbox = getattr(environment, '_sandbox', None) | |
| receipt = {'provider': 'modal' if image is not None else type(environment).__name__, | |
| 'image_id': getattr(image, 'object_id', None), | |
| 'sandbox_id': getattr(sandbox, 'object_id', None)} | |
| if image is not None: | |
| command = "python -c 'import sys,platform,importlib.metadata,json; print(json.dumps({\"python\":sys.version,\"architecture\":platform.machine(),\"packages\":{n:importlib.metadata.version(n) for n in [\"numpy\",\"pycolab\"]}}))'" | |
| result = await environment.exec(command, user='agent', timeout_sec=10) | |
| if result.return_code: | |
| raise RuntimeError('Environment inventory failed') | |
| import json | |
| receipt['runtime'] = json.loads(result.stdout) | |
| save(logs_dir/'environment.json', receipt) | |