> ## Documentation Index
> Fetch the complete documentation index at: https://docs.emergence.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# SDKs & Client Libraries

> Auto-generated Python and TypeScript SDKs for CRAFT APIs

# SDKs & Client Libraries

CRAFT provides auto-generated SDKs for **Python** and **TypeScript**, built from OpenAPI specifications on every release.

<CardGroup cols={2}>
  <Card title="Python SDK" icon="python" href="/sdks/python">
    Type-safe Python client with async support, Pydantic models, and full API coverage.
  </Card>

  <Card title="TypeScript SDK" icon="js" href="/sdks/typescript">
    Fully typed TypeScript client for Node.js and browser environments.
  </Card>
</CardGroup>

## Available SDKs

| Package        | Python (PyPI)               | TypeScript (npm)                          | API                                               |
| -------------- | --------------------------- | ----------------------------------------- | ------------------------------------------------- |
| **Governance** | `em-runtime-governance-sdk` | `@emergence-ai/em-runtime-governance-sdk` | Organizations, Projects, Permissions              |
| **Assets**     | `em-runtime-assets-sdk`     | `@emergence-ai/em-runtime-assets-sdk`     | Data Connections, Artifacts, Files, Models        |
| **Utils**      | `em-runtime-utils-sdk`      | `@emergence-ai/em-runtime-utils-sdk`      | Data Catalog, Scheduling, Context Packs, Memories |

## SDK Generation Pipeline

SDKs are auto-generated from OpenAPI specs using [openapi-python-client](https://github.com/openapi-generators/openapi-python-client) and the OpenAPI Generator for TypeScript. The pipeline runs on every final release:

<Steps>
  <Step title="Extract OpenAPI specs">
    FastAPI apps export their schemas via `app.openapi()` at build time.
  </Step>

  <Step title="Generate client code">
    OpenAPI specs are fed to code generators producing typed clients with models, API classes, and authentication helpers.
  </Step>

  <Step title="Publish packages">
    Python SDKs publish to Google Artifact Registry. TypeScript SDKs publish to the `@emergence-ai` npm scope.
  </Step>

  <Step title="Version sync">
    SDK versions match the platform release version (e.g., platform v5.28.0 → SDK v5.28.0).
  </Step>
</Steps>

<Note>
  SDK versions may lag behind the latest platform service versions. For example, the Runtime UI may use Assets SDK v5.27.0 while the Assets service is at v5.28.0. SDKs are backward-compatible, newer service versions serve older SDK clients without issue. Check the release notes for current versions.
</Note>

## Authentication

All SDKs use JWT bearer token authentication via Keycloak:

<CodeGroup>
  ```python theme={null}
  from em_runtime_governance_sdk import AuthenticatedClient

  client = AuthenticatedClient(
      base_url="https://your-instance.emergence.ai",
      token="your-jwt-token"
  )
  ```

  ```typescript theme={null}
  import { Configuration, OrganizationsApi } from '@emergence-ai/em-runtime-governance-sdk';

  const config = new Configuration({
    basePath: 'https://your-instance.emergence.ai',
    accessToken: 'your-jwt-token',
  });

  const api = new OrganizationsApi(config);
  ```
</CodeGroup>

## Registry Configuration

SDKs are hosted on Google Artifact Registry (private). Configure your package manager:

<Tabs>
  <Tab title="Python (pip/uv)">
    ```bash theme={null}
    # Add the Artifact Registry index
    uv add em-runtime-governance-sdk --index-url https://us-central1-python.pkg.dev/aip-artifacts-store/aipy/simple/

    # Or with pip
    pip install em-runtime-governance-sdk \
      --index-url https://us-central1-python.pkg.dev/aip-artifacts-store/aipy/simple/
    ```
  </Tab>

  <Tab title="TypeScript (npm)">
    ```bash theme={null}
    # Configure the @emergence-ai scope
    echo "@emergence-ai:registry=https://us-central1-npm.pkg.dev/aip-artifacts-store/aip-npm/" >> .npmrc

    # Install
    npm install @emergence-ai/em-runtime-governance-sdk
    ```
  </Tab>
</Tabs>

<Info>
  Registry authentication requires Google Cloud credentials. See your platform admin for access tokens or Workload Identity setup.
</Info>

## Next Steps

<CardGroup cols={2}>
  <Card title="Python SDK Guide" icon="python" href="/sdks/python">
    Installation, usage patterns, error handling
  </Card>

  <Card title="TypeScript SDK Guide" icon="js" href="/sdks/typescript">
    Setup, type safety, async patterns
  </Card>

  <Card title="API Reference" icon="book" href="/api-reference/introduction">
    Interactive API playground with all endpoints
  </Card>

  <Card title="Authentication" icon="lock" href="/platform/authentication">
    Keycloak OIDC setup and token management
  </Card>
</CardGroup>
