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.10.0.tar.gz (32.8 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.10.0-py3-none-any.whl (30.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: api_operator-0.10.0.tar.gz
  • Upload date:
  • Size: 32.8 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.10.0.tar.gz
Algorithm Hash digest
SHA256 5bf96a7dcfae875e33902c78c124a10a49c77d1d1534d956c380bd1d95a40f0c
MD5 cdee502b224b849af8520a8351ad9306
BLAKE2b-256 bdf387c9db817e60d846ae69773c2ee038ae1fd8e995f090b9dede730ae7fee0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: api_operator-0.10.0-py3-none-any.whl
  • Upload date:
  • Size: 30.3 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.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f1633f858e9ba1e1f34cd0093ae5974e6e98c591ecb80d5d891b0d4542731e17
MD5 4276c80c224c65c9b406bfda17a74005
BLAKE2b-256 20f9540628842fbaf413a90b00d61a8c86dbab462c0efee7a0403f1e0344d2bd

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