Building durable Agents with Workflow DevKit & AI SDK - Peter Wielander, Vercel

By AI Engineer

Share:

Key Concepts

  • Workflow Dev Kit: An open-source library for building durable, observable, and reliable agent-based workflows.
  • Workflow Pattern: Separating agent logic into isolated, retryable steps orchestrated by a central workflow layer.
  • Versioning & Migration: A robust system for managing workflow versions, facilitating upgrades, and ensuring compatibility.
  • Observability: Built-in support for monitoring and understanding workflow execution through tools like OpenTelemetry.
  • Security: Planned features for end-to-end encryption and secure secret management.
  • Community Driven: An open-source project actively encouraging community contributions and feedback.

Workflow Development Kit: A Comprehensive Overview

Introduction & Problem Statement

The Workflow Development Kit (Workflow Dev Kit) is an open-source library designed to simplify the development and deployment of durable and observable agent-based workflows. Developers often face operational overhead – managing queues, databases, error handling, and observability – when moving agents from local development to production. The Workflow Dev Kit addresses this by abstracting away these complexities. The core idea is to focus on agent capabilities rather than the underlying infrastructure. Currently running over 1 million workflows daily internally, the platform is in beta, prioritizing API stabilization and bug fixes.

Core Architecture & Workflow Pattern

The kit implements the workflow pattern, separating code into isolated, retryable “steps” orchestrated by a central “workflow.” This layer manages state persistence and facilitates resilience. Workflows are composed of individual tool or Language Model (LM) calls (the “steps”) managed by the overall agent loop (the “workflow”). Key features include first-class observability, durability, reliability, resumability, and easy integration of human-in-the-loop workflows. It’s cloud agnostic and compatible with TypeScript frontends/backends, demonstrated with a Vercel deployment.

Integrating Workflows into Existing Applications

Workflow integration involves installing the workflow and @workflow/next packages, extending the Next.js compiler with useWorkflow, adding a TypeScript plugin for autocompletion, extracting agent logic into a separate workflow function, marking LLM and tool calls as “steps” using useStep, and starting the workflow using start from the workflow/API. Resumable streams are enabled by returning the workflow run ID to the client and creating an API endpoint to resume the stream using getRun. Webhooks are supported by creating a webhook tool that suspends execution until the webhook URL is called.

Versioning, Migration & Compatibility

The platform’s versioning system treats each deployment (CI/CD to preview or production) as a new version, accessible via a unique URL. The run.upgrade function checks compatibility with new versions. Migration is treated similarly to upgrading, allowing selection of multiple runs for simultaneous updates. The system attempts in-place migrations when code compatibility allows, offering different options based on code changes. A key component of this system is the use of a manifest, which stores input and output signatures for each step and the workflow itself, enabling compatibility checks. The compiler plugin ensures full compatibility detection.

Observability & Telemetry

The platform supports OpenTelemetry spans, enabling integration with observability tools like DataDog. Default context will be added to spans, providing information on steps and event logs. Users can also submit their own custom telemetry data using a helper function for adding custom information to spans.

Security Considerations

Currently, input and output data can be inspected via the API (accessible to authorized users). Future development includes end-to-end encryption for data storage. Secrets can be injected as environment variables during workflow execution, with logging discouraged. While currently exposed in observability for authorized users, encryption of secrets is planned.

Community & Future Development

The Workflow Dev Kit is actively seeking community contributions, with an RFC section on GitHub Discussions for feature requests. All adapters enabling the platform to run on various cloud backends are open-source, allowing users to inspect, connect, and contribute. The team is focused on addressing the challenges of evolving code and providing a “push-button” upgrade experience.

Conclusion

The Workflow Development Kit offers a powerful solution for building and deploying reliable, observable, and scalable agent-based workflows. By abstracting away the complexities of infrastructure management and providing robust versioning, migration, and observability features, the kit empowers developers to focus on building innovative agent applications. The open-source nature and active community engagement further contribute to its potential for long-term growth and adoption.

Chat with this Video

AI-Powered

Hi! I can answer questions about this video "Building durable Agents with Workflow DevKit & AI SDK - Peter Wielander, Vercel". What would you like to know?

Chat is based on the transcript of this video and may not be 100% accurate.

Related Videos

Ready to summarize another video?

Summarize YouTube Video