File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -341,4 +341,30 @@ Read more in [this Stack post](https://stack.convex.dev/ai-agents).
341341npm i @convex-dev/agent
342342```
343343
344+ ## Troubleshooting
345+
346+ ### Circular dependencies
347+
348+ Having the return value of workflows depend on other Convex functions can lead to circular dependencies due to the
349+ ` internal.foo.bar ` way of specifying functions. The way to fix this is to explicitly type the return value of the
350+ workflow. When in doubt, add return types to more ` handler ` functions, like this:
351+
352+ ``` ts
353+ export const supportAgentWorkflow = workflow .define ({
354+ args: { prompt: v .string (), userId: v .string (), threadId: v .string () },
355+ + handler : async (step , { prompt , userId , threadId }): Promise <string > => {
356+ // ...
357+ },
358+ });
359+
360+ // And regular functions too:
361+ export const myFunction = action ({
362+ args: { prompt: v .string () },
363+ + handler : async (ctx , { prompt }): Promise <string > => {
364+ // ...
365+ },
366+ });
367+ ```
368+
369+
344370<!-- END: Include on https://convex.dev/components -->
You can’t perform that action at this time.
0 commit comments