Get Settings for a Particular Agent Using CustomGPT.ai RAG API’s Python SDK  – A Detailed Tutorial

Author Image

Written by: Priyansh Khodiyar

Get Settings for a Particular Agent Using CustomGPT.ai RAG API’s Python SDK  – A Detailed Tutorial

Understand your CustomGPT project’s configuration by fetching its settings via the Python SDK. In this tutorial, we will use the CustomGPT API to get settings for a particular agent. Project settings include the bot’s default behavior configurations – for example, its default prompt or welcome message, example questions shown to users, language settings, and more. Being able to fetch these programmatically is useful for auditing or dynamically adjusting your chatbot’s setup.

Before proceeding, please review Getting Started with CustomGPT.ai for New Developers to ensure you have your API credentials and environment ready.

Notebook Link: CustomGPT Cookbook – SDK_Get_settings_for_a_particular_project.ipynb

Introduction

Hi there! In this tutorial, we’ll walk through how to retrieve the settings for a specific CustomGPT project using the Python SDK. Every CustomGPT project (a.k.a. agent or chatbot) has a set of configuration parameters: think of things like the bot’s name, its default system prompt/instructions, the language it uses for its messages, example questions to suggest to users, whether the bot is public or private, and more. By fetching these settings via the API, developers can programmatically inspect how a bot is configured without logging into the web dashboard.

Why retrieve project settings via API? This is especially useful for developers managing multiple bots or integrating CustomGPT into a larger application. For example, you might build an admin dashboard that lists all your bots and their key settings, or you may want to verify that a particular setting (say, the default prompt or enabled data sources) is correctly applied. Instead of checking manually, the SDK lets you pull that info directly and even use it in automated tests or for auditing changes over time.

Prerequisites

  • CustomGPT API Key – Your API token for authentication. It should have access to the project whose settings you want to retrieve.
  • CustomGPT Python SDK installed – Ensure customgpt-client is installed in your Python environment. We’ll use it to call the Project Settings API.
  • Project ID – The identifier of the CustomGPT project (agent) whose settings you need. You can get this from the URL in the CustomGPT dashboard or via other API calls. If you don’t have a project, we will create a sample one in this guide.
  • Python environment – This example can be run in Google Colab, Jupyter Notebook, or any Python script context.

Step-by-Step Guide

Follow these steps to get settings for a particular agent using the SDK:

  1. Setup the SDK and authenticate. Begin by installing the CustomGPT client library and setting up your API key:
!pip install customgpt-client
from customgpt_client import CustomGPT
CustomGPT.api_key = "YOUR_API_TOKEN"

Get API keys

To get your API key, there are two ways:

Method 1 – Via Agent

  1. Agent > All Agents.
  2. Select your agent and go to deploy, click on the API key section and create an API. 

Method 2 – Via Profile section.

  1. Go to profile (top right corner of your screen)
  2. Click on My Profile
  3. You will see the screen something like this (below screenshot). Here you can click on “Create API key”, give it a name and copy the key.
Create API

Please save this secret key somewhere safe and accessible. For security reasons, You won’t be able to view it again through your CustomGPT.ai account. If you lose this secret key, you’ll need to generate a new one.

2. This installs the SDK and imports the CustomGPT class. We then configure the SDK with our API token so it can authenticate with CustomGPT. Be sure to replace “YOUR_API_TOKEN” with your actual key.

3. Create a sample project (if needed). If you already have a project, you can skip this step. Otherwise, let’s create a quick example project to work with:

# Create an example project using a sitemap (or any method)
project_name = "Example ChatBot using Sitemap"
sitemap_path = "https://adorosario.github.io/small-sitemap.xml"
create_project = CustomGPT.Project.create(project_name=project_name, sitemap_path=sitemap_path)
print(create_project)

4. We use a sitemap URL to populate the bot with some content. The print(create_project) will show the response, including the new project_id. Note down the project_id from the output. (If you have an existing project, you would already have its ID.)

5. Extract the Project ID. We’ll need the project_id to get its settings:

project_id = create_project.parsed.data.id

6. If using an existing project, just set project_id = “<your-project-id>” here. Now we have the identifier required to query that project’s settings.

7. Retrieve the project settings via the SDK. We call the appropriate method to get the settings:

project_settings = CustomGPT.ProjectSettings.get(project_id=project_id)
print(project_settings)

8. The CustomGPT.ProjectSettings.get(…) call invokes the API endpoint to fetch the project’s configuration details. We print the result to see the raw output. This response will include all the settings of the project in a structured format (likely nested under a data field).

