Skip to main content

Python SDK for Geospatial Agentic Services (GAS).

Project description

GAS Client

Python SDK for Geospatial Agentic Services (GAS).

This package contains only the lightweight client layer. It does not install the GAS server, Flask, GeoPandas, Rasterio, PySAL, or other geospatial runtime dependencies.

Install

Install from PyPI:

python -m pip install gas-client

For local development from this repository:

cd packages/gas-client
python -m pip install -e .

Quick Start

from gas_client import GasClient

client = GasClient("https://your-gas-server.com")

print(client.list_agents())

agent = client.agent("geospatial_data_retrieval_agent")

result = agent.execute_task(
    "Download Pennsylvania county boundaries from Census Bureau.",
    mode="sync",
    credentials={"OPENAI_API_KEY": "YOUR_OPENAI_API_KEY"},
)

client.print_task_summary(result)

Some agents return several artifacts from one call. For example, geospatial_data_retrieval_agent can decompose a multi-dataset request into sub-tasks and return all dataset URLs via client.get_artifact_urls(result).

Client-level credentials are optional defaults. You can omit them at client creation and pass credentials per task, or provide default_credentials with the provider-specific keys expected by your server, such as GEMINI_API_KEY. Before choosing a credential field name, users and orchestrating agents should inspect the selected agent's DescribeAgent JSON and use the key name that agent advertises. Task-level credentials override client defaults when needed.

client = GasClient(
    "https://your-gas-server.com",
    default_credentials={
        "GEMINI_API_KEY": "YOUR_GEMINI_API_KEY",
    },
)

Streaming Tasks

for event in agent.execute_task(
    "Download Pennsylvania county boundaries from Census Bureau.",
    mode="stream",
):
    client.print_stream_event(event)
    if event.get("event") == "task_result":
        result = event.get("payload")

client.print_task_summary(result)

Canonical GAS Request Body

Credential requirements are defined by each service's DescribeAgent capability document. Inspect the selected agent before submitting a task: one service may require an OpenAI key, another may use a different model provider, another may require data-source credentials, and deterministic services may not need an LLM key.

request_body = client.build_execute_task_request(
    "Create a web mapping app.",
    mode="stream",
    input_datasets=[
        "https://example.com/counties.geojson",
    ],
    artifact_delivery="URL",
    # Optional: include credentials here only when this call needs a key
    # and the client was not created with suitable default credentials.
    # Credential names are server- and agent-dependent.
    credentials={
        "OPENAI_API_KEY": "YOUR_OPENAI_API_KEY",
    },
)

for event in client.agent("web_mapping_app_agent").execute_task_request(request_body):
    client.print_stream_event(event)

Public API

from gas_client import (
    GASClient,
    GasAgentClient,
    GasClient,
    GasClientError,
    GasTaskTimeoutError,
)

Important methods:

  • get_capabilities()
  • list_agents()
  • describe_agent(agent_id)
  • agent(agent_id)
  • execute_task(agent_id, instructions, mode="sync")
  • execute_task_request(agent_id, request_body)
  • get_task_status(agent_id, task_id)
  • get_task_result(agent_id, task_id)
  • wait_for_task(agent_id, task_id)
  • cancel_task(agent_id, task_id)
  • encode_dataset_file(path)
  • get_artifact_urls(result)
  • print_stream_event(event)
  • print_task_summary(result)

For the full SDK guide, including task modes, artifact handling, encoded input datasets, and service chaining patterns, see:

https://github.com/GIBD2015/geospatial-agentic-services/blob/main/docs/gas_client_sdk.md

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gas_client-0.2.1.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gas_client-0.2.1-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file gas_client-0.2.1.tar.gz.

File metadata

  • Download URL: gas_client-0.2.1.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for gas_client-0.2.1.tar.gz
Algorithm Hash digest
SHA256 a42830a66ab7ea70d15d3c9fc6385e6e0f126e32f9a5d2b71754e6d59baaf492
MD5 4b9b55a5a1b37df5cb90db02f768a736
BLAKE2b-256 732fefe8ecad3388db7f68a62b448440254267140036d65a85cf50746f1076dc

See more details on using hashes here.

File details

Details for the file gas_client-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: gas_client-0.2.1-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.14.5

File hashes

Hashes for gas_client-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d0de3a435705d8e26467be7796aa2d61967079397d3f96fe56508befca687eb5
MD5 80156893213e8dcd3c92ece4749bd675
BLAKE2b-256 093d4bde4729735f8298e86d2819e6f5b84c281958cfa73b2d1215399cc5eb9c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page