> **Building with AI coding agents?** Install the authstack plugin with one command. This equips your agent with accurate Scalekit implementation patterns.
>
> **Recommended** (the `-y` flags skip prompts, so the command runs without an interactive terminal):
> ```bash
> npx -y @scalekit-inc/cli setup -y
> ```
>
> Global:
> ```bash
> npm install -g @scalekit-inc/cli
> scalekit setup -y
> ```
>
> Supports Claude Code, Cursor, GitHub Copilot, Codex + skills for other Agent Skills-compatible agents in `~/.agents/skills`.
> Skills: integrate-agentkit, implement-saaskit, add-mcp-oauth, implement-sso, implement-scim.
> [Full setup guide](https://docs.scalekit.com/dev-kit/build-with-ai/)

---

# Quickstart

Make your first AgentKit tool call in Python, Node.js or cURL: install the SDK, add your credentials, and call GitHub as yourself.
AgentKit lets your AI agents act in your users' apps on their behalf. New to it? Read [What is AgentKit](/agentkit/overview/). Adding login to your own app instead? See the [SaaSKit quickstart](/authenticate/fsa/quickstart/).

Connect your own GitHub account and make your first tool call as that user. New Scalekit environments include a GitHub connection, so there's nothing to set up in GitHub. **About 10 minutes.**

## Before you start

- A Scalekit account at [app.scalekit.com](https://app.scalekit.com)
- Python 3.11+, Node.js 18.14+, or `curl` and [`jq`](https://jqlang.org/)
- Your environment URL, client ID and client secret. Open **Developers** > **Settings** > **API Credentials**: copy the **Environment URL** and **Client ID** from **Environment details**, then select **Generate new secret** under **Client secrets**. The secret is shown once, so copy it right away. See [API credentials](/agentkit/api-credentials/).
- The GitHub connection name from **AgentKit** > **Connections**. New environments call it `github-connect`. No GitHub connection? Create one in **AgentKit** > **Connections** (see [Set up a connection](/agentkit/connections/)) and use its name.
- **AgentKit** > **Settings** > **User Verification** set to **None** or **Scalekit users only**. With **Scalekit users only**, stay signed in to the dashboard in the same browser when you approve access.

1. ## Install the SDK

   **Python**

   ```sh
   pip install scalekit-sdk-python python-dotenv
   ```

   **Node.js**

   ```sh
   npm init -y
   npm pkg set type=module
   npm install @scalekit-sdk/node dotenv
   npm install -D tsx
   ```

2. ## Add your credentials

   Create a `.env` file next to your script. Don't commit it.

   ```sh title=".env"
   SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
   SCALEKIT_CLIENT_ID=<client-id>
   SCALEKIT_CLIENT_SECRET=<client-secret>
   GITHUB_CONNECTION_NAME=github-connect
   ```

3. ## Write the script

   Save this as `agent.py`, `agent.ts` or `agent.sh`. It connects the user if needed, then calls GitHub as them.

   **Python**

   ```python title="agent.py"
   import os

   from dotenv import load_dotenv
   from scalekit import ScalekitClient
   from scalekit.common.exceptions import ScalekitServerException

   load_dotenv()

   scalekit_client = ScalekitClient(
       env_url=os.environ["SCALEKIT_ENVIRONMENT_URL"],
       client_id=os.environ["SCALEKIT_CLIENT_ID"],
       client_secret=os.environ["SCALEKIT_CLIENT_SECRET"],
   )
   actions = scalekit_client.actions

   connection_name = os.environ["GITHUB_CONNECTION_NAME"]
   user_id = "user_123"  # your app's ID for this user: stable and hard to guess

   # Find this user's connected account, or create it on the first run
   account = actions.get_or_create_connected_account(
       connection_name=connection_name,
       identifier=user_id,
   ).connected_account

   if account.status != "ACTIVE":
       link = actions.get_authorization_link(
           connection_name=connection_name,
           identifier=user_id,
       ).link
       print(f"Open this link and approve access:\n{link}")
       input("Press Enter when you're done...")

       account = actions.get_connected_account_details(
           connection_name=connection_name,
           identifier=user_id,
       ).connected_account
       if account.status != "ACTIVE":
           raise SystemExit(f"The account is {account.status}, not ACTIVE. Run the script again.")

   # Call GitHub as this user. The tool is read-only.
   try:
       result = actions.execute_tool(
           tool_name="github_user_get_authenticated",
           tool_input={},
           connected_account_id=account.id,
       )
   except ScalekitServerException as e:
       raise SystemExit(f"Tool call failed: {e.error_code} {e.message}")
   print(result.data)
   ```

   **Node.js**

   ```ts title="agent.ts"
   import 'dotenv/config';
   import { createInterface } from 'node:readline/promises';
   import { ConnectorStatus, ScalekitClient, ScalekitServerException } from '@scalekit-sdk/node';

   const scalekit = new ScalekitClient(
     process.env.SCALEKIT_ENVIRONMENT_URL!,
     process.env.SCALEKIT_CLIENT_ID!,
     process.env.SCALEKIT_CLIENT_SECRET!,
   );
   const actions = scalekit.actions;

   const connectionName = process.env.GITHUB_CONNECTION_NAME!;
   const userId = 'user_123'; // your app's ID for this user: stable and hard to guess

   // Find this user's connected account, or create it on the first run
   let { connectedAccount: account } = await actions.getOrCreateConnectedAccount({
     connectionName,
     identifier: userId,
   });

   if (account?.status !== ConnectorStatus.ACTIVE) {
     const { link } = await actions.getAuthorizationLink({ connectionName, identifier: userId });
     console.log(`Open this link and approve access:\n${link}`);
     const rl = createInterface({ input: process.stdin, output: process.stdout });
     await rl.question("Press Enter when you're done...");
     rl.close();

     ({ connectedAccount: account } = await actions.getConnectedAccount({
       connectionName,
       identifier: userId,
     }));
     if (account?.status !== ConnectorStatus.ACTIVE) {
       throw new Error('The account is not ACTIVE yet. Run the script again.');
     }
   }

   // Call GitHub as this user. The tool is read-only.
   try {
     const result = await actions.executeTool({
       toolName: 'github_user_get_authenticated',
       toolInput: {},
       connectedAccountId: account.id,
     });
     console.log(result.data);
   } catch (err) {
     if (!(err instanceof ScalekitServerException)) throw err;
     console.error('Tool call failed:', err.errorCode, err.message);
     process.exit(1);
   }
   ```

   **cURL**

   ```bash title="agent.sh"
   #!/usr/bin/env bash
   set -euo pipefail
   set -a; source .env; set +a

   USER_ID="user_123" # your app's ID for this user: stable and hard to guess
   API="$SCALEKIT_ENVIRONMENT_URL/api/v1"

   # Exchange your API credentials for an access token
   TOKEN=$(curl -sS "$SCALEKIT_ENVIRONMENT_URL/oauth/token" \
     -d grant_type=client_credentials \
     -d client_id="$SCALEKIT_CLIENT_ID" \
     -d client_secret="$SCALEKIT_CLIENT_SECRET" | jq -r .access_token)

   account_status() {
     curl -sS -G "$API/connected_accounts/details" \
       -H "Authorization: Bearer $TOKEN" \
       --data-urlencode "connector=$GITHUB_CONNECTION_NAME" \
       --data-urlencode "identifier=$USER_ID" |
       jq -r '.connected_account.status // "NOT_CREATED"'
   }

   if [ "$(account_status)" != "ACTIVE" ]; then
     # Creates the connected account on the first run, and returns a link
     LINK=$(curl -sS "$API/connected_accounts/magic_link" \
       -H "Authorization: Bearer $TOKEN" \
       -H "Content-Type: application/json" \
       -d "{\"connector\": \"$GITHUB_CONNECTION_NAME\", \"identifier\": \"$USER_ID\"}" |
       jq -r .link)
     printf 'Open this link and approve access:\n%s\n' "$LINK"
     read -r -p "Press Enter when you're done..."

     STATUS=$(account_status)
     if [ "$STATUS" != "ACTIVE" ]; then
       echo "The account is $STATUS, not ACTIVE. Run the script again." >&2
       exit 1
     fi
   fi

   # Call GitHub as this user. The tool is read-only.
   curl -sS "$API/execute_tool" \
     -H "Authorization: Bearer $TOKEN" \
     -H "Content-Type: application/json" \
     -d "{\"tool_name\": \"github_user_get_authenticated\", \"connector\": \"$GITHUB_CONNECTION_NAME\", \"identifier\": \"$USER_ID\", \"params\": {}}" |
     jq .data
   ```

   `user_123` stands in for your app's user ID. [Choose an identifier](/agentkit/concepts/#choose-an-identifier) explains what to use in production.

4. ## Run it

   **Python**

   ```sh
   python agent.py
   ```

   **Node.js**

   ```sh
   npx tsx agent.ts
   ```

   **cURL**

   ```sh
   bash agent.sh
   ```

   The first run prints a link. Open it, approve access on GitHub, then press Enter. You'll see your GitHub profile. Run it again: the account is already `ACTIVE`, so the script skips the link.

## If it doesn't work

### `connection not found for the given key`

`GITHUB_CONNECTION_NAME` doesn't match the dashboard exactly. Copy it again from **AgentKit** > **Connections**.

### The account stays `PENDING_AUTH`

The approval wasn't finished, or the link expired. Links last five minutes by default. Run the script again for a fresh link.

### `user_verify_url is required when user_verify_mode is b2b`

User verification is set to **Custom user verifier**, so the link request needs a verify URL. For this quickstart, use **None** or **Scalekit users only** in **AgentKit** > **Settings** > **User Verification**. To set up the custom user verifier, see [Verify users](/agentkit/user-verification/).

### `KeyError: 'SCALEKIT_ENVIRONMENT_URL'` or `TypeError: Invalid URL`

The `.env` file wasn't loaded. Run the script from the folder that contains it.

### `401` or `invalid_client`

The client ID or secret is wrong, or the secret was regenerated.

### Still stuck?

Find the error message or the account status on [Troubleshoot connection and OAuth errors](/agentkit/troubleshooting/). It covers each connected-account status, the errors on Scalekit's connection page, OAuth app misconfiguration and provider-specific errors.

## Next

  - [How AgentKit works](/agentkit/concepts/): What you just created, and why.
  - [Set up a connection](/agentkit/connections/): Connect Gmail, Slack or any other app.
  - [Choose a framework](/agentkit/examples/): LangChain, OpenAI, Anthropic and more.

Before real users connect accounts, [verify users](/agentkit/user-verification/).

## API reference

The endpoints this page's code calls, with every field and the SDK method for each:

- `POST` [Create a connected account](https://docs.scalekit.com/agentkit/reference/connected-accounts/create-a-connected-account.md)
- `GET` [Get a connected account](https://docs.scalekit.com/agentkit/reference/connected-accounts/get-a-connected-account.md)
- `GET` [Get a connected account's credentials](https://docs.scalekit.com/agentkit/reference/connected-accounts/get-connected-account-credentials.md)
- `POST` [Get an authorization link](https://docs.scalekit.com/agentkit/reference/authorization/get-an-authorization-link.md)
- `POST` [Execute a tool](https://docs.scalekit.com/agentkit/reference/tools/execute-a-tool.md)


---

## More Scalekit documentation

| Resource | What it contains | When to use it |
|----------|-----------------|----------------|
| [/llms.txt](/llms.txt) | Structured index with routing hints per product area | Start here — find which documentation set covers your topic before loading full content |
| [/llms-full.txt](/llms-full.txt) | Complete documentation for all Scalekit products in one file | Use when you need exhaustive context across multiple products or when the topic spans several areas |
| [sitemap-0.xml](https://docs.scalekit.com/sitemap-0.xml) | Full URL list of every documentation page | Use to discover specific page URLs you can fetch for targeted, page-level answers |
