Skip to content

Commit 4354ee3

Browse files
committed
fix(integrations): avoid circular crewai-flows tool deps
1 parent 6d2f8d2 commit 4354ee3

1 file changed

Lines changed: 17 additions & 25 deletions

File tree

  • examples/integrations/crewai-flows/src/app

examples/integrations/crewai-flows/src/app/page.tsx

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ export default function CopilotKitPage() {
2727
.string()
2828
.describe("The theme color to set. Make sure to pick nice colors."),
2929
}),
30-
handler: async ({ themeColor }) => {
31-
setThemeColor(themeColor);
30+
handler: async ({ themeColor: nextThemeColor }) => {
31+
setThemeColor(nextThemeColor);
3232
},
3333
});
3434

@@ -90,37 +90,29 @@ export default function CopilotKitPage() {
9090
);
9191
}
9292

93-
// State of the agent, make sure this aligns with your agent's state.
94-
type AgentState = {
95-
proverbs: string[];
96-
};
97-
9893
function YourMainContent({ themeColor }: { themeColor: string }) {
9994
// 🪁 Shared State: https://docs.copilotkit.ai/coagents/shared-state
10095
const { agent } = useAgent({
10196
agentId: "sample_agent",
10297
});
10398

10499
// 🪁 Frontend Tools: https://docs.copilotkit.ai/coagents/frontend-actions
105-
useFrontendTool(
106-
{
107-
name: "updateProverb",
108-
parameters: z.object({
109-
proverbs: z
110-
.array(z.string())
111-
.describe(
112-
"The proverbs to be committed into state. Make them witty, short and concise.",
113-
),
114-
}),
115-
handler: async ({ proverbs }) => {
116-
agent.setState({
117-
...agent.state,
118-
proverbs: [...proverbs],
119-
});
120-
},
100+
useFrontendTool({
101+
name: "updateProverb",
102+
parameters: z.object({
103+
proverbs: z
104+
.array(z.string())
105+
.describe(
106+
"The proverbs to be committed into state. Make them witty, short and concise.",
107+
),
108+
}),
109+
handler: async ({ proverbs }) => {
110+
agent.setState({
111+
...agent.state,
112+
proverbs: [...proverbs],
113+
});
121114
},
122-
[agent],
123-
);
115+
});
124116

125117
//🪁 Generative UI: https://docs.copilotkit.ai/coagents/generative-ui
126118
useRenderTool({

0 commit comments

Comments
 (0)