Skip to main content

AI Execution Layer SDK (contracts + registry + decorators)

Project description

aiel-sdk

AI Execution Layer SDK: local contracts + decorators + registry for code that runs server-side.

This package is intentionally lightweight. It provides importable symbols, typing, and a stable contract surface that mirrors the server runtime. Your local code can type-check, lint, and run basic smoke tests without depending on the full server implementation.

Install

pip install aiel-sdk

Quickstart

Use the aiel.* namespace for explicit library-style imports:

from aiel.langgraph.graph import StateGraph, MessagesState, START, END
from aiel.llangchain.agents import create_agent

g = StateGraph(MessagesState).add_node("x", lambda s: s).add_edge(START, END)
app = g.compile()
print("OK", app.invoke({"messages": []}), create_agent)

You can also import everything from the SDK surface directly:

from aiel_sdk.sdk import (
  StateGraph, MessagesState, START, END, InMemorySaver,
  tools_condition, ToolNode,
  ChatPromptTemplate, PromptTemplate, Runnable, RunnableConfig,
  tool, agent, flow, flow_graph, http, mcp_server
)

Core Concepts

Contract-first SDK

This SDK mirrors the server runtime contracts. Most symbols are shims or stubs and do not execute real server logic locally. They exist so your code can:

  • import familiar library surfaces
  • type-check and validate signatures
  • build graphs and registry entries that the server can later execute

Registry + decorators (travel agency example)

Use decorators to register tools, agents, flows, flow graphs, and HTTP handlers. The registry is in-memory and used as the local source of truth before deployment.

from aiel_sdk.sdk import tool, agent, flow, flow_graph, http, mcp_server
from aiel.langgraph.graph import StateGraph, MessagesState, START, END, tools_condition
from aiel.langchain import ChatPromptTemplate, RunnableConfig

# Tool: discrete action callable by an agent or graph.
@tool("search_flights")
def search_flights(ctx, payload):
    origin = payload.get("origin")
    destination = payload.get("destination")
    return {"options": [{"flight": "AE101", "from": origin, "to": destination}]}

# Tool: another discrete action.
@tool("quote_hotel")
def quote_hotel(ctx, payload):
    city = payload.get("city")
    return {"hotel": "Skyline Inn", "nightly_usd": 180, "city": city}

# Agent: orchestration entry point.
@agent("travel_agent")
def travel_agent(ctx, input):
    prompt = ChatPromptTemplate.from_messages([
        {"role": "system", "content": "You are a travel agent."},
        {"role": "user", "content": input.get("request", "")},
    ])
    _ = prompt.format_messages()
    return {"intent": "plan_trip", "request": input}

# Flow: simple function flow.
@flow("daily_deals")
def daily_deals(ctx, input):
    flights = search_flights(ctx, input)
    hotels = quote_hotel(ctx, {"city": input.get("destination")})
    return {"flights": flights, "hotels": hotels}

# Flow graph: build a LangGraph-style state graph.
def build_trip_planner():
    g = StateGraph(MessagesState)
    g.add_node("agent", lambda s: s).add_edge(START, "agent").add_edge("agent", END)
    g.add_conditional_edges("agent", tools_condition, path_map={"continue": END})
    return g

flow_graph("trip_planner", build_trip_planner)

# HTTP handler: exposes a REST entry point (server-side at runtime).
@http.post("/travel/quote")
def travel_quote(ctx, body: dict):
    return daily_deals(ctx, body)

# MCP server: register tools exposed via MCP.
mcp = mcp_server("travel_agency")

@mcp.tool("search_flights")
def mcp_search_flights(ctx, origin: str, destination: str):
    return {"options": [{"flight": "AE202", "from": origin, "to": destination}]}

@mcp.tool("quote_hotel")
def mcp_quote_hotel(ctx, city: str):
    return {"hotel": "Harbor View", "nightly_usd": 210, "city": city}

# RunnableConfig is accepted by contract shims for IDE and typing support.
_config = RunnableConfig(trace_id="req-123")

LangGraph contract surface