9. Examine the output. The output from the above call will contain a variety of settings. For example, you might see something like:

{
  "status": "success",
  "data": {
    "id": "proj_abc123",
    "name": "Example ChatBot using Sitemap",
    "default_prompt": "Hello, ask me anything about our site.",
    "example_questions": ["What services do you offer?", "Where can I find pricing information?"],
    "chatbot_msg_lang": "en",
    "is_public": false,
    "allow_user_feedback": true,
    ... other settings ...
  }
}

10. The exact fields will depend on what settings are configurable in CustomGPT. Key ones often include:

  • name: The project name (your bot’s name).
  • default_prompt: The default system prompt or welcome message the bot uses when a conversation starts.
  • example_questions: A list of sample questions displayed to users to hint what they can ask.
  • chatbot_msg_lang: The language code for the chatbot’s messages (e.g., “en” for English, “ur” for Urdu, etc.).
  • is_public: Whether the project is public (shareable) or private.
  • other toggles: e.g., flags for features like user feedback, citations on/off, etc., depending on the platform’s features.

11. By reviewing these, you now have a snapshot of how the bot is configured. For instance, you can confirm if the default prompt is set correctly or if the bot is currently private/public.

12. Access specific settings in code. The SDK likely wraps the response in an object. To use these values in your code, you might do:

settings_data = project_settings.parsed.data
print("Bot Name:", settings_data.name)
print("Default Prompt:", settings_data.default_prompt)
print("Example Questions:", settings_data.example_questions)
print("Bot Language:", settings_data.chatbot_msg_lang)

13. This will print the individual settings in a readable format. Now you can programmatically make decisions or updates based on these values. For example, you could check if is_public is false and then decide to enable sharing (as shown in another tutorial).

At this point, you have successfully retrieved and inspected the project’s settings using the CustomGPT API and Python SDK. This process can be integrated into larger admin scripts or tools where you need to audit or display bot configurations.

FAQs

What types of settings can I expect from ProjectSettings.get?

You’ll get all the configuration parameters associated with the project. Typical settings include the project’s name, description (if any), the default system prompt (the initial instructions the bot follows), example questions shown to users, the interface language of the bot’s responses or system messages (chatbot_msg_lang), whether the bot is public or private, and various feature toggles (like whether to allow user feedback on answers, etc.). Essentially, anything you see configurable in the CustomGPT dashboard for a project should appear in this API response.

Is it safe to expose my project settings via an API call? Could it include sensitive info like API keys?

The project settings fetched by this call pertain to the chatbot’s configuration and do not include sensitive account information like your API key. They may include internal IDs and the content of prompts or example questions, which you should handle securely if they are confidential. But items such as your CustomGPT API token are not part of the project settings structure returned by this endpoint.

Can I retrieve project settings for someone else’s project if I have the ID?

No – you can only retrieve settings for projects that your API key has access to. Typically, that means projects in your own CustomGPT account (or organization). If you try to get settings for a project ID that doesn’t belong to you or that you don’t have permission for, the API will return an error (e.g., “Unauthorized” or “Project not found”).

The output shows a field like chatbot_msg_lang set to “en” by default. What does changing it do?

The chatbot_msg_lang setting indicates the language that the bot uses for its own messages (like error messages or prompts) and possibly the expected language for outputs. For instance, if you set it to “ur” (Urdu) as seen in some code examples, the bot’s interface and possibly default answers will be tailored for Urdu. This doesn’t automatically translate content, but it sets the language context. It’s one of the settings you might retrieve and decide to update via the API if needed (see the project settings update tutorial).

Now that I can get project settings, can I also change them via the SDK?

Yes! There is a corresponding API call to update project settings. Using the SDK, you can update fields like the default prompt, example questions, language, images (avatar/background), and more. Check out the Update Project Settings tutorial (linked below) for a complete walkthrough on modifying these values. Retrieving settings (what we did here) is often the first step before making changes or just to verify current values.

Related Posts

Build a Custom GPT for your business, in minutes.

Deliver exceptional customer experiences and maximize employee efficiency with custom AI agents.

Trusted by thousands of organizations worldwide

Related posts

Leave a reply

Your email address will not be published. Required fields are marked *

*

3x productivity.
Cut costs in half.

Launch a custom AI agent in minutes.

Instantly access all your data.
Automate customer service.
Streamline employee training.
Accelerate research.
Gain customer insights.

Try 100% free. Cancel anytime.