Skip to main content

🐝 Imperal SDK (imperal-sdk)

Part of Imperal - The Ecosystem for AI, Agents, and People

Build apps and extensions for Imperal Cloud in plain, typed Python: your function signatures become the tool schema, your return values become the UI, and the same app works in the terminal, the web workspace, and Telegram.

PyPI Python License: AGPL-3.0 Protocol: ICNLI Imperal Ecosystem

Documentation · ICNLI Protocol · Imperal Panel · Marketplace


🌐 One ecosystem, one SDK

Imperal is one ecosystem that unites AI, agents, and people. An app you write with imperal-sdk is one more piece of it: people reach it from the web workspace, from Webbee Code in the terminal, from Telegram, and AI agents call it through imperal-mcp. Its results render with @imperal/ui-kit on every surface. ICNLI is the open protocol that ties these parts together.

What the SDK takes off your hands:

  • No hand-written manifest. Tool names, parameter schemas, descriptions and scopes come from your Python signatures, type hints and docstrings.
  • No frontend code for results. Return a dict or a list of dicts and it renders as a metric card or a table. Need more control? Return declarative UI.
  • Platform services in one argument. ctx: Context gives your tool identity, storage, AI completion, notifications, billing and more, and it never appears in the tool schema the model sees.
  • One app, every surface. The same tool works in the terminal, the panel and Telegram; ctx.surface tells you where it runs.
  • Runs almost anywhere. requires-python >= 3.6, tested on 3.6 through 3.14.

🚀 Quick start

1. Install

pip install imperal-sdk

2. Your first app (server_pulse.py)

from imperal_sdk import App, Context

app = App("server-pulse", name="Server Pulse", category="devops")

@app.tool(pricing=5, destructive=False)
def check_host(host: str, port: int = 443, ctx: Context = None) -> dict:
    """Check server availability and SSL certificate expiration."""
    is_online = True   # your real check goes here
    ssl_days = 89

    return {
        "status": "online" if is_online else "down",
        "host": host,
        "ssl_days": ssl_days,
        "metric": f"{ssl_days} days left",
    }

What you get from those lines

  • ✅ A manifest - app.to_manifest() returns it, built from the code.
  • ✅ A typed schema - host (required string) and port (integer, default 443).
  • ✅ A description - the docstring becomes the tool description.
  • ✅ A scope - server-pulse:check_host is registered for the tool.
  • ✅ A hidden context - ctx is injected at run time and left out of the schema.
  • ✅ A UI - the returned dict carries a metric_card projection under _ui, which the panel renders as a card.

3. The CLI

imperal init my-app          # scaffold a project (--template chat|tool)
imperal validate .           # check the extension against the SDK rules (--fix fills boilerplate)
imperal dev                  # local development server with hot reload
imperal test                 # run the extension tests
imperal build .              # generate the imperal.json manifest
imperal deploy               # deploy to your Imperal Cloud account
imperal logs                 # recent deploy history and how to read the logs
imperal schedules            # your scheduled jobs and their next runs

💎 Core features

1. ⚡ Schemas from type hints

from typing import List, Optional

@app.tool()
async def deploy_services(
    environment: str,
    replicas: int = 3,
    tags: Optional[List[str]] = None,
    dry_run: bool = False,
) -> dict:
    """Deploy service instances to the given environment."""
    ...

Becomes:

{
  "name": "deploy_services",
  "description": "Deploy service instances to the given environment.",
  "parameters": {
    "type": "object",
    "properties": {
      "environment": { "type": "string" },
      "replicas": { "type": "integer", "default": 3 },
      "tags": { "type": "array", "items": { "type": "string" } },
      "dry_run": { "type": "boolean", "default": false }
    },
    "required": ["environment"]
  }
}

2. 🎨 UI as data

Your return value What people see
A dict with status, metric, count, value or state 🎴 Metric card with a badge, a headline metric and details
A list of dicts 📊 Table with columns taken from the first row
A dict with _ui (or declarative_ui) 🧩 Your own declarative UI, built from @imperal/ui-kit components

3. 🔮 The context

@app.tool()
async def analyze_cluster(cluster_id: str, ctx: Context = None) -> dict:
    last_run = await ctx.store.get(f"scan:{cluster_id}")          # per-app storage
    verdict = await ctx.ai.complete(f"Diagnose cluster {cluster_id}")  # AI completion
    return {
        "status": "analyzed",
        "verdict": verdict.text,
        "initiated_by": ctx.user.email,
        "metric": "clean",
    }

