Skip to main content

Standalone AI API Operator with pluggable adapters for multi-project APIs

Project description

API Operator

Tests License: MIT Python

Standalone AI operator runtime with pluggable adapters. Talk to your HTTP APIs instead of clicking through admin panels.

Works with Laravel, Go, connectivity platforms, or any backend with a REST API.

Install

git clone https://github.com/mohammedelkarsh/api-operator.git
cd api-operator
pip install -e ".[dev]"

Optional OpenAI planner:

pip install -e ".[dev,llm]"

Quick start

api-operator demo
api-operator tools --adapter mock

What ships in the core package

In core In your projects
Agent runtime (plan, guard, execute) adapter.yaml per API
mock adapter (demo + tests) OpenAPI specs
yaml adapter API tokens in .env
CLI + HTTP server Optional custom adapters

Build an adapter without Python

Scaffold template

api-operator scaffold-adapter my-api --output examples

Generate from OpenAPI

api-operator generate-from-openapi openapi.yaml \
  --output adapter.yaml \
  --base-url http://api.example.test \
  --path-prefix /api

Laravel Tenant Kit example

See examples/tenant-kit-adapter/ — pairs with laravel-tenant-kit.

export TENANT_KIT_API_TOKEN="your-sanctum-token"
api-operator chat \
  --adapter yaml \
  --config examples/tenant-kit-adapter/adapter.yaml \
  --base-url http://laravel-tenant-kit.test

adapter.yaml (minimal)

name: my_project
description: My API adapter
base_url: http://api.example.test

auth:
  type: bearer
  env_token: MY_PROJECT_API_TOKEN

tools:
  - name: list_items
    description: List items
    method: GET
    path: /api/items

  - name: create_item
    description: Create item
    method: POST
    path: /api/items
    dangerous: true
    parameters:
      title:
        type: string
        required: true
    body:
      title: "{title}"

Tenant subdomain APIs:

  - name: invite_member
    method: POST
    path: /api/team/invitations
    host: tenant
    tenant_param: subdomain
    parameters:
      subdomain: { type: string, required: true }
      email: { type: string, required: true }

HTTP server

api-operator serve --port 8100
POST /v1/chat
{
  "adapter": "yaml",
  "config_path": "examples/tenant-kit-adapter/adapter.yaml",
  "adapter_config": { "token": "YOUR_TOKEN" },
  "message": "list workspaces",
  "abilities": ["workspaces:read"]
}

Integration test (Tenant Kit)

With Tenant Kit running:

python scripts/integration_tenant_kit.py
# Docker on port 8080:
python scripts/integration_tenant_kit.py --base-url http://laravel-tenant-kit.test:8080

Optional pytest marker (requires env vars):

export TENANT_KIT_BASE_URL=http://laravel-tenant-kit.test
export TENANT_KIT_API_TOKEN=your-token
pytest -m integration -q

Tests

pytest -q

Configuration

Copy .env.example to .env for local defaults (api_operator_PLANNER, port, etc.).

Architecture

api-operator (core)          your projects
├── agent runtime               ├── adapter.yaml
├── mock + yaml adapters        ├── openapi.yaml
└── scaffold / generate CLI     └── HTTP APIs (Laravel, Go, …)

License

MIT — see LICENSE.

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

api_operator-0.9.0.tar.gz (29.4 kB view details)

Uploaded Source

Built Distribution

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

api_operator-0.9.0-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

Details for the file api_operator-0.9.0.tar.gz.

File metadata

  • Download URL: api_operator-0.9.0.tar.gz
  • Upload date:
  • Size: 29.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for api_operator-0.9.0.tar.gz
Algorithm Hash digest
SHA256 217dd9331e8f3993d616f3eb1c14314c8bbd3b989a89a0707b50580ffeef858b
MD5 e8db0fc627ac123b92a0adc407b09eda
BLAKE2b-256 aeb133c7ee7cbf8772e165e7798d4a09b6146ee0d5fe4450aa5c7dcf53dd0937

See more details on using hashes here.

File details

Details for the file api_operator-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: api_operator-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 27.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for api_operator-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1adf5279b59489c5fff8e828f809d755477e5da42a5de3c394c0d71f26b06d58
MD5 4c5bd9842b8efed799cdec647b436741
BLAKE2b-256 1e91eec94f9707e1d7fd80f839e0bcc10e61822e70bf7d07cb37ea09cf2c0a08

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