Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to WorkOS

Scalekit connector
Open markdown

The WorkOS connector lets your AI agent act in each user's WorkOS account. Each user connects their own WorkOS access token once, and Scalekit sends it with every call, so your agent never handles credentials. It comes with 73 tools.

Tools
73
What they doRead · write · destructive
40 · 24 · 940 read24 write9 destructive
Users sign in with

Setup

  1. Install the SDK

    Terminal window
    npm install @scalekit-sdk/node dotenv
  2. Set your credentials

    Add your Scalekit credentials to your .env file. Find values in app.scalekit.com > Developers > API Credentials.

    .env
    SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
    SCALEKIT_CLIENT_ID=<your-client-id>
    SCALEKIT_CLIENT_SECRET=<your-client-secret>
  3. Create the WorkOS connection

    In AgentKit > Connections, create a WorkOS connection. The name you give it is the connection_name your code passes. See Configure connections.

  4. Authorize a user and make your first call

    quickstart.mts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    import { createInterface } from 'node:readline/promises'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENVIRONMENT_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'workos'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize WorkOS:', link)
    const rl = createInterface({ input: process.stdin, output: process.stdout })
    await rl.question('Press Enter after authorizing...')
    rl.close()
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'workos_audit_log_actions_list',
    toolInput: {},
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user opens the link once and enters their WorkOS credentials there. See Authorize a user for the full flow and statuses.

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • workos_audit_log_actions_listList the audit log actions configured in the WorkOS environment.Read-only

    List Audit Log Actions

    List the audit log actions configured in the WorkOS environment. Returns a page of actions, each with its name and current schema, plus list_metadata cursors. Use this to see which action names workos_audit_log_event_create accepts; use workos_audit_log_schemas_list for one action's schema versions.

    Inputs

    afterstring
    Pagination cursor for the next page. Pass the list_metadata.after value from the previous response to get the records that come after it. Leave empty for the first page. Example: user.signed_in
    beforestring
    Pagination cursor for the previous page. Pass the list_metadata.before value from a response to get the records that come before it. Example: user.signed_in
    limitinteger
    Maximum number of records to return in one page, from 1 to 100. Defaults to 10. Example: 25default 10
    orderstring
    Sort order by creation time: desc (newest first), asc (oldest first), or normal (newest first with reversed cursor semantics). Defaults to normal (newest first). Example: descone of normaldescasc
  • workos_audit_log_export_getGet the status of an audit log export and, once ready, its download URL.Read-only

    Get Audit Log Export

    Get the status of an audit log export and, once ready, its download URL. Returns the export's state (pending, ready, or error) and url; the URL expires after 10 minutes, and fetching the export again issues a new one. Use this after workos_audit_log_export_create to wait for the export and download it.

    Inputs

    audit_log_export_idstringrequired
    Unique ID of the audit log export. Get it from workos_audit_log_export_create. Example: audit_log_export_01GBZK5MP7TD1YCFQHFR22180V
  • workos_audit_log_schemas_listList the schema versions of one audit log action.Read-only

    List Audit Log Schemas

    List the schema versions of one audit log action. Returns a page of schemas with version, actor, targets, and metadata definitions. Use this to see what fields an action's events must carry; use workos_audit_log_actions_list to find action names.

    Inputs

    action_namestringrequired
    Name of the audit log action. Get it from workos_audit_log_actions_list. Example: user.signed_in
    afterstring
    Pagination cursor for the next page. Pass the list_metadata.after value from the previous response to get the records that come after it. Leave empty for the first page. Example: audit_log_schema_01GBZK5MP7TD1YCFQHFR22180V
    beforestring
    Pagination cursor for the previous page. Pass the list_metadata.before value from a response to get the records that come before it. Example: audit_log_schema_01GBZK5MP7TD1YCFQHFR22180V
    limitinteger
    Maximum number of records to return in one page, from 1 to 100. Defaults to 10. Example: 25default 10
    orderstring
    Sort order by creation time: desc (newest first), asc (oldest first), or normal (newest first with reversed cursor semantics). Defaults to normal (newest first). Example: descone of normaldescasc
  • workos_connection_getGet one SSO or OAuth connection by its ID.Read-only

    Get Connection

    Get one SSO or OAuth connection by its ID. Returns the connection's name, connection_type, state (active, inactive, draft), organization_id, and domains. Use this to check whether a customer's SSO is active; use workos_connections_list to find connections by organization.

    Inputs

    connection_idstringrequired
    Unique ID of the connection. Get it from workos_connections_list. Example: conn_01E4ZCR3C56J083X43JQXF3JK5
  • workos_connections_listList SSO and OAuth connections, optionally filtered by organization, type, domain, or a name search.Read-only

    List Connections

    List SSO and OAuth connections, optionally filtered by organization, type, domain, or a name search. Returns a page of connections (id, organization_id, connection_type, name, state, domains) plus list_metadata cursors. Use this to find an organization's SSO connection; use workos_connection_get when you have a connection ID.

    Inputs

    afterstring
    Pagination cursor for the next page. Pass the list_metadata.after value from the previous response to get the records that come after it. Leave empty for the first page. Example: conn_01E4ZCR3C56J083X43JQXF3JK5
    beforestring
    Pagination cursor for the previous page. Pass the list_metadata.before value from a response to get the records that come before it. Example: conn_01E4ZCR3C56J083X43JQXF3JK5
    connection_typestring
    Return only connections of this type. Example: OktaSAMLone of ADFSSAMLAdpOidcAppleOAuthAuth0SAMLAzureSAMLBitbucketOAuthCasSAMLCloudflareSAMLClassLinkSAMLCleverOIDCCyberArkSAMLDuoSAMLEntraIdOIDCGenericOIDCGenericSAMLGithubOAuthGitLabOAuthGoogleOAuthGoogleOIDCGoogleSAMLIntuitOAuthJumpCloudSAMLKeycloakSAMLLastPassSAMLLinkedInOAuthLoginGovOidcMagicLinkMicrosoftOAuthMiniOrangeSAMLNetIqSAMLOktaOIDCOktaSAMLOneLoginSAMLOracleSAMLPingFederateSAMLPingOneSAMLRipplingSAMLSalesforceSAMLShibbolethGenericSAMLShibbolethSAMLSimpleSamlPhpSAMLSalesforceOAuthSlackOAuthVercelMarketplaceOAuthVercelOAuthVMwareSAMLXeroOAuth
    domainstring
    Return connections associated with this domain. Example: foo-corp.com
    limitinteger
    Maximum number of records to return in one page, from 1 to 100. Defaults to 10. Example: 25default 10
    orderstring
    Sort order by creation time: desc (newest first), asc (oldest first), or normal (newest first with reversed cursor semantics). Defaults to normal (newest first). Example: descone of normaldescasc
    organization_idstring
    Return connections that belong to this organization. Example: org_01EHZNVPK3SFK441A1RGBFSHRT
    searchstring
    Text to match against connection names. Example: Foo Corp
  • workos_directories_listList Directory Sync directories, optionally filtered by organization, domain, or a name search.Read-only

    List Directories

    List Directory Sync directories, optionally filtered by organization, domain, or a name search. Returns a page of directories (id, organization_id, name, type such as okta scim v2.0, state, domain) plus list_metadata cursors. Use this to find a customer's connected directory; use workos_directory_get when you have a directory ID.

    Inputs

    afterstring
    Pagination cursor for the next page. Pass the list_metadata.after value from the previous response to get the records that come after it. Leave empty for the first page. Example: directory_01ECAZ4NV9QMV47GW873HDCX74
    beforestring
    Pagination cursor for the previous page. Pass the list_metadata.before value from a response to get the records that come before it. Example: directory_01ECAZ4NV9QMV47GW873HDCX74
    domainstring
    Return directories associated with this domain. Example: foo-corp.com
    limitinteger
    Maximum number of records to return in one page, from 1 to 100. Defaults to 10. Example: 25default 10
    orderstring
    Sort order by creation time: desc (newest first), asc (oldest first), or normal (newest first with reversed cursor semantics). Defaults to normal (newest first). Example: descone of normaldescasc
    organization_idstring
    Return directories that belong to this organization. Example: org_01EHZNVPK3SFK441A1RGBFSHRT
    searchstring
    Text to match against directory names. Example: Foo Corp Okta
  • workos_directory_getGet one Directory Sync directory by its ID.Read-only

    Get Directory

    Get one Directory Sync directory by its ID. Returns the directory's name, type, state, domain, organization_id, and user and group counts. Use this to check a directory's sync state; use workos_directories_list to find directories by organization.

    Inputs

    directory_idstringrequired
    Unique ID of the directory. Get it from workos_directories_list. Example: directory_01ECAZ4NV9QMV47GW873HDCX74
  • workos_directory_group_getGet one directory group synced from a customer's identity provider.Read-only

    Get Directory Group

    Get one directory group synced from a customer's identity provider. Returns the group's name, idp_id, directory_id, organization_id, and raw_attributes. Use this when you have a directory_group_ ID; use workos_directory_groups_list to find groups in a directory.

    Inputs

    directory_group_idstringrequired
    Unique ID of the directory group. Get it from workos_directory_groups_list. Example: directory_group_01E1JJS84MFPPQ3G655FHTKX6Z