Skip to content

use inline: true in workflows#279

Open
ianmacartney wants to merge 3 commits into
ian/action-ctx-compatfrom
ian/workflow-inline-interop
Open

use inline: true in workflows#279
ianmacartney wants to merge 3 commits into
ian/action-ctx-compatfrom
ian/workflow-inline-interop

Conversation

@ianmacartney
Copy link
Copy Markdown
Member

@ianmacartney ianmacartney commented Jun 2, 2026

For lightweight operations, run queries / mutations inline in Workflows, to avoid the workpool overhead.

This enables using Workflow + Agent more idiomatically, creating threads & saving messages before kicking out to an action to do generation, which likely saves ~1s or more per workflow

Risk:

  1. adds a peer dependency on Workflow
  2. If they had workflowId on ctx incidentally and had some custom ctx.run* functions that didn't expect an extra param (unlikely)
  3. Maybe they expected it to run in a separate transaction and that was impotant for some reason?

Copy link
Copy Markdown
Member Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 2, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@convex-dev/agent@279

commit: 8f3f66b

@ianmacartney ianmacartney marked this pull request as ready for review June 2, 2026 01:43
@ianmacartney ianmacartney requested a review from robelest June 2, 2026 01:44
@robelest
Copy link
Copy Markdown
Collaborator

robelest commented Jun 4, 2026

small consistency q: should the other lightweight helpers that accept
MutationCtx use the new wrappers too?

Right now createThread / saveMessages go inline in workflows, but
listMessages, searchThreadTitles, and delete helpers still call ctx.run*
directly. Maybe intentional, but it feels a little mixed.

Copy link
Copy Markdown
Member Author

search might require vector search, which isn't available in workflows. listing messages I guess is harmless - it's not reading more data than it's returning, so may as well inline it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants