Back to Skills

Convex Agents Workflows

Sstobo
Updated Today
88 views
5
5
View on GitHub
Designaiapiautomation

About

Convex Agents Workflows enables durable, multi-step agent operations that survive server restarts and failures. It provides automatic retries and recovery, ensuring reliable execution for complex tasks. Use this skill when coordinating multiple agents or building long-running workflows that require guaranteed completion.

Quick Install

Claude Code

Recommended
Plugin CommandRecommended
/plugin add https://github.com/Sstobo/convex-skills
Git CloneAlternative
git clone https://github.com/Sstobo/convex-skills.git ~/.claude/skills/Convex Agents Workflows

Copy and paste this command in Claude Code to install this skill

Documentation

Purpose

Provides durable, reliable execution of complex agent workflows. Workflows ensure multi-step operations complete reliably, survive server failures, and maintain idempotency.

When to Use This Skill

  • Building multi-step agent operations (research → analysis → report)
  • Coordinating multiple agents working together
  • Long-running operations that need to survive server restarts
  • Ensuring idempotency (no duplicate work even if retried)
  • Complex applications requiring durable execution guarantees

Setup

Configure Workflow component in convex.config.ts:

import { defineApp } from "convex/server";
import agent from "@convex-dev/agent/convex.config";
import workflow from "@convex-dev/workflow/convex.config";

const app = defineApp();
app.use(agent);
app.use(workflow);

export default app;

Define a Workflow

import { WorkflowManager } from "@convex-dev/workflow";

const workflow = new WorkflowManager(components.workflow);

export const simpleAgentFlow = workflow.define({
  id: "simple-flow",
  args: { userId: v.string(), prompt: v.string() },
  handler: async (step, { userId, prompt }) => {
    // Step 1: Create thread
    const { threadId } = await step.runMutation(
      internal.agents.createThreadMutation,
      { userId }
    );

    // Step 2: Generate response
    const response = await step.runAction(
      internal.agents.generateTextAction,
      { threadId, prompt }
    );

    return response;
  },
});

Multi-Agent Workflows

Orchestrate multiple agents:

export const researchFlow = workflow.define({
  id: "research",
  args: { topic: v.string(), userId: v.string() },
  handler: async (step, { topic, userId }) => {
    const { threadId: researchId } = await step.runMutation(
      internal.agents.createThreadMutation,
      { userId, title: `Research: ${topic}` }
    );

    const research = await step.runAction(
      internal.agents.generateTextAction,
      { threadId: researchId, prompt: `Research: ${topic}` }
    );

    const { threadId: analysisId } = await step.runMutation(
      internal.agents.createThreadMutation,
      { userId, title: `Analysis: ${topic}` }
    );

    const analysis = await step.runAction(
      internal.agents.generateTextAction,
      { threadId: analysisId, prompt: `Analyze: ${research}` }
    );

    return { research, analysis };
  },
});

Key Principles

  • Durability: Workflows survive server restarts
  • Idempotency: Same workflow can be safely retried
  • Atomicity: Each step either completes fully or retries
  • Composability: Steps can call other workflows or actions

Next Steps

  • See fundamentals for agent setup
  • See tools for agents that call functions
  • See context for workflow-aware context

GitHub Repository

Sstobo/convex-skills
Path: convex-agents-workflows

Related Skills

sglang

Meta

SGLang is a high-performance LLM serving framework that specializes in fast, structured generation for JSON, regex, and agentic workflows using its RadixAttention prefix caching. It delivers significantly faster inference, especially for tasks with repeated prefixes, making it ideal for complex, structured outputs and multi-turn conversations. Choose SGLang over alternatives like vLLM when you need constrained decoding or are building applications with extensive prefix sharing.

View skill

evaluating-llms-harness

Testing

This Claude Skill runs the lm-evaluation-harness to benchmark LLMs across 60+ standardized academic tasks like MMLU and GSM8K. It's designed for developers to compare model quality, track training progress, or report academic results. The tool supports various backends including HuggingFace and vLLM models.

View skill

content-collections

Meta

This skill provides a production-tested setup for Content Collections, a TypeScript-first tool that transforms Markdown/MDX files into type-safe data collections with Zod validation. Use it when building blogs, documentation sites, or content-heavy Vite + React applications to ensure type safety and automatic content validation. It covers everything from Vite plugin configuration and MDX compilation to deployment optimization and schema validation.

View skill

llamaguard

Other

LlamaGuard is Meta's 7-8B parameter model for moderating LLM inputs and outputs across six safety categories like violence and hate speech. It offers 94-95% accuracy and can be deployed using vLLM, Hugging Face, or Amazon SageMaker. Use this skill to easily integrate content filtering and safety guardrails into your AI applications.

View skill