Connections
Learn how to configure and manage connections in Agent Actions to enable authentication and tool execution with third-party providers.
Connections in Agent Actions are specific configurations that define how your application authenticates and interacts with third-party providers. Each connection contains the necessary credentials, settings, and parameters required to establish secure communication with a provider’s API.
What are connections?
Section titled “What are connections?”Connections serve as the bridge between your Agent Actions setup and third-party providers. They contain:
- Authentication credentials (OAuth client ID/secret, API keys, etc.)
- Configuration settings (scopes, permissions, endpoints)
- Tool definitions and their parameters
- Rate limiting and retry policies
- Custom settings specific to your use case
Connection types
Section titled “Connection types”Agent Actions supports various connection types based on different authentication methods:
OAuth 2.0 connections
Section titled “OAuth 2.0 connections”Most modern APIs use OAuth 2.0 for secure authentication:
{ "connection_id": "conn_gmail_oauth", "provider": "gmail", "auth_type": "oauth2", "credentials": { "client_id": "your-client-id", "client_secret": "your-client-secret", "redirect_uri": "https://your-app.com/callback" }, "scopes": ["https://www.googleapis.com/auth/gmail.send"], "settings": { "auto_refresh": true, "expires_in": 3600 }}API key connections
Section titled “API key connections”Simple authentication using static API keys:
{ "connection_id": "conn_jira_api", "provider": "jira", "auth_type": "api_key", "credentials": { "api_key": "your-api-key", "base_url": "https://your-domain.atlassian.net" }, "settings": { "rate_limit": 100, "timeout": 30 }}Custom authentication
Section titled “Custom authentication”For providers with unique authentication requirements:
{ "connection_id": "conn_custom_auth", "provider": "custom_provider", "auth_type": "custom", "credentials": { "username": "your-username", "password": "your-password", "token": "bearer-token" }, "settings": { "auth_endpoint": "https://api.provider.com/auth", "refresh_endpoint": "https://api.provider.com/refresh" }}Creating connections
Section titled “Creating connections”Using the dashboard
Section titled “Using the dashboard”- Navigate to connections in your Agent Actions dashboard
- Select provider from the list of available providers
- Choose connection type based on your authentication method
- Configure credentials by entering your API keys or OAuth settings
- Set permissions and scopes for the connection
- Test connection to verify configuration
- Save connection for use with connected accounts
Using the API
Section titled “Using the API”Create connections programmatically using the Agent Actions API:
curl -X POST "https://api.scalekit.com/v1/connect/connections" \ -H "Authorization: Bearer YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "provider": "gmail", "auth_type": "oauth2", "credentials": { "client_id": "your-client-id", "client_secret": "your-client-secret" }, "scopes": ["https://www.googleapis.com/auth/gmail.send"], "settings": { "auto_refresh": true } }'const connection = await agentConnect.connections.create({ provider: 'gmail', auth_type: 'oauth2', credentials: { client_id: 'your-client-id', client_secret: 'your-client-secret' }, scopes: ['https://www.googleapis.com/auth/gmail.send'], settings: { auto_refresh: true }});connection = agent_connect.connections.create( provider='gmail', auth_type='oauth2', credentials={ 'client_id': 'your-client-id', 'client_secret': 'your-client-secret' }, scopes=['https://www.googleapis.com/auth/gmail.send'], settings={ 'auto_refresh': True })Connection configuration
Section titled “Connection configuration”Authentication settings
Section titled “Authentication settings”Configure authentication based on your provider’s requirements:
OAuth 2.0 settings:
- Client ID: Your OAuth application’s client identifier
- Client Secret: Your OAuth application’s client secret
- Redirect URI: Where users return after authorization
- Scopes: Permissions your application requests
- Authorization URL: Provider’s OAuth authorization endpoint
- Token URL: Provider’s token exchange endpoint
API Key settings:
- API Key: Your provider-issued API key
- Base URL: Provider’s API base URL
- Authentication Header: How the API key is sent (header, query param)
- Key Prefix: Any prefix required (e.g., “Bearer ”, “API-Key “)
Scopes and permissions
Section titled “Scopes and permissions”Define what your application can access:
Common scope patterns:
- Read-only: Access to view data only
- Read-write: Access to view and modify data
- Admin: Full administrative access
- Specific resources: Access to particular data types
Example scopes for popular providers:
// Gmail scopesconst gmailScopes = [ 'https://www.googleapis.com/auth/gmail.readonly', // Read emails 'https://www.googleapis.com/auth/gmail.send', // Send emails 'https://www.googleapis.com/auth/gmail.modify' // Modify emails];
// Slack scopesconst slackScopes = [ 'channels:read', // Read channel information 'chat:write', // Send messages 'files:read' // Read file information];
// Jira scopesconst jiraScopes = [ 'read:jira-work', // Read issues and projects 'write:jira-work', // Create and update issues 'manage:jira-project' // Manage projects];Rate limiting and throttling
Section titled “Rate limiting and throttling”Configure how your connection handles API rate limits:
{ "rate_limiting": { "requests_per_minute": 100, "requests_per_hour": 1000, "burst_limit": 10, "backoff_strategy": "exponential", "retry_attempts": 3 }}Connection settings
Section titled “Connection settings”Customize connection behavior:
Token management:
- Auto-refresh: Automatically refresh expired tokens
- Token expiry: How long tokens remain valid
- Refresh buffer: Refresh tokens before expiry
- Token storage: Where tokens are securely stored
Request settings:
- Timeout: Maximum request duration
- Retry policy: How failed requests are retried
- User agent: Custom user agent string
- Base headers: Headers sent with every request
Managing connections
Section titled “Managing connections”Connection lifecycle
Section titled “Connection lifecycle”Connections go through various states:
- Draft: Connection is being configured
- Active: Connection is ready for use
- Testing: Connection is being validated
- Inactive: Connection is disabled
- Error: Connection has configuration issues
Updating connections
Section titled “Updating connections”Modify existing connections when requirements change:
- Navigate to your connections list
- Select the connection to modify
- Update credentials, scopes, or settings
- Test the updated connection
- Save changes
const updatedConnection = await agentConnect.connections.update('conn_id', { scopes: ['new-scope-1', 'new-scope-2'], settings: { rate_limit: 200, timeout: 60 }});Connection monitoring
Section titled “Connection monitoring”Monitor connection health and performance:
- Authentication status: Track token validity and refresh cycles
- API usage: Monitor request volume and rate limit consumption
- Error rates: Track failed requests and common errors
- Performance metrics: Response times and throughput
Security considerations
Section titled “Security considerations”Credential management
Section titled “Credential management”Secure handling of connection credentials:
- Encryption: All credentials are encrypted at rest
- Access control: Limit who can view or modify connections
- Audit logging: Track all credential access and changes
- Rotation: Regular credential rotation policies
OAuth best practices
Section titled “OAuth best practices”Follow OAuth 2.0 security best practices:
- Use PKCE: Proof Key for Code Exchange for public clients
- Validate state: Prevent CSRF attacks with state parameters
- Scope limitation: Request minimal necessary scopes
- Token storage: Secure token storage and transmission
API key security
Section titled “API key security”Protect API keys properly:
- Environment variables: Store keys in environment variables
- Key rotation: Regular key rotation schedules
- Access logging: Log API key usage
- Least privilege: Use keys with minimal required permissions
Troubleshooting connections
Section titled “Troubleshooting connections”Common issues
Section titled “Common issues”Authentication failures:
- Invalid credentials
- Expired tokens
- Incorrect scopes
- Provider API changes
Rate limiting errors:
- Exceeded request limits
- Incorrect rate limit configuration
- Burst limit violations
- Shared quota issues
Configuration problems:
- Incorrect endpoint URLs
- Missing required settings
- Invalid scope combinations
- Provider-specific requirements
Debugging steps
Section titled “Debugging steps”- Check credentials - Verify all credentials are correct and current
- Test authentication - Use the connection test feature
- Review logs - Check connection logs for error details
- Validate settings - Ensure all settings match provider requirements
- Check provider status - Verify provider API is operational
- Update configuration - Apply any necessary fixes
- Re-test connection - Confirm issues are resolved
Best practices
Section titled “Best practices”Connection organization
Section titled “Connection organization”- Naming convention: Use clear, descriptive connection names
- Environment separation: Separate connections for dev/staging/prod
- Documentation: Document connection purposes and configurations
- Version control: Track connection configuration changes
Security practices
Section titled “Security practices”- Regular updates: Keep credentials and settings current
- Monitoring: Continuously monitor connection health
- Backup: Maintain secure backups of connection configurations
- Access review: Regularly review who has access to connections
Performance optimization
Section titled “Performance optimization”- Connection pooling: Reuse connections efficiently
- Caching: Cache frequently accessed configuration data
- Batch operations: Group API calls when possible
- Error handling: Implement robust error handling and retry logic
Connection templates
Section titled “Connection templates”Use templates for common connection patterns:
Google Workspace template
Section titled “Google Workspace template”{ "provider": "google_workspace", "auth_type": "oauth2", "scopes": [ "https://www.googleapis.com/auth/gmail.readonly", "https://www.googleapis.com/auth/calendar.readonly" ], "settings": { "auto_refresh": true, "rate_limit": 100, "timeout": 30 }}Slack workspace template
Section titled “Slack workspace template”{ "provider": "slack", "auth_type": "oauth2", "scopes": [ "channels:read", "chat:write", "users:read" ], "settings": { "auto_refresh": true, "rate_limit": 50, "timeout": 15 }}Next, learn how to create and manage Connected accounts that use these connections to authenticate and execute tools for your users.