@convex-dev/agent 0.0.1 → 0.0.3-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +27 -0
  2. package/dist/commonjs/client/index.d.ts +792 -83
  3. package/dist/commonjs/client/index.d.ts.map +1 -1
  4. package/dist/commonjs/client/index.js +119 -155
  5. package/dist/commonjs/client/index.js.map +1 -1
  6. package/dist/commonjs/component/messages.d.ts +11 -3
  7. package/dist/commonjs/component/messages.d.ts.map +1 -1
  8. package/dist/commonjs/component/messages.js +2 -1
  9. package/dist/commonjs/component/messages.js.map +1 -1
  10. package/dist/commonjs/component/schema.d.ts +18 -12
  11. package/dist/commonjs/component/schema.d.ts.map +1 -1
  12. package/dist/commonjs/component/schema.js +1 -0
  13. package/dist/commonjs/component/schema.js.map +1 -1
  14. package/dist/commonjs/component/vector/index.d.ts.map +1 -1
  15. package/dist/commonjs/component/vector/index.js +1 -1
  16. package/dist/commonjs/component/vector/index.js.map +1 -1
  17. package/dist/commonjs/logging.d.ts +18 -0
  18. package/dist/commonjs/logging.d.ts.map +1 -0
  19. package/dist/commonjs/logging.js +78 -0
  20. package/dist/commonjs/logging.js.map +1 -0
  21. package/dist/commonjs/mapping.d.ts +3 -6
  22. package/dist/commonjs/mapping.d.ts.map +1 -1
  23. package/dist/commonjs/mapping.js +46 -20
  24. package/dist/commonjs/mapping.js.map +1 -1
  25. package/dist/commonjs/validators.d.ts +2736 -76
  26. package/dist/commonjs/validators.d.ts.map +1 -1
  27. package/dist/commonjs/validators.js +72 -7
  28. package/dist/commonjs/validators.js.map +1 -1
  29. package/dist/esm/client/index.d.ts +792 -83
  30. package/dist/esm/client/index.d.ts.map +1 -1
  31. package/dist/esm/client/index.js +119 -155
  32. package/dist/esm/client/index.js.map +1 -1
  33. package/dist/esm/component/messages.d.ts +11 -3
  34. package/dist/esm/component/messages.d.ts.map +1 -1
  35. package/dist/esm/component/messages.js +2 -1
  36. package/dist/esm/component/messages.js.map +1 -1
  37. package/dist/esm/component/schema.d.ts +18 -12
  38. package/dist/esm/component/schema.d.ts.map +1 -1
  39. package/dist/esm/component/schema.js +1 -0
  40. package/dist/esm/component/schema.js.map +1 -1
  41. package/dist/esm/component/vector/index.d.ts.map +1 -1
  42. package/dist/esm/component/vector/index.js +1 -1
  43. package/dist/esm/component/vector/index.js.map +1 -1
  44. package/dist/esm/logging.d.ts +18 -0
  45. package/dist/esm/logging.d.ts.map +1 -0
  46. package/dist/esm/logging.js +78 -0
  47. package/dist/esm/logging.js.map +1 -0
  48. package/dist/esm/mapping.d.ts +3 -6
  49. package/dist/esm/mapping.d.ts.map +1 -1
  50. package/dist/esm/mapping.js +46 -20
  51. package/dist/esm/mapping.js.map +1 -1
  52. package/dist/esm/validators.d.ts +2736 -76
  53. package/dist/esm/validators.d.ts.map +1 -1
  54. package/dist/esm/validators.js +72 -7
  55. package/dist/esm/validators.js.map +1 -1
  56. package/package.json +7 -7
  57. package/src/client/index.ts +277 -193
  58. package/src/component/_generated/api.d.ts +5 -0
  59. package/src/component/messages.ts +2 -1
  60. package/src/component/schema.ts +1 -0
  61. package/src/component/vector/index.ts +1 -7
  62. package/src/logging.ts +103 -0
  63. package/src/mapping.ts +61 -29
  64. package/src/validators.ts +102 -9
package/README.md CHANGED
@@ -10,6 +10,7 @@ AI Agent framework built on Convex.
10
10
  - RAG for chat context, via hybrid text & vector search, with configuration options.
11
11
  Or use the API to query the history yourself and do it your way.
12
12
  - Opt-in search for messages from other threads (for the same specified user).
13
+ - Support for generating and storing objects in messages (as JSON).
13
14
  - Tool calls via the AI SDK, along with Convex-specific helpers.
14
15
  - Easy workflow integration with the [Workflow component](https://convex.dev/components/workflow).
15
16
  - Reactive & realtime updates to asynchronous threads.
@@ -341,4 +342,30 @@ Read more in [this Stack post](https://stack.convex.dev/ai-agents).
341
342
  npm i @convex-dev/agent
342
343
  ```
343
344
 
345
+ ## Troubleshooting
346
+
347
+ ### Circular dependencies
348
+
349
+ Having the return value of workflows depend on other Convex functions can lead to circular dependencies due to the
350
+ `internal.foo.bar` way of specifying functions. The way to fix this is to explicitly type the return value of the
351
+ workflow. When in doubt, add return types to more `handler` functions, like this:
352
+
353
+ ```diff
354
+ export const supportAgentWorkflow = workflow.define({
355
+ args: { prompt: v.string(), userId: v.string(), threadId: v.string() },
356
+ + handler: async (step, { prompt, userId, threadId }): Promise<string> => {
357
+ // ...
358
+ },
359
+ });
360
+
361
+ // And regular functions too:
362
+ export const myFunction = action({
363
+ args: { prompt: v.string() },
364
+ + handler: async (ctx, { prompt }): Promise<string> => {
365
+ // ...
366
+ },
367
+ });
368
+ ```
369
+
370
+
344
371
  <!-- END: Include on https://convex.dev/components -->