Skip to main content
Digital Xpert provides a set of APIs and an SDK for developers to interact with Xpert intelligent agents. These APIs allow you to create custom applications to communicate with Digital Xpertโ€™s intelligent agents. The Xpert agent interface follows the Agent Protocol standard, which is a protocol for communication between agents. The Agent Protocol provides a universal way for agents to exchange messages, facilitating interoperability between agents.
  • First, create a Key for authentication to access the Xpert intelligent agent program.
Develop key
  • Use the Key to access the Xpert intelligent agentโ€™s REST APIs or use the LangGraph SDK to access the XpertAI platform.

Using the LangGraph SDK to Call the XpertAI Platform

The XpertAI intelligent agent platform can be interacted with via the LangGraph SDK (@langchain/langgraph-sdk (JS/TS SDK) / langgraph-sdk Python SDK). This SDK encapsulates the core capabilities for communicating with the LangGraph REST API, making it easy to manage core components such as assistants, threads, runs, and persistent storage (store).
Reference code: XpertAI SDK Examples

1. Installation

Ensure that the Node.js environment is installed, then install the SDK in your project:
By default, the SDK connects to http://localhost:8123 (e.g., when started locally with langgraph-cli). Otherwise, you need to specify the API URL or apiKey during configuration (npm).

2. Initialize the Client

In JavaScript/TypeScript, you can create a Client instance as follows:
If not explicitly configured, the SDK will connect to http://localhost:8123 by default (npm).

3. Managing Digital Xperts (Agents)

List Existing Digital Xperts

Each Digital Xpert is an assistant (npm, LangGraph).

Retrieve a Single Digital Xpert

4. Creating and Managing Threads

Create a New Thread (Empty State)

In the example, it returns properties such as thread_id, status, etc. (LangGraph).

Pre-fill State

This allows you to inject a thread ID during creation (LangGraph).

Query Thread List & Retrieve State

5. Starting Runs

You can initiate a run for a specific Digital Xpert within a thread, including support for streaming responses.

Start a Streaming Run

This allows processing responses as they are generated, suitable for interactive scenarios (npm).

Other Run Operation Examples

6. Using Store (Persistent Storage)

Store data that needs to be saved across requests in sessions or tasks.
Detailed interfaces are defined in StoreClient (LangGraph).

7. XpertAI Platform Integration Tips

  • Configure Default API Address and Key: The API address must be explicitly specified, and the key can be configured uniformly using the environment variable LANGGRAPH_API_KEY.
  • Stream Output to Frontend: Suitable for React and other frontends, you can use the SDKโ€™s streaming capabilities to build real-time conversational interfaces.
  • Persistent Memory: Use the Store feature to save key session data, enhancing the agentโ€™s memory capabilities.

References

More Information

The SDK is still being improved. If you encounter any issues or have suggestions, please add WeChat: xpertai to contact us for technical discussions.