#CopilotKit Actions
1 messages · Page 1 of 1 (latest)
Hey Ethan, just so I fully understand your ask here - do you want a backend action to result in a custom chat UI component being rendered?
Hi @sullen pulsar yes. I want to create a custom state element that is populated by the LLM on the agent side and upon this custom state element being given a value I want the front end to render a card in the UI with the information from the state.
Likely, you already know that you need useCopilotAction.
You're able to render backend actions in the frontend. This is currently undocumented but will be added soon as we're overhauling our docs.
With that being said, you can render any backend defined action (tool) by giving a render to useCopilotAction where the name matches the backend action.
Say you have a backend action call sayHello. You can have that tool exist in the backend and then render it in the front-end.
// page.tsx
useCopilotAction({
name: "sayHello"
available: "disable" // try without this first, and if it isn't working add this
render: ({state, args}) => {
return <div>hello</div>
}
})
Ok, that makes a bit more sense - I will test this out today
I am lloking for the code to implement that backend action in python - is there documentation on this?
Is this what you're looking for?
https://docs.copilotkit.ai/guides/backend-actions/remote-backend-endpoint
Yes this is what I was looking for. I am looking forward to seeing the new documentation because you are definitely doing some great stuff
FYI I’m working on an official AI powered BI system for Tripadvisor using your framework. I will have to speak with someone in your team about rate limits etc because there will be a lot of traffic once this is live. @sullen pulsar
Absolutely, let's get some time down.