The aiel.langgraph.graph module mirrors core LangGraph symbols used for building state graphs. Execution is local only for simple checks; the real runtime happens server-side.

from aiel.langgraph.graph import StateGraph, MessagesState, START, END, tools_condition

g = StateGraph(MessagesState)
g.add_node("x", lambda s: s)
g.add_edge(START, END)
app = g.compile()
print(tools_condition({}), app.invoke({"messages": []}))

LangChain contract surface

The aiel.langchain and aiel.llangchain modules expose minimal prompt and runnable shims plus placeholder agent helpers.

from aiel.langchain import ChatPromptTemplate, PromptTemplate, RunnableConfig

prompt = ChatPromptTemplate.from_messages([])
print(prompt.format_messages(), RunnableConfig(trace_id="abc"))

Import map

  • aiel.langgraph.graph mirrors langgraph.graph surface.
  • aiel.langchain mirrors a minimal langchain prompt/runnable surface.
  • aiel.llangchain.agents mirrors agent factory helpers (contract stub).
  • aiel_sdk.sdk exposes the full SDK surface in one import.

Explicit import mapping (LangGraph / LangChain Core / Community)

The SDK provides an explicit surface for the essential imports used in the LangGraph customer-support tutorial. Use these as drop-in local contracts:

# LangGraph
from aiel.langgraph.graph import END, StateGraph, START, InMemorySaver, ToolNode, tools_condition

# LangChain Core (contract shims provided by this SDK)
from aiel.langchain import ChatPromptTemplate, Runnable, RunnableConfig

# LangChain Core messages + runnables
from aiel.langchain_core.messages import ToolMessage
from aiel.langchain_core.runnables import RunnableLambda

# LangGraph message helpers
from aiel.langgraph.graph.message import AnyMessage, add_messages

# LangGraph checkpointer
from aiel.langgraph.checkpoint.memory import InMemorySaver

# LangChain Community tools (planned shim)
# from aiel.langchain_community.tools.tavily_search import TavilySearchResults

Planned mirrors for the tutorial (not yet implemented in this repo):

  • aiel.langchain_community.tools.tavily_search.TavilySearchResults

Project layout

  • src/aiel_sdk/sdk/* core decorators, registry, HTTP/MCP, and shim surfaces.
  • src/aiel/* explicit aiel.* namespace mirror for library-style imports.
  • src/aiel_sdk/examples/* small smoke examples.

What runs locally vs server-side

Local:

  • decorators and registry updates
  • basic graph wiring
  • type-checking and IDE support

Server-side (not implemented in this repo):

  • actual agent/tool execution
  • graph runtime
  • HTTP/MCP serving

Status

PyPI Backend integration: not implemented yet (planned per sprint output)

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

aiel_sdk-1.0.5.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

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

aiel_sdk-1.0.5-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file aiel_sdk-1.0.5.tar.gz.

File metadata

  • Download URL: aiel_sdk-1.0.5.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for aiel_sdk-1.0.5.tar.gz
Algorithm Hash digest
SHA256 85b30e9894f554d46444cd55a07fc61b279a4e425155c9ddd4a8a8d5281764ad
MD5 1ffb6003671aa0af8fb1a0dc31d157c0
BLAKE2b-256 4a46eca4db94a46a03d0d0fbc7bdfd94a0dbf231bd32c6fa2550a4c80c2c3850

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiel_sdk-1.0.5.tar.gz:

Publisher: publish.yml on aldenirsrv/AI_EXECUTION_LAYER_SDK

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

File details

Details for the file aiel_sdk-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: aiel_sdk-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for aiel_sdk-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 bd740bdab1aa6e52a95f0cbbdc6b72f23cdb7e6ae4e3081db9e076aab3617eca
MD5 efa5d4dee439074815f4a14170f0420c
BLAKE2b-256 0e8908769f41e53a09b9b9406f09ca5b4e88b9d58c766879702d902ed674ec0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiel_sdk-1.0.5-py3-none-any.whl:

Publisher: publish.yml on aldenirsrv/AI_EXECUTION_LAYER_SDK

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