Get started with Modular Extend SDK
Overview
This article guides you through the fundamentals of creating a project using the Modular Extend SDK — the successor to the monolithic Extend SDK — in multiple supported programming languages.
The Modular Extend SDK allows you to include only the AGS service packages your project actually needs, reducing dependency bloat. A compatibility layer is also available for gradual migration from the monolithic SDK.
Goals
In this guide you will:
- Create an application project.
- Add the Modular Extend SDK packages as project dependencies.
- Use the Modular Extend SDK to invoke an AGS endpoint.
- Run the application.
Prerequisites
In order to start on this guide, you should have:
- C#
- Go
- Python
- Access to AccelByte Gaming Services (AGS) (demo environment):
- Use
<your environment's domain URL>for theAB_BASE_URLenvironment variable.- Example for AGS Shared Cloud customer:
https://spaceshooter.prod.gamingservices.accelbyte.io - Example for AGS Private Cloud customer:
https://dev.customer.accelbyte.io
- Example for AGS Shared Cloud customer:
- Create an OAuth Client with client type Confidential.
- Use the Client ID value for the
AB_CLIENT_IDenvironment variable. - Use the Client Secret value for the
AB_CLIENT_SECRETenvironment variable.
- Use the Client ID value for the
- Use
- AccelByte C# Modular Extend SDK
- Access to the following tools:
- Git
- .NET 8.0 SDK
- C# IDE
- Access to AccelByte Gaming Services (AGS) (demo environment):
- Use
<your environment's domain URL>for theAB_BASE_URLenvironment variable.- Example for AGS Shared Cloud customer:
https://spaceshooter.prod.gamingservices.accelbyte.io - Example for AGS Private Cloud customer:
https://dev.customer.accelbyte.io
- Example for AGS Shared Cloud customer:
- Create an OAuth Client with client type Confidential.
- Use the Client ID value for the
AB_CLIENT_IDenvironment variable. - Use the Client Secret value for the
AB_CLIENT_SECRETenvironment variable.
- Use the Client ID value for the
- Use
- AccelByte Go Modular Extend SDK
- Access to the following tools:
- Git
- Go 1.23 or later
- Go IDE
- Access to AccelByte Gaming Services (AGS) (demo environment):
- Use
<your environment's domain URL>for theAB_BASE_URLenvironment variable.- Example for AGS Shared Cloud customer:
https://spaceshooter.prod.gamingservices.accelbyte.io - Example for AGS Private Cloud customer:
https://dev.customer.accelbyte.io
- Example for AGS Shared Cloud customer:
- Create an OAuth Client with client type Confidential.
- Use the Client ID value for the
AB_CLIENT_IDenvironment variable. - Use the Client Secret value for the
AB_CLIENT_SECRETenvironment variable.
- Use the Client ID value for the
- Use
- AccelByte Python Modular Extend SDK
- Access to the following tools:
- Git
- Python 3.9 or later
- Python IDE
Create a project
- C#
- Go
- Python
Create a new solution and a new console project inside the solution using the dotnet CLI.
$ mkdir -p /path/to/mysolution
$ cd /path/to/mysolution
$ dotnet new sln --name mysolution # Create a new solution: mysolution
$ dotnet new console -o myproject # Create a new console project: myproject
$ dotnet sln add myproject/myproject.csproj # Add myproject to mysolution
Create a folder and use go mod init to create a new Go application project.
$ mkdir getting-started
$ cd getting-started/
$ go mod init golang-application
Create a folder and use venv to create a Python virtual environment.
For macOS or Linux (Bash):
$ mkdir myproject
$ cd myproject/
$ python -m venv venv
$ source venv/bin/activate
$ python -c "import sys; print(sys.executable)" # Check which Python executable is active
For Windows (PowerShell):
C:\> mkdir myproject
C:\> cd myproject/
C:\> python -m venv venv
C:\> venv\Scripts\Activate.ps1
C:\> python -c "import sys; print(sys.executable)" # Check which Python executable is active
Add to project dependency
- C#
- Go
- Python
The Modular C# Extend SDK is distributed as individual NuGet packages. Install the core packages that are always required, then add only the AGS service packages your project needs.
$ cd /path/to/mysolution/myproject
# Always required
$ dotnet add package AccelByte.Sdk.Abstractions
$ dotnet add package AccelByte.Sdk.Core
# Required for authentication and token validation
$ dotnet add package AccelByte.Sdk.Authentication
# Optional feature packages
$ dotnet add package AccelByte.Sdk.Feature.AutoRefreshToken
$ dotnet add package AccelByte.Sdk.Feature.LocalTokenValidation
# AGS service packages — add only the ones you need
$ dotnet add package AccelByte.Sdk.Api.Basic
$ dotnet add package AccelByte.Sdk.Api.Iam
# $ dotnet add package AccelByte.Sdk.Api.<ApiName> # Add more as needed
# Optional: compatibility layer for migrating from the monolithic SDK
# $ dotnet add package AccelByte.Sdk.Api.Compat
See the full list of available API packages in the apis/ directory.
We recommend using the Modular C# Extend SDK version that matches your AGS version.
The Modular Go Extend SDK is distributed as separate Go modules per AGS service. Edit your go.mod file to import only the services your project needs.
Replace {VERSION} with a specific release version tag.
module golang-application
go 1.23
require (
github.com/AccelByte/accelbyte-go-modular-sdk/services-api {VERSION}
github.com/AccelByte/accelbyte-go-modular-sdk/iam-sdk {VERSION}
github.com/AccelByte/accelbyte-go-modular-sdk/basic-sdk {VERSION}
// Add more service SDKs as needed
)
Then run:
$ go mod tidy
See the full list of available Go modules in Published Go Modules.
We recommend using the Modular Go Extend SDK version that matches your AGS version.
The Modular Python Extend SDK is distributed as separate pip packages. Install the core package and then add only the AGS service packages your project needs.
# Always required
$ pip install accelbyte-py-sdk-core
# AGS service packages — install only the ones you need
$ pip install accelbyte-py-sdk-service-iam
$ pip install accelbyte-py-sdk-service-basic
# pip install accelbyte-py-sdk-service-<name> # Add more as needed
# Optional feature packages
$ pip install accelbyte-py-sdk-feat-auth
$ pip install accelbyte-py-sdk-feat-token-validation
# Or install everything at once
# $ pip install accelbyte-py-sdk-all
We recommend using the Modular Python Extend SDK version that matches your AGS version.
Use in code
- C#
- Go
- Python
- Create an SDK instance, log in using client credentials, and call an AGS API in
Program.cs. DefaultConfigRepositoryreadsAB_BASE_URL,AB_CLIENT_ID, andAB_CLIENT_SECRETfrom environment variables.
// Program.cs
using AccelByte.Sdk.Core;
using AccelByte.Sdk.Core.Net.Http;
using AccelByte.Sdk.Core.Repository;
using AccelByte.Sdk.Api;
using AccelByte.Sdk.Api.Basic.Model;
// Build the SDK instance
IAccelByteSdk sdk = AccelByteSdk.Builder
.UseDefaultHttpClient()
.UseDefaultConfigRepository() // reads AB_BASE_URL, AB_CLIENT_ID, AB_CLIENT_SECRET from env vars
.UseDefaultTokenRepository()
.Build();
// Log in using client credentials
bool login = sdk.LoginClient();
if (!login)
{
Console.WriteLine("Login failed");
return 1;
}
// Call an AGS endpoint — e.g. getMyProfileInfo from the Basic service
var response = sdk.GetBasicApi().UserProfile.GetMyProfileInfoOp.Execute(sdk.Namespace);
if (response.IsSuccess && response.Data != null)
{
UserProfilePrivateInfo profileData = response.Data;
Console.WriteLine($"User ID: {profileData.UserId}");
}
else
{
Console.WriteLine($"Error: {response.Error?.Message}");
return 2;
}
// Log out
bool logout = sdk.Logout();
if (!logout)
{
Console.WriteLine("Logout failed");
return 1;
}
return 0;
- Create an SDK instance, log in using client credentials, and call an AGS API in
main.go. DefaultConfigRepositoryImplreadsAB_BASE_URL,AB_CLIENT_ID, andAB_CLIENT_SECRETfrom environment variables.
// main.go
package main
import (
"github.com/AccelByte/accelbyte-go-modular-sdk/services-api/pkg/factory"
"github.com/AccelByte/accelbyte-go-modular-sdk/services-api/pkg/service/iam"
"github.com/AccelByte/accelbyte-go-modular-sdk/services-api/pkg/utils/auth"
"github.com/AccelByte/accelbyte-go-modular-sdk/iam-sdk/pkg/iamclient/o_auth2_0_extension"
"github.com/sirupsen/logrus"
)
var (
// Use the default Go Modular Extend SDK config and token repository implementations
configRepo = *auth.DefaultConfigRepositoryImpl()
tokenRepo = *auth.DefaultTokenRepositoryImpl()
)
func main() {
// Prepare the IAM OAuth service
oAuth20Service := &iam.OAuth20Service{
Client: factory.NewIamClient(&configRepo),
ConfigRepository: &configRepo,
TokenRepository: &tokenRepo,
}
clientId := oAuth20Service.ConfigRepository.GetClientId()
clientSecret := oAuth20Service.ConfigRepository.GetClientSecret()
// Log in using OAuth client credentials
err := oAuth20Service.LoginClient(&clientId, &clientSecret)
if err != nil {
logrus.Fatalf("Login failed: %v", err)
}
logrus.Info("Login successful")
// Call an AGS endpoint — e.g. GetCountryLocationV3 from the IAM service
oAuth20ExtensionService := &iam.OAuth20ExtensionService{
Client: factory.NewIamClient(&configRepo),
TokenRepository: &tokenRepo,
}
input := &o_auth2_0_extension.GetCountryLocationV3Params{}
ok, errLoc := oAuth20ExtensionService.GetCountryLocationV3Short(input)
if errLoc != nil {
logrus.Errorf("Request failed: %v", errLoc)
return
}
logrus.Infof("Country: %s", *ok.CountryName)
}
- Create an SDK instance, log in using client credentials, and call an AGS API in
app.py. EnvironmentConfigRepositoryreadsAB_BASE_URL,AB_CLIENT_ID,AB_CLIENT_SECRET, andAB_NAMESPACEfrom environment variables.
# app.py
import accelbyte_py_sdk
from accelbyte_py_sdk.core import (
EnvironmentConfigRepository,
InMemoryTokenRepository,
RequestsHttpClient,
)
from accelbyte_py_sdk.services.auth.v2 import login_client
import accelbyte_py_sdk.api.iam as iam_service
def main():
# Initialize the SDK
accelbyte_py_sdk.initialize(
options={
"config": EnvironmentConfigRepository(), # reads AB_BASE_URL, AB_CLIENT_ID, etc.
"token": InMemoryTokenRepository(),
"http": RequestsHttpClient(),
}
)
# Log in using client credentials
_, error = login_client()
if error:
print(f"Login failed: {error}")
exit(1)
# Call an AGS endpoint — e.g. get_country_location_v3 from the IAM service
response, error = iam_service.get_country_location_v3()
if error:
print(f"Request failed: {error}")
exit(1)
print(f"Country: {response.country_name}")
if __name__ == "__main__":
main()
Run the code
- C#
- Go
- Python
Set the required environment variables and run the code using dotnet run.
$ export AB_BASE_URL="<your environment's domain URL>" # AGS Base URL
$ export AB_CLIENT_ID="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # AGS OAuth Client ID
$ export AB_CLIENT_SECRET="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # AGS OAuth Client Secret
$ export AB_NAMESPACE="<your namespace>" # AGS Namespace
$ cd /path/to/mysolution/myproject
$ dotnet run
Set the required environment variables and run the application using go run main.go.
$ export AB_BASE_URL="<your environment's domain URL>" # AGS Base URL
$ export AB_CLIENT_ID="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # AGS OAuth Client ID
$ export AB_CLIENT_SECRET="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # AGS OAuth Client Secret
$ go run main.go
Set the required environment variables and run the code using the Python interpreter.
$ export AB_BASE_URL="<your environment's domain URL>" # AGS Base URL
$ export AB_CLIENT_ID="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # AGS OAuth Client ID
$ export AB_CLIENT_SECRET="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # AGS OAuth Client Secret
$ export AB_NAMESPACE="<your namespace>" # AGS Namespace
$ python app.py
Migrate from the monolithic SDK
This section covers how to migrate an existing project that uses the monolithic Extend SDK to the Modular Extend SDK.
The Modular Extend SDK provides a compatibility layer that lets you migrate gradually — your existing code continues to compile while you update it service by service.
- C#
- Go
- Python
Step 1: Clean up obsolete components
Before migrating, upgrade to the latest monolithic SDK version and remove any usage of deprecated or obsolete classes, methods, and properties. The Modular SDK does not include these.
Step 2: Replace the project dependency
Remove the monolithic SDK project reference and install the Modular SDK NuGet packages instead.
# Core packages (always required)
$ dotnet add package AccelByte.Sdk.Abstractions
$ dotnet add package AccelByte.Sdk.Core
$ dotnet add package AccelByte.Sdk.Authentication
# Add only the AGS service packages you use
$ dotnet add package AccelByte.Sdk.Api.Iam
$ dotnet add package AccelByte.Sdk.Api.Basic
# dotnet add package AccelByte.Sdk.Api.<ApiName>
# Add the compatibility layer to keep existing code compiling
$ dotnet add package AccelByte.Sdk.Api.Compat
Step 3: Fix namespace and class name changes
The key breaking changes between the monolithic and modular SDKs are listed below.
SDK class and builder:
| Monolithic | Modular | |
|---|---|---|
| SDK class | AccelByteSDK | AccelByteSdk (implements IAccelByteSdk) |
| SDK builder | AccelByteSdkBuilder | AccelByteSdkBuilder<T> (implements IAccelByteSdkBuilder<T>) |
Namespaces:
| Component | Monolithic | Modular |
|---|---|---|
| HTTP client | AccelByte.Sdk.Core.Client | AccelByte.Sdk.Core.Net.Http |
| HTTP logger | AccelByte.Sdk.Core.Logging | AccelByte.Sdk.Core.Net.Logging |
| Utilities | AccelByte.Sdk.Core.Util | Removed — moved to extension methods in AccelByte.Sdk.Core |
| Security | (inside class files) | AccelByte.Sdk.Core.Security |
Fluent API access:
// Monolithic
sdk.Legal.Agreement.RetrieveAgreementsPublicOp.Execute();
// Modular
sdk.GetLegalApi().Agreement.RetrieveAgreementsPublicOp.Execute();
SDK initialization — each default implementation now requires its own namespace:
// Monolithic — single namespace covers everything
using AccelByte.Sdk.Core;
// Modular — include namespaces per component
using AccelByte.Sdk.Core;
using AccelByte.Sdk.Core.Repository; // for default repositories
using AccelByte.Sdk.Core.Net.Http; // for HTTP clients
Step 4: Update call response handling
Every operation call now returns a response object instead of the data directly. Use EnsureSuccess() as a shorthand equivalent to the old behavior.
// Monolithic
List<RetrieveAcceptedAgreementResponse>? response = sdk.GetLegalApi().Agreement
.RetrieveAgreementsPublicOp.Execute();
// Modular — response object pattern
var response = sdk.GetLegalApi().Agreement.RetrieveAgreementsPublicOp.Execute();
if (response.IsSuccess)
{
List<RetrieveAcceptedAgreementResponse> data = response.Data;
}
// Modular — shorthand equivalent to monolithic (throws ApiResponseException on failure)
List<RetrieveAcceptedAgreementResponse> data = sdk.GetLegalApi().Agreement
.RetrieveAgreementsPublicOp.Execute().EnsureSuccess();
Note: The exception type has changed from HttpResponseException to ApiResponseException.
Step 5: Use the compatibility layer (optional)
If you want the modular SDK to behave like the monolithic SDK while you migrate incrementally, the AccelByte.Sdk.Api.Compat package provides adapter classes that:
- Expose the original
AccelByteSDKclass name and fluent interface (sdk.Legal,sdk.Basic, etc.). - Re-throw
HttpResponseException(translated fromApiResponseException) to keep existing error handling intact. - Provide the
Helperclass inAccelByte.Sdk.Core.Utilmapped to extension methods.
Once the compat package is added, your existing code should compile without changes. You can then migrate service by service, removing compat dependencies as you go.
The compatibility library does not change the default behavior of on-demand token refresh.
Step 1: Update go.mod imports
Replace the monolithic SDK module with the individual modular service modules for the AGS services your project uses.
// Before (monolithic)
require (
github.com/AccelByte/accelbyte-go-sdk {VERSION}
)
// After (modular) — import only the services you need
require (
github.com/AccelByte/accelbyte-go-modular-sdk/services-api {VERSION}
github.com/AccelByte/accelbyte-go-modular-sdk/iam-sdk {VERSION}
github.com/AccelByte/accelbyte-go-modular-sdk/basic-sdk {VERSION}
// Add more service SDKs as needed
)
Then run:
$ go mod tidy
Step 2: Build with the compatibility layer
After updating go.mod, build your project using the compat build tag. This enables the compatibility layer that maps the monolithic SDK's interface to the modular SDK, allowing your existing code to compile without changes.
$ go build -tags compat ./...
Step 3: Migrate incrementally
With the compatibility layer in place, migrate your code service by service:
-
Update import paths for one service at a time — replace
accelbyte-go-sdk/<service>-sdk/...imports withaccelbyte-go-modular-sdk/<service>-sdk/.... -
Update service instantiation to use the modular struct pattern:
// Monolithic import path
import "github.com/AccelByte/accelbyte-go-sdk/iam-sdk/pkg/iamclient/o_auth2_0_extension"
// Modular import path
import "github.com/AccelByte/accelbyte-go-modular-sdk/iam-sdk/pkg/iamclient/o_auth2_0_extension" -
Once all services are migrated, remove the
-tags compatflag from your build command.
Step 1: Replace the SDK package
Uninstall the monolithic SDK and install the modular SDK packages you need.
# Remove the monolithic SDK
$ pip uninstall accelbyte-py-sdk
# Install the modular SDK core
$ pip install accelbyte-py-sdk-core
# Install the service packages you use
$ pip install accelbyte-py-sdk-service-iam
$ pip install accelbyte-py-sdk-service-basic
# pip install accelbyte-py-sdk-service-<name>
# Or install everything at once
# $ pip install accelbyte-py-sdk-all
Step 2: Update import paths
The modular SDK uses a different package structure. Update your imports accordingly.
# Monolithic
from accelbyte_py_sdk.api.iam import get_country_location_v3
from accelbyte_py_sdk.services.auth import login_client
# Modular — service wrappers are under accelbyte_py_sdk.api.<service>
from accelbyte_py_sdk.api.iam import get_country_location_v3
from accelbyte_py_sdk.services.auth.v2 import login_client
Step 3: Update initialization
The modular SDK's initialize() function accepts the same options as the monolithic SDK. The main change is to use the v2 auth service for login functions.
# Monolithic
import accelbyte_py_sdk
from accelbyte_py_sdk.services.auth import login_client, logout
accelbyte_py_sdk.initialize()
_, error = login_client()
# Modular — use auth.v2 for the updated login helpers
import accelbyte_py_sdk
from accelbyte_py_sdk.services.auth.v2 import login_client, logout
accelbyte_py_sdk.initialize()
_, error = login_client()
Step 4: Adopt the ApiResponse return type (optional)
As of ags/v3.80.0, all wrapper functions return an ApiResponse subclass instead of a plain (result, error) tuple. The ApiResponse object still supports tuple unpacking for backwards compatibility.
# Both styles work in the modular SDK
result, error = get_country_location_v3() # existing tuple-unpack style still works
response = get_country_location_v3() # new ApiResponse style
result, error = response
response.ok() # raises Exception if not successful
Additional resources
- C#
- Go
- Python
- C# Modular Extend SDK README for setup and usage
- C# Modular Extend SDK API packages for the list of available service packages
- C# Modular Extend SDK sample projects for sample projects using the Modular Extend SDK
- C# Modular Extend SDK operations reference for code examples of all supported operations
- C# Modular Extend SDK migration guide for migrating from the monolithic SDK
- Go Modular Extend SDK README for setup and usage
- Go Modular Extend SDK published modules for the full list of available service modules
- Go Modular Extend SDK sample projects for sample projects using the Modular Extend SDK
- Go Modular Extend SDK operations reference for code examples of all supported operations
- Python Modular Extend SDK README for setup and usage
- Python Modular Extend SDK sample projects for sample projects using the Modular Extend SDK
- Python Modular Extend SDK operations reference for code examples of all supported operations