@palico-ai/react
helps you communicate with your Palico agents, manage message history, and handle client-side tool calls in your React application.
Install Packages
Add API URL and Service Key to `.env`
.env
file:Setup Server-Side Authorization
src/app/api/palico/route.ts
in your NextJS application and add the following code:useChat()
hook to interact with your Palico agent in your React components.
pendingToolCalls
and addResult
params from the useChat
hook. Here’s an example of how you can handle client-side tool calls:
useChat()
useChat()
hook returns an object with the following properties:
Message
Message
object has the following properties:
user
or agent
.