HomeDocsCLI Reference (afctl)

Agentic Fabriq CLI Reference

The afctl command-line interface provides tools for managing authentication, tool connections, and applications in Agentic Fabriq.

Installation

pip install agentic-fabriq-sdk

After installation, the afctl command will be available in your terminal.

Global Options

These options can be used with any command:

OptionDescription
--config PATHPath to configuration file
--gateway-url URLGateway URL (default: https://dashboard.agenticfabriq.com)
--tenant-id IDTenant ID
--verboseEnable verbose output

Global Commands

afctl version

Show version information.

afctl version

afctl status

Show system status and configuration.

afctl status

Output: A table showing gateway connection status, authentication status, and configuration file location.

afctl init

Initialize CLI configuration.

afctl init [OPTIONS]
OptionTypeDefaultDescription
--gateway-urlstringhttps://dashboard.agenticfabriq.comGateway URL
--tenant-idstringNoneTenant ID
--yesflagfalseSkip confirmation and overwrite existing config

Example:

afctl init --gateway-url https://dashboard.agenticfabriq.com

Authentication Commands (afctl auth)

afctl auth login

Login to Agentic Fabriq using OAuth2/PKCE flow. Opens your default browser for authentication with Keycloak. Tokens are securely stored locally.

afctl auth login [OPTIONS]
OptionTypeDefaultDescription
--tenant-idstringNoneTenant ID (optional, extracted from JWT)
--keycloak-urlstringhttps://auth.agenticfabriq.comKeycloak URL
--orgstringNoneOrganization URL for team login (e.g., freebies.com). Routes to your org's dedicated authentication realm.
--remoteflagfalseUse device code flow for headless/remote machines. Displays a URL and code — authorize from any browser without needing one on the machine.
--yesflagfalseSkip confirmation when already authenticated

Examples:

# Individual user login
afctl auth login

# Team organization login
afctl auth login --org freebies.com

# Login with saved organization
afctl config set organization_url freebies.com
afctl auth login

# Device code flow (headless/remote machines — no browser needed)
afctl auth login --remote

# Combine: remote + org
afctl auth login --remote --org freebies.com

afctl auth logout

Logout from Agentic Fabriq. Revokes tokens and clears local authentication state.

afctl auth logout [OPTIONS]

afctl auth status

Show authentication status and token information.

afctl auth status

Output: A table showing authentication status (authenticated/expired), name, email, user ID, tenant ID, organization ID, token expiration time, refresh token availability, and gateway URL.

afctl auth refresh

Refresh authentication token. Uses the refresh token to obtain a new access token without requiring interactive login.

afctl auth refresh [OPTIONS]

afctl auth token

Display the current access token.

afctl auth token [OPTIONS]
OptionTypeDefaultDescription
--fullflagfalseShow full token (warning: sensitive information)

Examples:

# Show truncated token
afctl auth token

# Show full token
afctl auth token --full

afctl auth whoami

Display information about the currently authenticated user.

afctl auth whoami

Output: A table showing name, email, user ID, and tenant.

MCP Broker (afctl broker)

Run a local MCP broker that connects coding agents (Claude Code, Cursor, Codex) to Agentic Fabriq. This command is typically not run manually — it is spawned automatically by the coding agent based on your MCP config.

afctl broker [OPTIONS]
OptionTypeDefaultDescription
--agentstringauto-detectedOverride agent name (e.g., claude-code, cursor, codex). Normally auto-detected from parent process.
--skip-detectionflagfalseSkip parent process detection (testing only).

How it works:

  • Communicates via stdio (JSON-RPC 2.0) with the coding agent
  • Proxies MCP requests (list_tools, call_tool) to the Agentic Fabriq gateway via WebSocket
  • Sends heartbeats every 60 seconds to keep the session alive
  • Session auto-expires ~3 minutes after the broker process exits
  • Transparently re-establishes session if the auth token expires

MCP config example (place in ~/.claude/mcp.json or ~/.cursor/mcp.json):

{
  "mcpServers": {
    "agentic-fabriq": {
      "command": "afctl",
      "args": ["broker"]
    }
  }
}

Note: For Cursor Remote SSH, use the full path to afctl since remote sessions don't source your shell profile (e.g., /home/ubuntu/.af-venv/bin/afctl).

VM Management (afctl vm)

Manage local virtual machines for computer-use coding agents.

afctl vm serve

Start the local VM management server. Provides a REST API for creating, starting, stopping, and deleting QEMU-based VMs. Automatically connects to the Agentic Fabriq dashboard via WebSocket relay if authenticated.

afctl vm serve [OPTIONS]
OptionTypeDefaultDescription
--port, -pinteger7865Port for the VM management server

Examples:

# Start with default port
afctl vm serve

# Start on custom port
afctl vm serve --port 8080

Prerequisites: QEMU must be installed (brew install qemu on macOS). Run afctl auth login before starting the server to enable dashboard integration. The relay connection persists even after your auth token expires.

Configuration Commands (afctl config)

afctl config show

Show current configuration.

afctl config show [OPTIONS]

afctl config set

Set a configuration value.

afctl config set KEY VALUE

Settable keys:

  • gateway_url - Gateway URL
  • keycloak_url - Keycloak URL
  • output_format - Default output format (table, json, yaml)
  • page_size - Default page size for list commands

Note: tenant_id cannot be set manually—it comes from authentication.

Examples:

afctl config set gateway_url https://dashboard.agenticfabriq.com
afctl config set output_format json
afctl config set page_size 50

afctl config get

Get a configuration value.

afctl config get KEY

Readable keys:

  • gateway_url, keycloak_url, keycloak_realm, keycloak_client_id
  • tenant_id, output_format, page_size, config_file
  • verbose, authenticated

Example:

afctl config get gateway_url

afctl config reset

Reset configuration to defaults.

afctl config reset [OPTIONS]

Tool Commands (afctl tools)

afctl tools list

List your tool connections (configured and connected tools).

afctl tools list [OPTIONS]
OptionTypeDefaultDescription
--formatstringtableOutput format (table, json, yaml)
--pageint1Page number (starts from 1)
--page-sizeint20Items per page (1-100)
--searchstringNoneSearch query (searches tool IDs and connection names)
--toolstringNoneFilter by tool type (e.g., gmail, slack, google)

Examples:

# List all connections
afctl tools list

# Paginate results
afctl tools list --page 2 --page-size 10

# Search by tool type
afctl tools list --search gmail
afctl tools list --search google

# Filter by tool type
afctl tools list --tool slack

# Combined search and filtering
afctl tools list --tool google --search gmail

afctl tools get

Get tool connection details.

afctl tools get CONNECTION_ID [OPTIONS]

Example:

afctl tools get my-gmail

afctl tools add

Add a new tool connection with credentials.

afctl tools add TOOL [OPTIONS]
OptionTypeRequiredDescription
--connection-idstringYesUnique connection ID
--methodstringYesapi_credentials, oauth3 (platform OAuth), or oauth
--display-namestringNoHuman-readable name
--tokenstringNoAPI token (for simple token auth)
--client-idstringNoOAuth client ID (for app-based auth)
--client-secretstringNoOAuth client secret
--redirect-uristringNoOAuth redirect URI (auto-generated if not provided)

Methods:

  • oauth3 - Uses platform OAuth (recommended for Google, Slack, Notion, GitHub)
  • api_credentials - Uses your own credentials (token or client ID/secret)

Examples:

# Platform OAuth (no credentials needed)
afctl tools add google_drive --connection-id google-work --method oauth3
afctl tools add slack --connection-id slack-work --method oauth3
afctl tools add notion --connection-id notion-work --method oauth3
afctl tools add github --connection-id github-work --method oauth3

# API token (Notion integration token, Slack bot token)
afctl tools add notion --connection-id notion-work --method api_credentials \
  --token "secret_abc123"

# Your own OAuth app
afctl tools add google_drive --connection-id google-work --method api_credentials \
  --client-id "123.apps.googleusercontent.com" \
  --client-secret "GOCSPX-abc123"

Supported Google tools: google_drive, google_docs, google_sheets, google_slides, gmail, google_calendar, google_meet, google_forms, google_classroom, google_people, google_chat, google_tasks

afctl tools connect

Complete OAuth connection (opens browser for authorization).

afctl tools connect CONNECTION_ID [OPTIONS]

Example:

afctl tools connect my-gmail

afctl tools disconnect

Disconnect a tool (remove credentials but keep connection entry).

afctl tools disconnect CONNECTION_ID [OPTIONS]

Example:

afctl tools disconnect my-gmail
afctl tools disconnect my-gmail --force

afctl tools remove

Remove a tool connection completely (delete entry and credentials).

afctl tools remove CONNECTION_ID [OPTIONS]

Example:

afctl tools remove my-gmail
afctl tools remove my-gmail --force

Application Commands (afctl applications)

afctl applications register

Step 1: Register a new application (returns activation token).

afctl applications register [OPTIONS]
OptionTypeRequiredDescription
--app-idstringYesApplication identifier (no spaces)
--scopesstringYesScopes (format: provider:scope1,provider:scope2)
--display-namestringNoDisplay name for the application

Example:

afctl applications register \
  --app-id my-slack-bot \
  --scopes slack:channels:read,slack:chat:write,google:gmail.send \
  --display-name "My Slack Bot"

Output: Returns an activation token (valid for 1 hour, single use).

afctl applications activate

Step 2: Activate an application (saves credentials locally).

afctl applications activate [OPTIONS]
OptionTypeRequiredDescription
--app-idstringYesApplication identifier
--tokenstringYesActivation token from registration
--idp-client-idstringNoIdP Client ID (from Okta app)
--idp-client-secretstringNoIdP Client Secret
--skip-idpflagNoSkip IdP configuration prompts

Examples:

# Basic activation
afctl applications activate --app-id my-slack-bot --token <activation-token>

# With IdP credentials (for SSO organizations)
afctl applications activate --app-id my-bot --token <token> \
  --idp-client-id 0oa... --idp-client-secret <secret>

Output: Saves credentials to ~/.af/applications/{app_id}.json

afctl applications list

List all registered applications.

afctl applications list [OPTIONS]

Example:

afctl applications list
afctl applications list --format json

afctl applications show

Show details of a registered application.

afctl applications show APP_ID [OPTIONS]

Examples:

afctl applications show my-slack-bot
afctl applications show my-slack-bot --reveal-secret

afctl applications delete

Delete a registered application. Deletes the server registration, removes local credentials, and invalidates all active tokens.

afctl applications delete APP_ID [OPTIONS]

Examples:

afctl applications delete my-slack-bot
afctl applications delete my-slack-bot --yes

afctl applications test

Test application authentication. Attempts to exchange credentials for a token to verify the application is properly registered.

afctl applications test APP_ID

Example:

afctl applications test my-slack-bot

Configuration File

The CLI stores configuration at ~/.af/config.json:

{
  "gateway_url": "https://dashboard.agenticfabriq.com",
  "keycloak_url": "https://auth.agenticfabriq.com",
  "tenant_id": "uuid-...",
  "output_format": "table",
  "page_size": 20
}

Application credentials are stored in ~/.af/applications/{app_id}.json.

Environment Variables

The following environment variables can override configuration:

VariableDescription
AF_GATEWAY_URLGateway URL
AF_KEYCLOAK_URLKeycloak URL
AF_TENANT_IDTenant ID

Common Workflows

Individual User Setup

# Initialize and login
afctl init
afctl auth login

# Check status
afctl status
afctl auth whoami

Team Organization Setup

# Login to organization
afctl auth login --org mycompany.com

# Or save organization in config
afctl config set organization_url mycompany.com
afctl auth login

Adding a Tool Connection

# Add connection with platform OAuth
afctl tools add gmail --connection-id my-gmail --method oauth3

# Complete OAuth
afctl tools connect my-gmail

# Verify
afctl tools get my-gmail

Registering an Application

# Step 1: Register
afctl applications register \
  --app-id my-agent \
  --scopes slack:chat:write,google:gmail.send

# Step 2: Activate (use the token from step 1)
afctl applications activate --app-id my-agent --token <token>

# Test authentication
afctl applications test my-agent

Need help?

Our team is here to help you get started.