Skip to content

Conversation

@TooTallNate
Copy link
Member

@TooTallNate TooTallNate commented Nov 25, 2025

This PR adds wrapper functions for AI providers that can be used for the model property when creating a DurableAgent instance. As a POC, only a few of the most popular providers are included:

  • Anthropic (@workflow/ai/anthropic)
  • Vercel Gateway (@workflow/ai/gateway)
  • OpenAI (@workflow/ai/openai)
  • Google (@workflow/ai/google)
  • xAI (@workflow/ai/xai)

Example

import { DurableAgent } from '@workflow/ai/agent';
import { openai } from '@workflow/ai/openai';
import { convertToModelMessages, type UIMessageChunk } from 'ai';
import { getWritable } from 'workflow';

export async function test() {
  'use workflow';

  const agent = new DurableAgent({
    model: openai('gpt-5.1'),
  });

  await agent.stream({
    messages: convertToModelMessages([
      {
        role: 'user',
        parts: [
          { type: 'text', text: 'Hello world!' },
        ],
      },
    ]),
    writable: getWritable<UIMessageChunk>(),
  });
}

@changeset-bot
Copy link

changeset-bot bot commented Nov 25, 2025

🦋 Changeset detected

Latest commit: d1bef7f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@workflow/ai Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Contributor

vercel bot commented Nov 25, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview Comment Nov 27, 2025 7:41am
example-nextjs-workflow-webpack Ready Ready Preview Comment Nov 27, 2025 7:41am
example-workflow Ready Ready Preview Comment Nov 27, 2025 7:41am
workbench-express-workflow Ready Ready Preview Comment Nov 27, 2025 7:41am
workbench-fastify-workflow Error Error Nov 27, 2025 7:41am
workbench-hono-workflow Ready Ready Preview Comment Nov 27, 2025 7:41am
workbench-nitro-workflow Ready Ready Preview Comment Nov 27, 2025 7:41am
workbench-nuxt-workflow Ready Ready Preview Comment Nov 27, 2025 7:41am
workbench-sveltekit-workflow Ready Ready Preview Comment Nov 27, 2025 7:41am
workbench-vite-workflow Ready Ready Preview Comment Nov 27, 2025 7:41am
workflow-docs Ready Ready Preview Comment Nov 27, 2025 7:41am

Copy link
Member Author

TooTallNate commented Nov 25, 2025

@socket-security
Copy link

socket-security bot commented Nov 25, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​@​ai-sdk/​gateway@​2.0.151001008398100
Addednpm/​@​ai-sdk/​xai@​2.0.371001008498100
Addednpm/​@​ai-sdk/​google@​2.0.431001008498100
Addednpm/​@​ai-sdk/​anthropic@​2.0.491001008598100
Addednpm/​@​ai-sdk/​openai@​2.0.721001008598100

View full report

@TooTallNate TooTallNate marked this pull request as ready for review November 25, 2025 23:26
@TooTallNate TooTallNate force-pushed the 11-25-add_ai_provider_step_wrapper_functions branch from 3bec6fc to 60bb0e7 Compare November 26, 2025 06:51
@TooTallNate TooTallNate force-pushed the 11-25-apply_workflow_function_transformation_in_step_mode branch from aea517c to 2c14df3 Compare November 26, 2025 06:51
@TooTallNate TooTallNate force-pushed the 11-25-apply_workflow_function_transformation_in_step_mode branch from 087de61 to 0435e44 Compare November 27, 2025 07:25
Base automatically changed from 11-25-apply_workflow_function_transformation_in_step_mode to main November 27, 2025 07:35
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.

3 participants