Skip to main content
The @palico-ai/client-js is a Javascript library that helps you communicate with your Palico application. This library should primarily be used in secured server-side environments, such as a NodeJS server or a NextJS server runtime.

Setup and Installation

To install the Palico Client SDK on your NodeJS project, run the following command:

Create a Palico Client

1

Generate a Service Key

You can generate a service key from your Palico App project directory
2

Create a Palico Client

Calling an Agent

Here’s an example of how you can call an agent using the Palico Client SDK:
Learn about the API reference for the chat method here.

Stream Response

You can also stream the response from the agent. Here’s an example of how you can stream the response from the agent:
You can also get the merged chunks from the stream during or after the stream has completed:

API Reference

chat()

Input

The chat method accepts the following parameters:
string
required
The name of the agent you want to call. This should match the agent folder name.
string
required
Message to send to the agent.
json
Additional data to send to the agent.
json
App Config value to send to your agent. Learn more about App Config.
boolean
Should the response be streamed back to the client
ToolCallResult[]
For client-side tool execution, the results of the tool call. The schema for a ToolCallResult is as follows:

Output (Non-Streaming)

The chat method returns a promise that resolves to a ChatResponse object:
string
required
Unique identifier for the conversation.
string
required
Unique identifier for the request.
string
The message to be sent back to the user.
json
Additional data to be sent back to the user.
ToolCall[]
If the agent requires a client-side tool execution, this field will contain the tool name and parameters. The schema for a ToolCall is as follows: