abdullah-unknown-world 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- abdullah_unknown_world-0.1.0/LICENSE +21 -0
- abdullah_unknown_world-0.1.0/MANIFEST.in +4 -0
- abdullah_unknown_world-0.1.0/PKG-INFO +56 -0
- abdullah_unknown_world-0.1.0/PUBLISHING.md +20 -0
- abdullah_unknown_world-0.1.0/README.md +26 -0
- abdullah_unknown_world-0.1.0/abdullah_unknown_world/API_REFERENCE.md +39 -0
- abdullah_unknown_world-0.1.0/abdullah_unknown_world/ASSIGNMENT.md +15 -0
- abdullah_unknown_world-0.1.0/abdullah_unknown_world/__init__.py +30 -0
- abdullah_unknown_world-0.1.0/abdullah_unknown_world/cli.py +75 -0
- abdullah_unknown_world-0.1.0/abdullah_unknown_world/client.py +197 -0
- abdullah_unknown_world-0.1.0/abdullah_unknown_world/config.py +33 -0
- abdullah_unknown_world-0.1.0/abdullah_unknown_world/docs/agent_development.md +9 -0
- abdullah_unknown_world-0.1.0/abdullah_unknown_world/docs/api_usage.md +19 -0
- abdullah_unknown_world-0.1.0/abdullah_unknown_world/docs/architecture.md +6 -0
- abdullah_unknown_world-0.1.0/abdullah_unknown_world/docs/challenge_rules.md +12 -0
- abdullah_unknown_world-0.1.0/abdullah_unknown_world/docs/resource_limits.md +10 -0
- abdullah_unknown_world-0.1.0/abdullah_unknown_world/docs/scoring.md +19 -0
- abdullah_unknown_world-0.1.0/abdullah_unknown_world/docs/submission_requirements.md +14 -0
- abdullah_unknown_world-0.1.0/abdullah_unknown_world/examples/basic_agent.py +56 -0
- abdullah_unknown_world-0.1.0/abdullah_unknown_world/examples/multi_agent.py +29 -0
- abdullah_unknown_world-0.1.0/abdullah_unknown_world/exceptions.py +18 -0
- abdullah_unknown_world-0.1.0/abdullah_unknown_world/models/__init__.py +6 -0
- abdullah_unknown_world-0.1.0/abdullah_unknown_world/models/action.py +10 -0
- abdullah_unknown_world-0.1.0/abdullah_unknown_world/models/agent.py +6 -0
- abdullah_unknown_world-0.1.0/abdullah_unknown_world/models/observation.py +24 -0
- abdullah_unknown_world-0.1.0/abdullah_unknown_world/models/resources.py +11 -0
- abdullah_unknown_world-0.1.0/abdullah_unknown_world.egg-info/PKG-INFO +56 -0
- abdullah_unknown_world-0.1.0/abdullah_unknown_world.egg-info/SOURCES.txt +33 -0
- abdullah_unknown_world-0.1.0/abdullah_unknown_world.egg-info/dependency_links.txt +1 -0
- abdullah_unknown_world-0.1.0/abdullah_unknown_world.egg-info/entry_points.txt +2 -0
- abdullah_unknown_world-0.1.0/abdullah_unknown_world.egg-info/requires.txt +7 -0
- abdullah_unknown_world-0.1.0/abdullah_unknown_world.egg-info/top_level.txt +1 -0
- abdullah_unknown_world-0.1.0/pyproject.toml +55 -0
- abdullah_unknown_world-0.1.0/setup.cfg +4 -0
- abdullah_unknown_world-0.1.0/tests/test_package.py +86 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Abdullah Bajwa
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: abdullah-unknown-world
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Student SDK and examples for The Unknown World autonomous exploration challenge.
|
|
5
|
+
Author: Abdullah Bajwa
|
|
6
|
+
Maintainer: Abdullah Bajwa
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: Documentation, https://github.com/getneuralnest/Unknown_World
|
|
9
|
+
Project-URL: Source, https://github.com/getneuralnest/Unknown_World
|
|
10
|
+
Keywords: education,multi-agent,simulation,exploration,oracle
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Education
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Topic :: Education
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: httpx>=0.27
|
|
24
|
+
Requires-Dist: PyYAML>=6.0
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=7.4; extra == "dev"
|
|
27
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
28
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# abdullah-unknown-world
|
|
32
|
+
|
|
33
|
+
Student Python SDK for The Unknown World: Autonomous Multi-Agent Exploration Challenge.
|
|
34
|
+
|
|
35
|
+
This package is prepared for distribution but has **not** been published to PyPI.
|
|
36
|
+
The `pip install abdullah-unknown-world` command will work after an authorized release.
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
python -m pip install abdullah-unknown-world
|
|
40
|
+
unknown-world init my-team
|
|
41
|
+
cd my-team
|
|
42
|
+
python main.py
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from abdullah_unknown_world import OracleClient
|
|
47
|
+
|
|
48
|
+
with OracleClient("https://oracle.example", "team-id", "team-key") as oracle:
|
|
49
|
+
oracle.reset({"obstacle_count": 10, "beacon_count": 6})
|
|
50
|
+
agents = oracle.register_agents(1)
|
|
51
|
+
print(oracle.status())
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Use only instructor-provided official URLs and team credentials. This package never
|
|
55
|
+
contains production seeds, hidden world coordinates, evaluator internals, or instructor
|
|
56
|
+
authentication credentials.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Publishing
|
|
2
|
+
|
|
3
|
+
Do not upload this package without explicit authorization.
|
|
4
|
+
|
|
5
|
+
The package maintainer is Abdullah Bajwa. No verified maintainer email address was
|
|
6
|
+
available in the repository, so none is declared in PyPI metadata.
|
|
7
|
+
|
|
8
|
+
Build and validate:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
python -m pip install --upgrade build twine
|
|
12
|
+
python -m build
|
|
13
|
+
python -m twine check dist/*
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
PyPI publication should use Trusted Publishing. Configure a GitHub Actions
|
|
17
|
+
environment for `pypi`, register the repository and workflow as a PyPI trusted
|
|
18
|
+
publisher, and grant the publish job `id-token: write`. The workflow rebuilds
|
|
19
|
+
and validates the package in the publish job, so it does not depend on GitHub
|
|
20
|
+
Actions artifact storage.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# abdullah-unknown-world
|
|
2
|
+
|
|
3
|
+
Student Python SDK for The Unknown World: Autonomous Multi-Agent Exploration Challenge.
|
|
4
|
+
|
|
5
|
+
This package is prepared for distribution but has **not** been published to PyPI.
|
|
6
|
+
The `pip install abdullah-unknown-world` command will work after an authorized release.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
python -m pip install abdullah-unknown-world
|
|
10
|
+
unknown-world init my-team
|
|
11
|
+
cd my-team
|
|
12
|
+
python main.py
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
from abdullah_unknown_world import OracleClient
|
|
17
|
+
|
|
18
|
+
with OracleClient("https://oracle.example", "team-id", "team-key") as oracle:
|
|
19
|
+
oracle.reset({"obstacle_count": 10, "beacon_count": 6})
|
|
20
|
+
agents = oracle.register_agents(1)
|
|
21
|
+
print(oracle.status())
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Use only instructor-provided official URLs and team credentials. This package never
|
|
25
|
+
contains production seeds, hidden world coordinates, evaluator internals, or instructor
|
|
26
|
+
authentication credentials.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Oracle API Reference
|
|
2
|
+
|
|
3
|
+
The base URL and team credentials are supplied privately by the instructor. Every
|
|
4
|
+
student request uses `X-Team-ID` and `X-API-Key` headers. The SDK sets them for you.
|
|
5
|
+
|
|
6
|
+
## Supported operations
|
|
7
|
+
|
|
8
|
+
| Method | Path | Request | Result |
|
|
9
|
+
|---|---|---|---|
|
|
10
|
+
| POST | `/api/v1/episodes` | Optional dimensions, object counts, sensor parameters and limits | `episode_id`, public world dimensions, `max_steps` |
|
|
11
|
+
| POST | `/api/v1/episodes/{id}/agents` | `{"count": 2}` | `agent_ids` |
|
|
12
|
+
| GET | `/api/v1/episodes/{id}/observations/{agent_id}` | No body | Agent position, dimensions, nearby obstacles, noisy sensor readings, battery, timestamp, done flag |
|
|
13
|
+
| POST | `/api/v1/episodes/{id}/scan` | `{"agent_id":"..."}` | `readings` |
|
|
14
|
+
| POST | `/api/v1/episodes/{id}/state` | `{"agent_id":"...","position":[x,y,z],"timestamp":1}` | `accepted`, `battery` |
|
|
15
|
+
| POST | `/api/v1/episodes/{id}/discoveries` | `{"agent_id":"...","estimate":[x,y,z]}` | `accepted`, `distance_error`, `message` |
|
|
16
|
+
| POST | `/api/v1/episodes/{id}/communications` | `{"sender_id":"...","payload":{...}}` | `accepted`, timestamp, messages used |
|
|
17
|
+
| GET | `/api/v1/episodes/{id}/status` | No body | Episode timestamp, counts, requests and completion |
|
|
18
|
+
| POST | `/api/v1/episodes/{id}/finish` | No body | Episode summary |
|
|
19
|
+
|
|
20
|
+
`position` and `estimate` are three-number coordinate arrays. `timestamp` is a
|
|
21
|
+
non-negative integer step. Status reports current usage but does not disclose
|
|
22
|
+
configured maximum CPU or memory budgets. Ask the instructor for those quotas.
|
|
23
|
+
|
|
24
|
+
## Observation format
|
|
25
|
+
|
|
26
|
+
An observation includes `agent_id`, `timestamp`, `own_position`, `world_dimensions`,
|
|
27
|
+
`nearby_obstacles`, `sensor_readings`, `battery`, and `episode_done`. Sensor readings
|
|
28
|
+
contain `signal_strength`, `estimated_direction`, `confidence`, and `timestamp`.
|
|
29
|
+
Readings are noisy, can be missing or false positives, and may be occluded. They do
|
|
30
|
+
not include actual beacon coordinates.
|
|
31
|
+
|
|
32
|
+
## Errors
|
|
33
|
+
|
|
34
|
+
The SDK raises `OracleAuthenticationError` for authentication failures,
|
|
35
|
+
`OracleRequestError` for rejected requests, `OracleTimeoutError` for timeouts, and
|
|
36
|
+
`OracleConnectionError` when the service cannot be reached.
|
|
37
|
+
|
|
38
|
+
Instructor world, event, report, database, and evaluator endpoints are not student
|
|
39
|
+
endpoints.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Assignment Brief
|
|
2
|
+
|
|
3
|
+
The Unknown World is a 14-day, team-based autonomous exploration challenge for teams
|
|
4
|
+
of 3–4 students. Build an independent 3D simulation and an autonomous agent architecture
|
|
5
|
+
that discovers hidden stationary and mobile beacons.
|
|
6
|
+
|
|
7
|
+
The world is partially observable, dynamic, and uncertain. It may contain buildings,
|
|
8
|
+
walls, corridors, varied terrain, restricted areas, obstacles, and harmless simulated
|
|
9
|
+
environmental hazards. Multiple hidden stationary and mobile beacons act as the
|
|
10
|
+
environmental sources to discover. Sensor observations can be noisy or incomplete.
|
|
11
|
+
Agents have limited sensing, communication, energy, and computation.
|
|
12
|
+
|
|
13
|
+
Teams may use any programming language, framework, algorithm, open-source library,
|
|
14
|
+
or AI coding assistant. The submission must run independently of the Oracle
|
|
15
|
+
SDK implementation and must not reveal or access hidden private data.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
2
|
+
|
|
3
|
+
from .client import OracleClient
|
|
4
|
+
from .exceptions import (
|
|
5
|
+
OracleAuthenticationError,
|
|
6
|
+
OracleConnectionError,
|
|
7
|
+
OracleError,
|
|
8
|
+
OracleRequestError,
|
|
9
|
+
OracleTimeoutError,
|
|
10
|
+
)
|
|
11
|
+
from .models import Action, Agent, Observation, Resources, SensorReading
|
|
12
|
+
|
|
13
|
+
try:
|
|
14
|
+
__version__ = version("abdullah-unknown-world")
|
|
15
|
+
except PackageNotFoundError:
|
|
16
|
+
__version__ = "0.1.0"
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"OracleClient",
|
|
20
|
+
"OracleError",
|
|
21
|
+
"OracleAuthenticationError",
|
|
22
|
+
"OracleRequestError",
|
|
23
|
+
"OracleTimeoutError",
|
|
24
|
+
"OracleConnectionError",
|
|
25
|
+
"Action",
|
|
26
|
+
"Agent",
|
|
27
|
+
"Observation",
|
|
28
|
+
"Resources",
|
|
29
|
+
"SensorReading",
|
|
30
|
+
]
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import sys
|
|
3
|
+
from importlib import resources
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
from . import __version__
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def init_project(name: str) -> Path:
|
|
10
|
+
target = Path(name).resolve()
|
|
11
|
+
if target.exists():
|
|
12
|
+
raise FileExistsError(f"{target} already exists.")
|
|
13
|
+
agents = target / "agents"
|
|
14
|
+
agents.mkdir(parents=True)
|
|
15
|
+
(target / "main.py").write_text(
|
|
16
|
+
"""from abdullah_unknown_world import OracleClient\nfrom abdullah_unknown_world.config import load_config\nfrom agents.explorer import choose_position\n\n\nconfig = load_config(\"config.yaml\")\nwith OracleClient(config.base_url, config.team_id, config.api_key, config.timeout) as oracle:\n episode = oracle.reset({\"obstacle_count\": 10, \"beacon_count\": 6})\n agents = oracle.register_agents(1)\n agent_id = agents[0].agent_id\n\n observation = oracle.observe(agent_id)\n position = choose_position(observation)\n oracle.submit_state(agent_id, position, observation.timestamp + 1)\n print(\"Episode:\", episode[\"episode_id\"])\n print(\"Observation:\", observation)\n print(\"Resources:\", oracle.resources())\n print(\"Status:\", oracle.status())\n print(\"Summary:\", oracle.finish())\n""",
|
|
17
|
+
encoding="utf-8",
|
|
18
|
+
)
|
|
19
|
+
(target / "config.yaml").write_text(
|
|
20
|
+
"""base_url: http://127.0.0.1:8000\nteam_id: replace-with-team-id\napi_key: replace-with-team-key\ntimeout: 10.0\n""",
|
|
21
|
+
encoding="utf-8",
|
|
22
|
+
)
|
|
23
|
+
(target / "requirements.txt").write_text(
|
|
24
|
+
"abdullah-unknown-world\n",
|
|
25
|
+
encoding="utf-8",
|
|
26
|
+
)
|
|
27
|
+
(target / ".gitignore").write_text(
|
|
28
|
+
"config.yaml\n.venv/\n__pycache__/\n*.py[cod]\n",
|
|
29
|
+
encoding="utf-8",
|
|
30
|
+
)
|
|
31
|
+
(target / "README.md").write_text(
|
|
32
|
+
"# Unknown World Team Starter\n\n"
|
|
33
|
+
"Install dependencies and run `python main.py` after the instructor provides "
|
|
34
|
+
"the official Oracle URL and team credentials.\n",
|
|
35
|
+
encoding="utf-8",
|
|
36
|
+
)
|
|
37
|
+
(agents / "explorer.py").write_text(
|
|
38
|
+
"""def choose_position(observation):\n \"\"\"Choose a nearby point not inside a reported obstacle box.\"\"\"\n x, y, z = observation.own_position\n dx, dy, dz = observation.world_dimensions\n candidates = (\n (x + 1.0, y, z), (x, y, z + 1.0), (x - 1.0, y, z),\n (x, y, z - 1.0), (x, y + 1.0, z), (x, y - 1.0, z),\n )\n for point in candidates:\n if any(value < 0 or value > limit for value, limit in zip(point, (dx, dy, dz))):\n continue\n blocked = False\n for obstacle in observation.nearby_obstacles:\n center, size = obstacle[\"center\"], obstacle[\"size\"]\n if all(abs(point[i] - center[i]) <= size[i] / 2 for i in range(3)):\n blocked = True\n break\n if not blocked:\n return point\n raise RuntimeError(\"No nearby legal move found; request a fresh observation.\")\n""",
|
|
39
|
+
encoding="utf-8",
|
|
40
|
+
)
|
|
41
|
+
return target
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def show_example() -> str:
|
|
45
|
+
example = resources.files("abdullah_unknown_world").joinpath(
|
|
46
|
+
"examples/basic_agent.py"
|
|
47
|
+
)
|
|
48
|
+
return example.read_text(encoding="utf-8")
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def main(argv: list[str] | None = None) -> int:
|
|
52
|
+
parser = argparse.ArgumentParser(prog="unknown-world")
|
|
53
|
+
subparsers = parser.add_subparsers(dest="command", required=True)
|
|
54
|
+
|
|
55
|
+
init_parser = subparsers.add_parser("init", help="Create a student starter project")
|
|
56
|
+
init_parser.add_argument("name")
|
|
57
|
+
|
|
58
|
+
subparsers.add_parser("example", help="Display the basic agent example")
|
|
59
|
+
subparsers.add_parser("info", help="Display package and API information")
|
|
60
|
+
|
|
61
|
+
args = parser.parse_args(argv)
|
|
62
|
+
if args.command == "init":
|
|
63
|
+
try:
|
|
64
|
+
target = init_project(args.name)
|
|
65
|
+
except FileExistsError as exc:
|
|
66
|
+
print(exc, file=sys.stderr)
|
|
67
|
+
return 1
|
|
68
|
+
print(f"Created student starter project: {target}")
|
|
69
|
+
elif args.command == "example":
|
|
70
|
+
print(show_example())
|
|
71
|
+
else:
|
|
72
|
+
print(f"abdullah-unknown-world {__version__}")
|
|
73
|
+
print("Official Oracle API: set instructor-provided base_url and team credentials.")
|
|
74
|
+
print("Development example: http://127.0.0.1:8000")
|
|
75
|
+
return 0
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
import httpx
|
|
4
|
+
|
|
5
|
+
from .exceptions import (
|
|
6
|
+
OracleAuthenticationError,
|
|
7
|
+
OracleConnectionError,
|
|
8
|
+
OracleRequestError,
|
|
9
|
+
OracleTimeoutError,
|
|
10
|
+
)
|
|
11
|
+
from .models import Action, Agent, Observation, Resources, SensorReading
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class OracleClient:
|
|
15
|
+
"""Lightweight student client for the Unknown World Oracle API."""
|
|
16
|
+
|
|
17
|
+
def __init__(
|
|
18
|
+
self,
|
|
19
|
+
base_url: str,
|
|
20
|
+
team_id: str,
|
|
21
|
+
api_key: str,
|
|
22
|
+
timeout: float = 10.0,
|
|
23
|
+
):
|
|
24
|
+
if not base_url or not team_id or not api_key:
|
|
25
|
+
raise ValueError("base_url, team_id, and api_key are required.")
|
|
26
|
+
self.base_url = base_url.rstrip("/")
|
|
27
|
+
self.team_id = team_id
|
|
28
|
+
self.timeout = timeout
|
|
29
|
+
self.episode_id: Optional[str] = None
|
|
30
|
+
self._client = httpx.Client(
|
|
31
|
+
base_url=self.base_url,
|
|
32
|
+
timeout=timeout,
|
|
33
|
+
headers={
|
|
34
|
+
"X-Team-ID": team_id,
|
|
35
|
+
"X-API-Key": api_key,
|
|
36
|
+
},
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
def close(self) -> None:
|
|
40
|
+
self._client.close()
|
|
41
|
+
|
|
42
|
+
def __enter__(self) -> "OracleClient":
|
|
43
|
+
return self
|
|
44
|
+
|
|
45
|
+
def __exit__(self, exc_type, exc_value, traceback) -> None:
|
|
46
|
+
self.close()
|
|
47
|
+
|
|
48
|
+
def _request(
|
|
49
|
+
self,
|
|
50
|
+
method: str,
|
|
51
|
+
path: str,
|
|
52
|
+
*,
|
|
53
|
+
json: Optional[dict] = None,
|
|
54
|
+
) -> dict:
|
|
55
|
+
try:
|
|
56
|
+
response = self._client.request(method, path, json=json)
|
|
57
|
+
except httpx.TimeoutException as exc:
|
|
58
|
+
raise OracleTimeoutError(
|
|
59
|
+
f"Oracle timed out after {self.timeout} seconds."
|
|
60
|
+
) from exc
|
|
61
|
+
except httpx.RequestError as exc:
|
|
62
|
+
raise OracleConnectionError("Could not connect to the Oracle.") from exc
|
|
63
|
+
|
|
64
|
+
if response.status_code == 401:
|
|
65
|
+
raise OracleAuthenticationError("Team authentication required.")
|
|
66
|
+
if response.status_code == 403:
|
|
67
|
+
raise OracleAuthenticationError("Invalid team credentials.")
|
|
68
|
+
if not response.is_success:
|
|
69
|
+
try:
|
|
70
|
+
detail = response.json().get("detail", "Oracle request failed.")
|
|
71
|
+
except (ValueError, AttributeError):
|
|
72
|
+
detail = "Oracle request failed."
|
|
73
|
+
raise OracleRequestError(
|
|
74
|
+
f"Oracle returned HTTP {response.status_code}: {detail}"
|
|
75
|
+
)
|
|
76
|
+
return response.json()
|
|
77
|
+
|
|
78
|
+
def _episode_path(self, suffix: str = "") -> str:
|
|
79
|
+
if not self.episode_id:
|
|
80
|
+
raise OracleRequestError("Call reset() before using an episode.")
|
|
81
|
+
return f"/api/v1/episodes/{self.episode_id}{suffix}"
|
|
82
|
+
|
|
83
|
+
def reset(self, config: Optional[dict] = None) -> dict:
|
|
84
|
+
"""Create a new episode and retain its public episode ID."""
|
|
85
|
+
response = self._request(
|
|
86
|
+
"POST",
|
|
87
|
+
"/api/v1/episodes",
|
|
88
|
+
json=config or {},
|
|
89
|
+
)
|
|
90
|
+
self.episode_id = response["episode_id"]
|
|
91
|
+
return response
|
|
92
|
+
|
|
93
|
+
def register_agents(self, count: int) -> tuple[Agent, ...]:
|
|
94
|
+
response = self._request(
|
|
95
|
+
"POST",
|
|
96
|
+
self._episode_path("/agents"),
|
|
97
|
+
json={"count": count},
|
|
98
|
+
)
|
|
99
|
+
return tuple(Agent(agent_id=agent_id) for agent_id in response["agent_ids"])
|
|
100
|
+
|
|
101
|
+
def observe(self, agent_id: str) -> Observation:
|
|
102
|
+
response = self._request(
|
|
103
|
+
"GET",
|
|
104
|
+
self._episode_path(f"/observations/{agent_id}"),
|
|
105
|
+
)
|
|
106
|
+
readings = tuple(
|
|
107
|
+
SensorReading(
|
|
108
|
+
signal_strength=reading["signal_strength"],
|
|
109
|
+
estimated_direction=tuple(reading["estimated_direction"]),
|
|
110
|
+
confidence=reading["confidence"],
|
|
111
|
+
timestamp=reading["timestamp"],
|
|
112
|
+
)
|
|
113
|
+
for reading in response["sensor_readings"]
|
|
114
|
+
)
|
|
115
|
+
return Observation(
|
|
116
|
+
agent_id=response["agent_id"],
|
|
117
|
+
timestamp=response["timestamp"],
|
|
118
|
+
own_position=tuple(response["own_position"]),
|
|
119
|
+
world_dimensions=tuple(response["world_dimensions"]),
|
|
120
|
+
nearby_obstacles=tuple(response["nearby_obstacles"]),
|
|
121
|
+
sensor_readings=readings,
|
|
122
|
+
battery=response["battery"],
|
|
123
|
+
episode_done=response["episode_done"],
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
def scan(self, agent_id: str) -> tuple[SensorReading, ...]:
|
|
127
|
+
response = self._request(
|
|
128
|
+
"POST",
|
|
129
|
+
self._episode_path("/scan"),
|
|
130
|
+
json={"agent_id": agent_id},
|
|
131
|
+
)
|
|
132
|
+
return tuple(
|
|
133
|
+
SensorReading(
|
|
134
|
+
signal_strength=reading["signal_strength"],
|
|
135
|
+
estimated_direction=tuple(reading["estimated_direction"]),
|
|
136
|
+
confidence=reading["confidence"],
|
|
137
|
+
timestamp=reading["timestamp"],
|
|
138
|
+
)
|
|
139
|
+
for reading in response["readings"]
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
def send_action(self, action: Action) -> dict:
|
|
143
|
+
return self.submit_state(
|
|
144
|
+
action.agent_id,
|
|
145
|
+
action.position,
|
|
146
|
+
action.timestamp,
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
def submit_state(
|
|
150
|
+
self,
|
|
151
|
+
agent_id: str,
|
|
152
|
+
position: tuple[float, float, float],
|
|
153
|
+
timestamp: int,
|
|
154
|
+
) -> dict:
|
|
155
|
+
return self._request(
|
|
156
|
+
"POST",
|
|
157
|
+
self._episode_path("/state"),
|
|
158
|
+
json={
|
|
159
|
+
"agent_id": agent_id,
|
|
160
|
+
"position": position,
|
|
161
|
+
"timestamp": timestamp,
|
|
162
|
+
},
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
def report_discovery(
|
|
166
|
+
self,
|
|
167
|
+
agent_id: str,
|
|
168
|
+
estimate: tuple[float, float, float],
|
|
169
|
+
) -> dict:
|
|
170
|
+
return self._request(
|
|
171
|
+
"POST",
|
|
172
|
+
self._episode_path("/discoveries"),
|
|
173
|
+
json={"agent_id": agent_id, "estimate": estimate},
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
def communicate(self, sender_id: str, payload: dict) -> dict:
|
|
177
|
+
return self._request(
|
|
178
|
+
"POST",
|
|
179
|
+
self._episode_path("/communications"),
|
|
180
|
+
json={"sender_id": sender_id, "payload": payload},
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
def status(self) -> dict:
|
|
184
|
+
return self._request("GET", self._episode_path("/status"))
|
|
185
|
+
|
|
186
|
+
def resources(self) -> Resources:
|
|
187
|
+
status = self.status()
|
|
188
|
+
return Resources(
|
|
189
|
+
timestamp=status["timestamp"],
|
|
190
|
+
api_requests=status["api_requests"],
|
|
191
|
+
sensor_requests=status["sensor_requests"],
|
|
192
|
+
communication_messages=status["communication_messages"],
|
|
193
|
+
episode_done=status["episode_done"],
|
|
194
|
+
)
|
|
195
|
+
|
|
196
|
+
def finish(self) -> dict:
|
|
197
|
+
return self._request("POST", self._episode_path("/finish"))
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from dataclasses import asdict, dataclass
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
import yaml
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass(frozen=True)
|
|
9
|
+
class OracleConfig:
|
|
10
|
+
base_url: str
|
|
11
|
+
team_id: str
|
|
12
|
+
api_key: str
|
|
13
|
+
timeout: float = 10.0
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def load_config(path: str | Path) -> OracleConfig:
|
|
17
|
+
with Path(path).open("r", encoding="utf-8") as handle:
|
|
18
|
+
data = yaml.safe_load(handle) or {}
|
|
19
|
+
return OracleConfig(
|
|
20
|
+
base_url=str(data.get("base_url", "")),
|
|
21
|
+
team_id=str(data.get("team_id", "")),
|
|
22
|
+
api_key=str(data.get("api_key", "")),
|
|
23
|
+
timeout=float(data.get("timeout", 10.0)),
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def example_config() -> dict:
|
|
28
|
+
return {
|
|
29
|
+
"base_url": "http://127.0.0.1:8000",
|
|
30
|
+
"team_id": "your-team-id",
|
|
31
|
+
"api_key": "replace-with-your-team-key",
|
|
32
|
+
"timeout": 10.0,
|
|
33
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Agent Development
|
|
2
|
+
|
|
3
|
+
Create agents that react to observations rather than assuming a fixed map. Validate
|
|
4
|
+
movement coordinates, maintain timestamps, monitor battery and communication
|
|
5
|
+
resources, and continue operating when observations are missing or noisy.
|
|
6
|
+
|
|
7
|
+
Use `observe()` for world state and sensor readings. Use `submit_state()` for legal
|
|
8
|
+
movement. Use `scan()` when a separate sensor request is appropriate. Report only
|
|
9
|
+
candidate discovery estimates through `report_discovery()`.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# API Usage
|
|
2
|
+
|
|
3
|
+
Create and close a client with the context manager:
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
from abdullah_unknown_world import OracleClient
|
|
7
|
+
|
|
8
|
+
with OracleClient("https://oracle.example", "team-id", "team-key") as oracle:
|
|
9
|
+
oracle.reset()
|
|
10
|
+
agents = oracle.register_agents(3)
|
|
11
|
+
observation = oracle.observe(agents[0].agent_id)
|
|
12
|
+
oracle.submit_state(agents[0].agent_id, (5.0, 5.0, 5.0), 1)
|
|
13
|
+
print(oracle.resources())
|
|
14
|
+
print(oracle.status())
|
|
15
|
+
print(oracle.finish())
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Handle `OracleAuthenticationError`, `OracleRequestError`,
|
|
19
|
+
`OracleTimeoutError`, and `OracleConnectionError`.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Challenge Rules
|
|
2
|
+
|
|
3
|
+
- Teams contain 3–4 students and have 14 days to complete the assignment.
|
|
4
|
+
- Build and maintain your own simulation and autonomous-agent architecture.
|
|
5
|
+
- Any programming language, framework, algorithm, open-source library, or AI coding
|
|
6
|
+
assistant may be used.
|
|
7
|
+
- Interact with official episodes only through documented public Oracle endpoints.
|
|
8
|
+
- Do not attempt to access instructor endpoints, private seeds, hidden world state,
|
|
9
|
+
or another team's data.
|
|
10
|
+
- Follow instructor-provided episode, sensor, communication, and resource limits.
|
|
11
|
+
- Disclose AI coding assistant usage and describe each team member's contribution.
|
|
12
|
+
- Submit only your own team's source and reports.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Resource Limits
|
|
2
|
+
|
|
3
|
+
The Oracle reports current episode time, API request count, sensor request count,
|
|
4
|
+
communication messages, agent count, and episode completion in public status.
|
|
5
|
+
Instructor-assigned maximum budgets are applied server-side where configured.
|
|
6
|
+
|
|
7
|
+
The currently implemented student status response does not return the configured
|
|
8
|
+
maximum quotas or remaining CPU and memory. Ask the instructor for official
|
|
9
|
+
team-specific budgets. Do not treat a locally chosen configuration as an official
|
|
10
|
+
resource allowance.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Public Scoring
|
|
2
|
+
|
|
3
|
+
| Criterion | Weight |
|
|
4
|
+
|---|---:|
|
|
5
|
+
| Discovery success | 30% |
|
|
6
|
+
| Time efficiency | 20% |
|
|
7
|
+
| Agent safety | 20% |
|
|
8
|
+
| Exploration coverage | 15% |
|
|
9
|
+
| Resource efficiency | 10% |
|
|
10
|
+
| Generalization | 5% |
|
|
11
|
+
| **Total** | **100%** |
|
|
12
|
+
|
|
13
|
+
Discovery success measures authoritative confirmed discoveries. Time efficiency
|
|
14
|
+
rewards completing useful work early. Safety is based on authoritative agent state.
|
|
15
|
+
Coverage measures unique explored 3D regions. Resource efficiency rewards staying
|
|
16
|
+
within API, sensor, communication, and episode budgets. Generalization is evaluated
|
|
17
|
+
over multiple randomized episodes.
|
|
18
|
+
|
|
19
|
+
Private seeds and hidden scenarios are not published.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Submission Requirements
|
|
2
|
+
|
|
3
|
+
Submit:
|
|
4
|
+
|
|
5
|
+
1. A complete source-code repository.
|
|
6
|
+
2. A README with installation and execution instructions.
|
|
7
|
+
3. A technical report covering architecture, algorithms, and design decisions.
|
|
8
|
+
4. An architecture diagram.
|
|
9
|
+
5. A demonstration video.
|
|
10
|
+
6. An AI-tool usage disclosure.
|
|
11
|
+
7. Individual team-member contribution breakdown.
|
|
12
|
+
|
|
13
|
+
Do not submit private credentials, hidden evaluation data, or student-platform
|
|
14
|
+
database reports.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
from abdullah_unknown_world import OracleClient
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def choose_next_position(observation):
|
|
5
|
+
x, y, z = observation.own_position
|
|
6
|
+
bounds = observation.world_dimensions
|
|
7
|
+
candidates = ((x + 1, y, z), (x, y, z + 1), (x - 1, y, z), (x, y, z - 1))
|
|
8
|
+
for candidate in candidates:
|
|
9
|
+
if any(value < 0 or value > limit for value, limit in zip(candidate, bounds)):
|
|
10
|
+
continue
|
|
11
|
+
if any(
|
|
12
|
+
all(
|
|
13
|
+
abs(candidate[axis] - obstacle["center"][axis])
|
|
14
|
+
<= obstacle["size"][axis] / 2
|
|
15
|
+
for axis in range(3)
|
|
16
|
+
)
|
|
17
|
+
for obstacle in observation.nearby_obstacles
|
|
18
|
+
):
|
|
19
|
+
continue
|
|
20
|
+
return candidate
|
|
21
|
+
raise RuntimeError("No visible obstacle-free move was found.")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
with OracleClient(
|
|
25
|
+
base_url="http://127.0.0.1:8000",
|
|
26
|
+
team_id="your-team-id",
|
|
27
|
+
api_key="replace-with-your-team-key",
|
|
28
|
+
) as oracle:
|
|
29
|
+
oracle.reset({"obstacle_count": 10, "beacon_count": 6})
|
|
30
|
+
agents = oracle.register_agents(1)
|
|
31
|
+
agent = agents[0]
|
|
32
|
+
|
|
33
|
+
for timestamp in range(1, 11):
|
|
34
|
+
observation = oracle.observe(agent.agent_id)
|
|
35
|
+
position = choose_next_position(observation)
|
|
36
|
+
oracle.submit_state(
|
|
37
|
+
agent.agent_id,
|
|
38
|
+
position,
|
|
39
|
+
max(timestamp, observation.timestamp + 1),
|
|
40
|
+
)
|
|
41
|
+
if observation.sensor_readings:
|
|
42
|
+
nearest = max(
|
|
43
|
+
observation.sensor_readings,
|
|
44
|
+
key=lambda reading: reading.signal_strength,
|
|
45
|
+
)
|
|
46
|
+
estimated = (
|
|
47
|
+
observation.own_position[0] + nearest.estimated_direction[0] * 5.0,
|
|
48
|
+
observation.own_position[1] + nearest.estimated_direction[1] * 5.0,
|
|
49
|
+
observation.own_position[2] + nearest.estimated_direction[2] * 5.0,
|
|
50
|
+
)
|
|
51
|
+
oracle.report_discovery(agent.agent_id, estimated)
|
|
52
|
+
if oracle.resources().episode_done:
|
|
53
|
+
break
|
|
54
|
+
|
|
55
|
+
print(oracle.status())
|
|
56
|
+
print(oracle.finish())
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from abdullah_unknown_world import OracleClient
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
with OracleClient(
|
|
5
|
+
base_url="http://127.0.0.1:8000",
|
|
6
|
+
team_id="your-team-id",
|
|
7
|
+
api_key="replace-with-your-team-key",
|
|
8
|
+
) as oracle:
|
|
9
|
+
oracle.reset({"obstacle_count": 12, "beacon_count": 8})
|
|
10
|
+
agents = oracle.register_agents(3)
|
|
11
|
+
observations = [
|
|
12
|
+
oracle.observe(agent.agent_id)
|
|
13
|
+
for agent in agents
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
for index, (agent, observation) in enumerate(zip(agents, observations)):
|
|
17
|
+
x, y, z = observation.own_position
|
|
18
|
+
oracle.submit_state(
|
|
19
|
+
agent.agent_id,
|
|
20
|
+
(min(observation.world_dimensions[0], x + 4.0 + index), y, z),
|
|
21
|
+
1,
|
|
22
|
+
)
|
|
23
|
+
oracle.communicate(
|
|
24
|
+
agent.agent_id,
|
|
25
|
+
{"status": "exploring", "obstacle_count": len(observation.nearby_obstacles)},
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
print(oracle.status())
|
|
29
|
+
print(oracle.finish())
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
class OracleError(Exception):
|
|
2
|
+
"""Base exception raised by the Oracle client."""
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class OracleAuthenticationError(OracleError):
|
|
6
|
+
"""Team authentication credentials were rejected."""
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class OracleRequestError(OracleError):
|
|
10
|
+
"""The Oracle rejected a valid HTTP request."""
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class OracleTimeoutError(OracleError):
|
|
14
|
+
"""The Oracle did not respond before the configured timeout."""
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class OracleConnectionError(OracleError):
|
|
18
|
+
"""A connection to the Oracle could not be established."""
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import Optional
|
|
3
|
+
|
|
4
|
+
Vector3 = tuple[float, float, float]
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass(frozen=True)
|
|
8
|
+
class SensorReading:
|
|
9
|
+
signal_strength: float
|
|
10
|
+
estimated_direction: Vector3
|
|
11
|
+
confidence: float
|
|
12
|
+
timestamp: int
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@dataclass(frozen=True)
|
|
16
|
+
class Observation:
|
|
17
|
+
agent_id: str
|
|
18
|
+
timestamp: int
|
|
19
|
+
own_position: Vector3
|
|
20
|
+
world_dimensions: Vector3
|
|
21
|
+
nearby_obstacles: tuple[dict, ...]
|
|
22
|
+
sensor_readings: tuple[SensorReading, ...]
|
|
23
|
+
battery: float
|
|
24
|
+
episode_done: bool
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: abdullah-unknown-world
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Student SDK and examples for The Unknown World autonomous exploration challenge.
|
|
5
|
+
Author: Abdullah Bajwa
|
|
6
|
+
Maintainer: Abdullah Bajwa
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: Documentation, https://github.com/getneuralnest/Unknown_World
|
|
9
|
+
Project-URL: Source, https://github.com/getneuralnest/Unknown_World
|
|
10
|
+
Keywords: education,multi-agent,simulation,exploration,oracle
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Education
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Topic :: Education
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: httpx>=0.27
|
|
24
|
+
Requires-Dist: PyYAML>=6.0
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=7.4; extra == "dev"
|
|
27
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
28
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# abdullah-unknown-world
|
|
32
|
+
|
|
33
|
+
Student Python SDK for The Unknown World: Autonomous Multi-Agent Exploration Challenge.
|
|
34
|
+
|
|
35
|
+
This package is prepared for distribution but has **not** been published to PyPI.
|
|
36
|
+
The `pip install abdullah-unknown-world` command will work after an authorized release.
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
python -m pip install abdullah-unknown-world
|
|
40
|
+
unknown-world init my-team
|
|
41
|
+
cd my-team
|
|
42
|
+
python main.py
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from abdullah_unknown_world import OracleClient
|
|
47
|
+
|
|
48
|
+
with OracleClient("https://oracle.example", "team-id", "team-key") as oracle:
|
|
49
|
+
oracle.reset({"obstacle_count": 10, "beacon_count": 6})
|
|
50
|
+
agents = oracle.register_agents(1)
|
|
51
|
+
print(oracle.status())
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Use only instructor-provided official URLs and team credentials. This package never
|
|
55
|
+
contains production seeds, hidden world coordinates, evaluator internals, or instructor
|
|
56
|
+
authentication credentials.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
PUBLISHING.md
|
|
4
|
+
README.md
|
|
5
|
+
pyproject.toml
|
|
6
|
+
abdullah_unknown_world/API_REFERENCE.md
|
|
7
|
+
abdullah_unknown_world/ASSIGNMENT.md
|
|
8
|
+
abdullah_unknown_world/__init__.py
|
|
9
|
+
abdullah_unknown_world/cli.py
|
|
10
|
+
abdullah_unknown_world/client.py
|
|
11
|
+
abdullah_unknown_world/config.py
|
|
12
|
+
abdullah_unknown_world/exceptions.py
|
|
13
|
+
abdullah_unknown_world.egg-info/PKG-INFO
|
|
14
|
+
abdullah_unknown_world.egg-info/SOURCES.txt
|
|
15
|
+
abdullah_unknown_world.egg-info/dependency_links.txt
|
|
16
|
+
abdullah_unknown_world.egg-info/entry_points.txt
|
|
17
|
+
abdullah_unknown_world.egg-info/requires.txt
|
|
18
|
+
abdullah_unknown_world.egg-info/top_level.txt
|
|
19
|
+
abdullah_unknown_world/docs/agent_development.md
|
|
20
|
+
abdullah_unknown_world/docs/api_usage.md
|
|
21
|
+
abdullah_unknown_world/docs/architecture.md
|
|
22
|
+
abdullah_unknown_world/docs/challenge_rules.md
|
|
23
|
+
abdullah_unknown_world/docs/resource_limits.md
|
|
24
|
+
abdullah_unknown_world/docs/scoring.md
|
|
25
|
+
abdullah_unknown_world/docs/submission_requirements.md
|
|
26
|
+
abdullah_unknown_world/examples/basic_agent.py
|
|
27
|
+
abdullah_unknown_world/examples/multi_agent.py
|
|
28
|
+
abdullah_unknown_world/models/__init__.py
|
|
29
|
+
abdullah_unknown_world/models/action.py
|
|
30
|
+
abdullah_unknown_world/models/agent.py
|
|
31
|
+
abdullah_unknown_world/models/observation.py
|
|
32
|
+
abdullah_unknown_world/models/resources.py
|
|
33
|
+
tests/test_package.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
abdullah_unknown_world
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "abdullah-unknown-world"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Student SDK and examples for The Unknown World autonomous exploration challenge."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Abdullah Bajwa" }
|
|
14
|
+
]
|
|
15
|
+
maintainers = [
|
|
16
|
+
{ name = "Abdullah Bajwa" }
|
|
17
|
+
]
|
|
18
|
+
keywords = ["education", "multi-agent", "simulation", "exploration", "oracle"]
|
|
19
|
+
classifiers = [
|
|
20
|
+
"Development Status :: 3 - Alpha",
|
|
21
|
+
"Intended Audience :: Education",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3.10",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Programming Language :: Python :: 3.13",
|
|
27
|
+
"Programming Language :: Python :: 3.14",
|
|
28
|
+
"Topic :: Education",
|
|
29
|
+
]
|
|
30
|
+
dependencies = [
|
|
31
|
+
"httpx>=0.27",
|
|
32
|
+
"PyYAML>=6.0",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.optional-dependencies]
|
|
36
|
+
dev = ["pytest>=7.4", "build>=1.2", "twine>=5.0"]
|
|
37
|
+
|
|
38
|
+
[project.urls]
|
|
39
|
+
Documentation = "https://github.com/getneuralnest/Unknown_World"
|
|
40
|
+
Source = "https://github.com/getneuralnest/Unknown_World"
|
|
41
|
+
|
|
42
|
+
[project.scripts]
|
|
43
|
+
unknown-world = "abdullah_unknown_world.cli:main"
|
|
44
|
+
|
|
45
|
+
[tool.setuptools.packages.find]
|
|
46
|
+
where = ["."]
|
|
47
|
+
include = ["abdullah_unknown_world*"]
|
|
48
|
+
|
|
49
|
+
[tool.setuptools.package-data]
|
|
50
|
+
"abdullah_unknown_world" = [
|
|
51
|
+
"examples/*.py",
|
|
52
|
+
"docs/*.md",
|
|
53
|
+
"ASSIGNMENT.md",
|
|
54
|
+
"API_REFERENCE.md",
|
|
55
|
+
]
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
import httpx
|
|
4
|
+
|
|
5
|
+
from abdullah_unknown_world import OracleClient
|
|
6
|
+
from abdullah_unknown_world.cli import init_project, show_example
|
|
7
|
+
from abdullah_unknown_world.models import Action
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class MockTransport(httpx.BaseTransport):
|
|
11
|
+
def handle_request(self, request):
|
|
12
|
+
if request.url.path == "/api/v1/episodes":
|
|
13
|
+
return httpx.Response(200, json={
|
|
14
|
+
"episode_id": "episode-team-a-001",
|
|
15
|
+
"world_dimensions": [100.0, 60.0, 100.0],
|
|
16
|
+
"max_steps": 500,
|
|
17
|
+
})
|
|
18
|
+
if request.url.path.endswith("/agents"):
|
|
19
|
+
return httpx.Response(200, json={"agent_ids": ["agent_000"]})
|
|
20
|
+
if "/observations/" in request.url.path:
|
|
21
|
+
return httpx.Response(200, json={
|
|
22
|
+
"agent_id": "agent_000",
|
|
23
|
+
"timestamp": 1,
|
|
24
|
+
"own_position": [5.0, 5.0, 5.0],
|
|
25
|
+
"world_dimensions": [100.0, 60.0, 100.0],
|
|
26
|
+
"nearby_obstacles": [],
|
|
27
|
+
"sensor_readings": [],
|
|
28
|
+
"battery": 100.0,
|
|
29
|
+
"episode_done": False,
|
|
30
|
+
})
|
|
31
|
+
if request.url.path.endswith("/status"):
|
|
32
|
+
return httpx.Response(200, json={
|
|
33
|
+
"timestamp": 1,
|
|
34
|
+
"registered_agents": 1,
|
|
35
|
+
"discovered_count": 0,
|
|
36
|
+
"total_beacons": 6,
|
|
37
|
+
"episode_done": False,
|
|
38
|
+
"finished": False,
|
|
39
|
+
"api_requests": 2,
|
|
40
|
+
"sensor_requests": 1,
|
|
41
|
+
"communication_messages": 0,
|
|
42
|
+
"visited_cells": 1,
|
|
43
|
+
})
|
|
44
|
+
if request.url.path.endswith("/finish"):
|
|
45
|
+
return httpx.Response(200, json={
|
|
46
|
+
"steps": 1,
|
|
47
|
+
"total_beacons": 6,
|
|
48
|
+
"discovered_beacons": 0,
|
|
49
|
+
"discovery_rate": 0.0,
|
|
50
|
+
"registered_agents": 1,
|
|
51
|
+
"finished": True,
|
|
52
|
+
})
|
|
53
|
+
return httpx.Response(200, json={"accepted": True, "battery": 100.0})
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def test_client_reset_register_observe_and_finish():
|
|
57
|
+
client = OracleClient("http://testserver", "team-a", "key-a")
|
|
58
|
+
client._client = httpx.Client(
|
|
59
|
+
base_url="http://testserver",
|
|
60
|
+
transport=MockTransport(),
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
episode = client.reset()
|
|
64
|
+
assert episode["episode_id"].startswith("episode-")
|
|
65
|
+
agents = client.register_agents(1)
|
|
66
|
+
observation = client.observe(agents[0].agent_id)
|
|
67
|
+
assert observation.agent_id == "agent_000"
|
|
68
|
+
assert client.finish()["finished"] is True
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def test_action_model():
|
|
72
|
+
action = Action("agent_000", (5.0, 5.0, 5.0), 1)
|
|
73
|
+
assert action.timestamp == 1
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def test_cli_starter_generator(tmp_path):
|
|
77
|
+
target = init_project(str(tmp_path / "my-team"))
|
|
78
|
+
assert (target / "main.py").exists()
|
|
79
|
+
assert (target / "agents" / "explorer.py").exists()
|
|
80
|
+
assert (target / "config.yaml").exists()
|
|
81
|
+
assert "config.yaml" in (target / ".gitignore").read_text(encoding="utf-8")
|
|
82
|
+
assert "choose_position" in (target / "main.py").read_text(encoding="utf-8")
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def test_cli_example_is_bundled():
|
|
86
|
+
assert "OracleClient" in show_example()
|