Skip to content

Commit efa8417

Browse files
committed
circular readme
1 parent f1b9710 commit efa8417

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,4 +341,30 @@ Read more in [this Stack post](https://stack.convex.dev/ai-agents).
341341
npm 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 -->

0 commit comments

Comments
 (0)