Async HTTP client for Atlas Command.
Project description
Atlas Command HTTP Client (Python)
atlas-asset-client is a lightweight async wrapper around the Atlas Command REST API. It replaces the
retired WebSocket helpers and provides strongly-typed convenience methods for working with
entities, tasks, objects, and query endpoints via HTTP.
Installation
pip install atlas-asset-client
During local development inside this repository:
pip install -e Atlas_Command/connection_packages/atlas_asset_ws_client
Quickstart
import asyncio
from atlas_asset_ws_client import AtlasCommandHttpClient
async def main() -> None:
async with AtlasCommandHttpClient("http://localhost:8000") as client:
entity = await client.create_entity(
entity_id="asset-1",
entity_type="asset",
alias="Demo Asset",
components={"telemetry": {"latitude": 40.7, "longitude": -74.0}},
)
print("Created entity:", entity["entity_id"])
tasks = await client.list_tasks(limit=10)
print("Existing tasks:", [t["task_id"] for t in tasks])
snapshot = await client.get_full_dataset()
print("Snapshot counts:", {k: len(v) for k, v in snapshot.items()})
with open("mission_video.mp4", "rb") as video:
stored = await client.create_object(
file=video,
object_id="mission-video-1",
usage_hint="mission_video",
referenced_by=[{"entity_id": "asset-1"}],
)
print("Uploaded object:", stored["object_id"])
asyncio.run(main())
Entity Types Guide
Atlas Command supports several entity types, each with different purposes and component structures. All entities are created using the create_entity() method, but the entity_type parameter and components structure differ based on what you're representing.
Assets
Purpose: Assets represent taskable autonomous agents that can execute commands and report telemetry. Examples include drones, rovers, security cameras, and other controllable hardware.
When to use: Register any physical or virtual device that can receive tasks from Atlas Command.
Required fields:
entity_id: Unique identifier for the asset (string)entity_type: Must be"asset"(string)alias: Human-readable name for the asset (string)
Common components:
telemetry: Location and movement data (latitude,longitude,altitude_m,speed_m_s,heading_deg)task_catalog: Supported task types the asset can executehealth: System status (e.g.,battery_percent)communications: Connection state (link_state)sensor_refs: Array of attached sensor configurationsmedia_refs: Array of object references for camera feeds or thumbnails
Example:
async with AtlasCommandHttpClient("http://localhost:8000") as client:
asset = await client.create_entity(
entity_id="drone-alpha-01",
entity_type="asset",
alias="Drone Alpha 01",
components={
"telemetry": {
"latitude": 40.7128,
"longitude": -74.0060,
"altitude_m": 120,
"speed_m_s": 8.2,
"heading_deg": 165
},
"task_catalog": {
"supported_tasks": ["move_to_location", "survey_grid"]
},
"health": {
"battery_percent": 76
},
"communications": {
"link_state": "connected"
}
}
)
Tracks
Purpose: Tracks represent observed entities detected by sensors or other assets. They are passive entities that track movement and characteristics of detected objects, but cannot receive tasks.
When to use: Register any detected object or entity that needs to be monitored but not controlled. Examples include vehicles, people, or other objects detected by security cameras or radar systems.
Required fields:
entity_id: Unique identifier for the track (string)entity_type: Must be"track"(string)alias: Human-readable name for the track (string)
Common components:
telemetry: Current location and movement datamil_view: Classification and tracking information (classification: friendly/hostile/neutral/unknown/civilian,last_seen)sensor_refs: Sensors that detected this trackmedia_refs: Object references for images or videos of the track
Example:
async with AtlasCommandHttpClient("http://localhost:8000") as client:
track = await client.create_entity(
entity_id="target-alpha",
entity_type="track",
alias="Target Alpha",
components={
"telemetry": {
"latitude": 40.7128,
"longitude": -74.0060,
"altitude_m": 120,
"speed_m_s": 8.2,
"heading_deg": 165
},
"mil_view": {
"classification": "unknown",
"last_seen": "2025-11-23T10:05:00Z"
}
}
)
Geofeatures
Purpose: Geofeatures represent geographic features or zones on the map. They can be points, lines, polygons, or circles representing waypoints, routes, boundaries, restricted areas, or other geographic annotations.
When to use: Register any geographic annotation that needs to be displayed on the map. Common use cases include waypoints, patrol routes, no-fly zones, survey areas, or boundaries.
Required fields:
entity_id: Unique identifier for the geofeature (string)entity_type: Must be"geofeature"(string)alias: Human-readable name for the geofeature (string)components.geometry: Geometry definition based on type
Geometry types:
Point Geofeature
A single coordinate location. Use for waypoints or point-of-interest markers.
async with AtlasCommandHttpClient("http://localhost:8000") as client:
point = await client.create_entity(
entity_id="waypoint-alpha",
entity_type="geofeature",
alias="Waypoint Alpha",
components={
"geometry": {
"type": "Point",
"coordinates": [-74.0060, 40.7128] # [longitude, latitude]
}
}
)
LineString Geofeature
A path or route defined by multiple coordinates. Use for patrol routes, flight paths, or boundaries.
async with AtlasCommandHttpClient("http://localhost:8000") as client:
linestring = await client.create_entity(
entity_id="patrol-route-alpha",
entity_type="geofeature",
alias="Patrol Route Alpha",
components={
"geometry": {
"type": "LineString",
"coordinates": [
[-74.0060, 40.7128],
[-74.0070, 40.7130],
[-74.0080, 40.7135],
[-74.0090, 40.7140]
] # Array of [longitude, latitude] pairs
}
}
)
Polygon Geofeature
A closed area defined by coordinates. The first and last coordinate must be the same to close the polygon. Use for restricted zones, survey areas, or regions of interest.
async with AtlasCommandHttpClient("http://localhost:8000") as client:
polygon = await client.create_entity(
entity_id="area-of-interest-alpha",
entity_type="geofeature",
alias="Area of Interest Alpha",
components={
"geometry": {
"type": "Polygon",
"coordinates": [[
[-74.0060, 40.7128],
[-74.0070, 40.7128],
[-74.0070, 40.7130],
[-74.0060, 40.7130],
[-74.0060, 40.7128] # Must close the polygon
]] # Note: coordinates is an array of coordinate rings
}
}
)
Circle Geofeature
A circular area defined by a center point and radius. Use for circular zones, coverage areas, or proximity alerts.
async with AtlasCommandHttpClient("http://localhost:8000") as client:
circle = await client.create_entity(
entity_id="perimeter-epsilon",
entity_type="geofeature",
alias="Perimeter Epsilon",
components={
"geometry": {
"point_lat": 40.7128, # Center latitude
"point_lng": -74.0060, # Center longitude
"radius_m": 500 # Radius in meters
},
"geometry_type": "circle"
}
)
Common components for geofeatures:
geometry: Geometry definition (required)geometry_type: Explicit type specification (for circles:"circle")description: Human-readable description of the geofeaturemil_view: Classification metadata if applicable
Features
- Uses
httpx.AsyncClientunder the hood with pluggable transport/timeouts. - Convenience methods for every public endpoint:
list_entities,get_entity,create_entity,update_entity,delete_entity,get_entity_by_alias,update_entity_telemetrylist_tasks,create_task,get_task,update_task,delete_task,get_tasks_by_entity,start_task,complete_task,fail_task
list_objects,create_object(uploads a file via/objects/upload),get_object,update_object,delete_object,get_objects_by_entity,get_objects_by_task,find_orphaned_objects,add_object_reference,remove_object_reference,get_object_references,validate_object_references,cleanup_object_referencesget_changed_since,get_full_dataset
- Optional bearer token support via the
token=constructor parameter. - Context manager support (
async with client:) to manage connection lifecycle.
Field reference
Client configuration
AtlasCommandHttpClient(base_url, *, token=None, timeout=10.0, transport=None)– requiresbase_url, optionaltoken,timeout, andtransport.
Entities
list_entities(*, limit=100, offset=0)– optional pagination parameters based on defaults.get_entity(entity_id)– requiresentity_id.get_entity_by_alias(alias)– requiresalias.create_entity(*, entity_id, entity_type, alias, components=None)– requiresentity_id,entity_type, andalias;componentsare optional.update_entity(entity_id, *, components=None)– requiresentity_id, optional component patch.delete_entity(entity_id)– requiresentity_id.update_entity_telemetry(entity_id, *, latitude=None, longitude=None, altitude_m=None, speed_m_s=None, heading_deg=None)– requiresentity_id; telemetry values are optional and only set when provided.
Tasks
list_tasks(*, status=None, limit=25)– optionalstatusand page size.get_task(task_id)– requirestask_id.create_task(*, task_id, components=None)– requirestask_id;componentsoptional.update_task(task_id, *, components=None)– requirestask_id;componentsoptional.delete_task(task_id)– requirestask_id.get_tasks_by_entity(entity_id, *, status=None, limit=25)– requiresentity_id; filters optional.start_task(task_id)/complete_task(task_id)– each requirestask_id.fail_task(task_id, *, error_message=None, error_details=None)– requirestask_id; error info optional.
Objects
list_objects(*, content_type=None, limit=100, offset=0)– optional filters.get_object(object_id)– requiresobject_id.create_object(file, *, object_id, usage_hint=None, referenced_by=None)– requiresfiledata andobject_id;usage_hintandreferenced_byoptional.update_object(object_id, *, usage_hints=None, referenced_by=None)– requiresobject_id; metadata optional.delete_object(object_id)– requiresobject_id.get_objects_by_entity(entity_id, *, limit=50)– requiresentity_id, optional pagination.get_objects_by_task(task_id, *, limit=50)– requirestask_id, optional pagination.add_object_reference(object_id, *, entity_id=None, task_id=None)/remove_object_reference(...)– requireobject_id; provide eitherentity_idortask_idto target the reference.find_orphaned_objects(*, limit=100)– optional limit.get_object_references(object_id)/validate_object_references(object_id)/cleanup_object_references(object_id)– each requiresobject_id.
Queries
get_changed_since(since, *, limit_per_type=None)– requiressince; optional per-type limit.get_full_dataset(*, entity_limit=None, task_limit=None, object_limit=None)– filters are optional.
Configuration
client = AtlasCommandHttpClient(
"https://atlas.example.com",
token="my-api-token",
timeout=30.0,
)
You can also pass a custom httpx transport for testing:
transport = httpx.MockTransport(my_handler)
client = AtlasCommandHttpClient("http://testserver", transport=transport)
Breaking changes
create_entitynow requiresaliasand no longer acceptspublished_at,updated_at, orextra.create_task/update_taskdropstatus/extra; lifecycle helpers no longer acceptstarted_byorresult.create_objectis the only object-creation helper and always uploads a file via/objects/upload; storage metadata and sizing is server-managed.
Testing
Run the suite with:
pip install -e .[dev]
pytest
The tests use httpx.MockTransport so they do not require a running Atlas Command instance.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file atlas_asset_client-0.2.4.tar.gz.
File metadata
- Download URL: atlas_asset_client-0.2.4.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c34826c7f5a67053c7b2f3079fa42c3c5f94185d8e6f5f35e213b6657d2b324
|
|
| MD5 |
1befef82f91576edc750fa67216debd1
|
|
| BLAKE2b-256 |
47c3f32237f13dad64c5551f8a2b9ae0fa188df06910f2cb5e108884fae00b7f
|
File details
Details for the file atlas_asset_client-0.2.4-py3-none-any.whl.
File metadata
- Download URL: atlas_asset_client-0.2.4-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66cb8b04d69b9f9b87010eef1fcac8ec0c88669ffa35ec6f26ecfc3d593d7929
|
|
| MD5 |
9213e2b472ffac7da7848065506794f2
|
|
| BLAKE2b-256 |
d687ce7e3de9e7a48bc7eddf46d4c621058b149f4ac102449c8df834a3208459
|