GEO INFER API

From ActiveInferenceInstitute/GEO-INFER · View interactive version

GEO INFER API is an AI agent skill from the GitHub repository ActiveInferenceInstitute/GEO-INFER. GEO-INFER script, CLI and MCP access plus REST geospatial endpoints. Use to discover and invoke public module APIs, compose native scientific objects, or build spatial web services.

How to use this skill

Skill file

GEO-INFER-API

Instructions

Core Capabilities

geo-infer-mcp stdio tools share public API discovery and execution across

all 45 modules. Native handles, typed inputs and context entry/exit support

stateful scientific workflows. Installed wheels include all 46 skill texts.

Out of scope for this module: GraphQL schema, JWT/API-key authentication middleware, rate limiting. There is no auth middleware today; SECRET_KEY is a required fail-closed setting only.

Key Imports

from geo_infer_api.app import create_app
from geo_infer_api import AgentSession
from geo_infer_api.core.config import Settings, get_settings
from geo_infer_api.core.middleware import ErrorHandlerMiddleware, RequestLoggingMiddleware
from geo_infer_api import (
    Feature, FeatureCollection, Polygon, PolygonFeature,
)
from geo_infer_api.utils.geojson_helpers import (
    polygon_contains_point, create_buffer, simplify_polygon,
    calculate_polygon_area, validate_polygon_rings,
)

Examples

Build the FastAPI application (requires SECRET_KEY to be set):

import os
os.environ["SECRET_KEY"] = "change-me"

from geo_infer_api.app import create_app
app = create_app()  # serve with: uvicorn geo_infer_api.app:main_app

Point-in-polygon and buffering on GeoJSON polygons:

from geo_infer_api.utils.geojson_helpers import polygon_contains_point, create_buffer

square = {"type": "Polygon", "coordinates": [[(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)]]}
assert polygon_contains_point(square, (5.0, 5.0)) is True
buffered = create_buffer(square, distance=1.0, unit="kilometers")

Agent interfaces

Use uv run --frozen geo-infer catalog API to discover public source

APIs, then geo-infer describe before calling a selected target. Scripts use

geo_infer_api.agent_runtime.AgentSession; the optional stdio MCP server is

geo-infer-mcp. See requests, native objects and composition.

The adapter retains this module's dependencies and authorization requirements.

Guidelines

Integrations

Persistent sessions and performance

Use geo-infer doctor to inspect actual runtime and unprobed native status.

Use geo-infer session for JSON Lines with persistent handles, or Python

with AgentSession() / async with for deterministic entered-context cleanup.

MCP exposes geo_diagnostics and geo_close; close ends execution until restart.

Benchmark the real adapter with python -m geo_infer_api.agent_benchmarks or

call geo_infer_api.agent_benchmarks:benchmark_agent through any surface.

Read profiling controls and evidence

before selecting Python 3.15 sampling or interpreting throughput results.

Native result selection

Use get / MCP geo_get with a path array to index a retained result after

public member selection. Tagged slice values use data: [start, stop, step]

with integers/null and a nonzero step; tagged tuple indexes select multiple

scientific axes. These indexes also work in $ref.path for native composition.

Use save_as when retaining a selected native view and its dtype matters.

Automatic opaque reads reuse an existing identity handle; explicit aliases

still consume capacity. Read a public value directly with

geo-infer get TARGET --path JSON.

Strict requests and native maps

Selectors must name exactly one nonempty target or handle; optional members

must also be nonempty. The MCP adapter validates raw arguments before SDK

coercion, rejecting unknown keys and incorrect types before execution. Optional

null defaults retain their advertised meaning. Returned dictionaries containing

reserved $ref, $type, $literal or $callable keys are retained as native

handles, including nested collisions. Use $ref and get.path to compose or

select them. Explicit caller $literal inputs remain exact user data. Python

session context managers preserve an entered native context's exception

suppression as well as cleanup.

If retaining an enter result fails (including handle capacity), its newly

entered context is unwound immediately with that exception. Existing entered

contexts and aliases remain owned. Native suppression still runs cleanup, but

the missing response remains a failure; native cleanup exceptions propagate.

REST polygon IDs use string storage identity, so integer 1 and string "1"

conflict. Updates validate supplied body IDs even when the ID is zero.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.