Skip to content

Conversation

@melienherrera
Copy link
Collaborator

What was changed

added AI SDK by Vercel sample to AI Cookbook

Why?

  • part of the upcoming Vercel AI SDK launch
    • additional AI cookbook recipe launch

Checklist

  1. Closes

  2. How was this tested:

Tested locally with the instructions in the README

  1. Any docs updates needed?

@cdavisafc cdavisafc force-pushed the basic-tool-calling-agent-AI-SDK-byvercel branch 4 times, most recently from 8033b55 to 98359f4 Compare January 17, 2026 20:34
@cdavisafc cdavisafc force-pushed the basic-tool-calling-agent-AI-SDK-byvercel branch from 98359f4 to f2da28e Compare January 17, 2026 20:50
Signed-off-by: Cornelia Davis <[email protected]>
Copy link
Collaborator

@cdavisafc cdavisafc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Runs fine. See comments throughout.

I've added one commit to this to exclude the node_modules directory - standard practice for typescript projects. I did this by adding the the root cookbook .gitignore in anticipation of more typescript example.

- Automatically wraps the LLM invocation as an activity
- Configures `temporalProvider` to point to `gpt-4o-mini` but you can use any model of your choice that is compatible with the AI SDK here.
- **Tools-as-Activities**: `proxyActivities` wires the `getWeather` and `calculateCircleArea` Activities into the Workflows so `toolsAgent` can offer tool schemas to the AI model, wait for results durably, and retry requests if needed.
- **Minimal orchestration**: The Workflow starter (`src/client.ts`) picks a Workflow name (`haiku` or `tools`) and runs it through a connected Temporal cluster, keeping the CLI code simple.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really a key pattern. Seems like an implementation detail.

},
});

export async function haikuAgent(prompt: string): Promise<string> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we including two workflows in this example. What value does the haiku workflow offer in this recipe?

@@ -0,0 +1,16 @@
export async function getWeather(input: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make a real API call to National Weather Service APIs, for example.

};
}

export async function calculateAreaOfCircle(input: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good example of an activity that doesn't go external.

workflowId: 'workflow-' + nanoid(),
});
break;
case 'haiku':
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment from the workflow code - why are we including haiku?

model: temporalProvider.languageModel('gpt-4o-mini'),
prompt: question,
system: 'You are a helpful agent.',
tools: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any APIs that create the tool json from function signatures?

npm run workflow tools
```

## Example prompts
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can these example prompts be supplied. The client looks like it just has some hardcoded things.

Signed-off-by: Cornelia Davis <[email protected]>
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