Skip to main content

A protocol for autonomous LLM agents to navigate web applications via semantic landmarks.

Project description

Elemm: LLM Landmark Protocol

Elemm is a protocol standard for hierarchical structuring of API interfaces for AI agents. It enables agents to efficiently navigate complex toolsets with minimal token consumption and maximum precision.

Core Concepts

1. Landmarks

Landmarks are marked entry points within an API. They function as signposts that guide agents through various functional modules (e.g., IT, HR, Finance).

2. Hierarchical Navigation

Instead of presenting a flat list of hundreds of tools, Elemm provides context-specific toolsets. The agent actively navigates between modules, which increases accuracy and minimizes the risk of hallucinations or incorrect tool selection.

3. Hybrid Mode (Auto-Flattening)

For small or flat APIs (less than 10 landmarks without a group structure), Elemm automatically switches to a hybrid mode. In this mode, all tools are made directly visible to eliminate navigation overhead for simple tasks.

4. Agent Repair Kit (Self-Healing)

Elemm utilizes dynamic correction hints (Remedies). In case of validation errors (HTTP 422), the protocol provides the agent with precise instructions for error resolution instead of having to keep these permanently in the context.

Features

  • Token Optimization: Static tool descriptions are stripped of redundant instructions. Contextual help is only delivered when needed.
  • Session Isolation: Complete separation of navigation states in multi-agent operations through isolated bridge instances per connection.
  • Deep Type Discovery: Automatic extraction of Enum and Literal types from Pydantic models for precise JSON schemas.
  • Native MCP Support: Full compatibility with the Model Context Protocol (both Stdio and SSE).

Quick Start

Installation

pip install elemm

Integration with FastAPI

from fastapi import FastAPI
from elemm.fastapi import FastAPIProtocolManager as Elemm

app = FastAPI()
ai = Elemm(agent_welcome="Welcome to the Enterprise ERP System.")

# Define a landmark
@app.get("/finance/audit")
@ai.landmark(id="finance", type="navigation", opens_group="finance")
async def finance_module():
    return {"status": "Active"}

# Register a tool in a group
@app.post("/finance/transfer")
@ai.action(id="transfer", group="finance")
async def transfer_funds(amount: float):
    return {"result": "Success"}

ai.bind_to_app(app)
ai.bind_mcp_sse(app, route_prefix="/mcp")

Migration Path: From Flat to Hierarchical in 3 Steps

If you have an existing flat FastAPI application, you can migrate to the landmark protocol without breaking your existing API:

1. Categorize your Routes

Organize your routes using standard FastAPI tags. These tags will become the basis for your navigational structure.

app = FastAPI(openapi_tags=[
    {"name": "it_ops", "description": "Manage infrastructure and logs."}
])

@app.get("/logs", tags=["it_ops"])
async def get_logs(): ...

2. Initialize and Bind

Initialize the Elemm manager and bind it to your application. This automatically detects your tags and prepares the discovery layer.

from elemm.fastapi import FastAPIProtocolManager as Elemm
ai = Elemm(agent_welcome="You are an Ops Specialist.")

# This automatically creates 'explore_it_ops' from your tags
ai.bind_to_app(app)

3. Define Entry Points

Mark specific routes as navigation landmarks to activate the hierarchical view.

@app.get("/it/portal")
@ai.landmark(id="it_portal", type="navigation", opens_group="it_ops")
async def it_portal():
    return {"status": "IT Portal Active"}

Once these steps are completed, an AI agent will no longer be overwhelmed by a flat list but will instead navigate through your defined modules.

Architecture and Security

Elemm is designed for enterprise production use:

  • Context Firewall: The MCP bridge validates tool calls against the agent's current navigation state.
  • Reverse Proxy Support: Automatically respects root_path when behind Nginx or Traefik.
  • Circular Reference Safety: Safely handles complex, recursive Pydantic models.

License

GNU General Public License v3.0. Created by Marc Stöcker.

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

elemm-0.6.0.tar.gz (36.6 kB view details)

Uploaded Source

Built Distribution

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

elemm-0.6.0-py3-none-any.whl (30.8 kB view details)

Uploaded Python 3

File details

Details for the file elemm-0.6.0.tar.gz.

File metadata

  • Download URL: elemm-0.6.0.tar.gz
  • Upload date:
  • Size: 36.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for elemm-0.6.0.tar.gz
Algorithm Hash digest
SHA256 3ea1053ed99f9c503b834dd90e3e3f79c006445b908e2c487ce8f930255d2648
MD5 e17b5de6efbace5db4cb8525262e0159
BLAKE2b-256 f14be6697ba72e8a06719e3f0288e217dd05bce6735d8ef9abb2a6e7e3141d07

See more details on using hashes here.

Provenance

The following attestation bundles were made for elemm-0.6.0.tar.gz:

Publisher: workflow.yml on v3rm1ll1on/elemm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file elemm-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: elemm-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 30.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for elemm-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a5f1c4730cdea78b46e03261e7781b37acdd79b05b0d6ed04c51ba3eaedce03e
MD5 cd5c0a1ee870b540654b05f968c8d65e
BLAKE2b-256 f86ea2343fb0070626fda52a334feed73a1123f51531d3426e0837c3ebcdfca0

See more details on using hashes here.

Provenance

The following attestation bundles were made for elemm-0.6.0-py3-none-any.whl:

Publisher: workflow.yml on v3rm1ll1on/elemm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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