Context also carries ctx.notify, ctx.billing, ctx.storage, ctx.http, ctx.config, ctx.cache, ctx.secrets, ctx.extensions, ctx.time and ctx.progress(). See the documentation for each.

4. 🔀 Every surface

ctx.surface is "terminal", "panel", "telegram" or "ambient", so a tool can shape its answer for the place it is used. Declarative UI renders in the panel; the terminal and Telegram get a compact form of the same result.

5. 🔗 Tools that work together

Tools are chain-callable by default (chain_callable=True): a request in plain language can use tools from different apps one after another, each with typed inputs and outputs.

"Fetch my domains from the DNS checker, pass them to the SSL auditor, and tell me on Telegram if one expires soon."

6. 🧱 Classic extensions still work

App is a subclass of imperal_sdk.Extension, so existing extensions built on Extension keep working next to new App code.


🧪 Local testing, no network

from imperal_sdk.testing import MockContext
from server_pulse import check_host

def test_check_host_locally():
    ctx = MockContext(user_id="test_user", role="admin")
    result = check_host(host="imperal.io", port=443, ctx=ctx)

    assert result["status"] == "online"
    assert result["_ui"]["type"] == "metric_card"
    assert result["_ui"]["badge"] == "online"
pytest -v

MockContext stands in for the platform: store, AI, billing, notifications, storage, HTTP and config are in-memory mocks.


🏗️ Where your app lives

                 People and AI agents
   (web workspace · Webbee Code · Telegram · imperal-mcp)
                          │  plain-language requests, tool calls
                          ▼
                ┌───────────────────┐
                │   Imperal Cloud   │   accounts, memory, permissions, billing
                └─────────┬─────────┘
                          │  typed calls with a Context
                          ▼
                ┌───────────────────┐
                │   your App        │   imperal_sdk.App / Extension
                └─────────┬─────────┘
                          │  data + declarative UI
                          ▼
            rendered by @imperal/ui-kit on every surface

🌐 The Imperal Ecosystem

Part What it is License
Imperal Cloud The platform: accounts, memory, apps and the marketplace Service
imperal-panel The open web workspace for people and agents AGPL-3.0
Webbee Code The open-source terminal coding agent GPL-3.0-or-later
imperal-mcp Memory, a code map, undo and a fact check for Claude Code, Cursor, Codex, Gemini CLI and other MCP clients GPL-3.0-only
imperal-sdk 📍 you are here The Python SDK for apps and extensions AGPL-3.0-only
@imperal/ui-kit The React renderer for declarative UI Apache-2.0
@imperal/design-tokens Shared design tokens and theme presets Apache-2.0
ICNLI The open protocol of the ecosystem CC BY-SA 4.0

📜 Compatibility & license

  • Python: 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13 and 3.14.
  • Protocol: ICNLI, an open specification under CC BY-SA 4.0.
  • License: AGPL-3.0-only.
  • Security: report vulnerabilities to support@imperal.io.

Imperal - The Ecosystem for AI, Agents, and People. Created by Valentin Scerbacov and built at Imperal with the open-source community. 🐝

Metadata

Release files for imperal-sdk 6.18.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for imperal-sdk 6.18.0
File Size Uploaded Provenance Actions
imperal_sdk-6.18.0.tar.gz 1.1 MB With provenance Details for imperal_sdk-6.18.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for imperal-sdk 6.18.0
File Interpreter ABI Platform Actions
imperal_sdk-6.18.0-py3-none-any.whl Python 3 none any Details for imperal_sdk-6.18.0-py3-none-any.whl

Total release size: 1.6 MB

Release files / imperal_sdk-6.18.0.tar.gz

Download URL imperal_sdk-6.18.0.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
9303fb7cd6fc10a2bb3a2be571b0e58ffb3abcade13b8b4ff07c0808056d7eee
BLAKE2b-256 checksum
How to use checksums
251d7c7284fbab35ab8f963e084b242c4b0139350a6ea71ca647bc480861ab92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.

Transparency log

Release files / imperal_sdk-6.18.0-py3-none-any.whl

Download URL imperal_sdk-6.18.0-py3-none-any.whl
Size 528.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
663f9762d7473b35048a7b50bf8f587c4aa6c3c8863f01ac8bb8dd31514d85ba
BLAKE2b-256 checksum
How to use checksums
1c74a4d18545d5eba1e773ed7756118c2555f7dd1a87ed04c89d5c86265fba75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.

Transparency log

Security for imperal-sdk 6.18.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for imperal_sdk-6.18.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

6.18.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page