Getting Started
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
Generate a Service Key
You can generate a service key from your Palico App project directory
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:
The name of the agent you want to call. This should match the agent folder name.
Message to send to the agent.
Additional data to send to the agent.
App Config value to send to your agent. Learn more about App Config.
Should the response be streamed back to the client
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:
Unique identifier for the conversation.
Unique identifier for the request.
The message to be sent back to the user.
Additional data to be sent back to the user.
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: