Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,11 @@ await anthropic.messages.create({
npm install @stackone/ai ai @ai-sdk/openai # or: yarn/pnpm/bun add
```

> Supports AI SDK v5–v7 (`ai` `>=5.0.108 <8.0.0`). AI SDK v7 requires Node.js 22+.

```typescript
import { openai } from '@ai-sdk/openai';
import { generateText } from 'ai';
import { generateText, stepCountIs } from 'ai';
import { StackOneToolSet } from '@stackone/ai';

// Reads STACKONE_API_KEY and STACKONE_ACCOUNT_ID from environment
Expand All @@ -207,9 +209,9 @@ const toolset = new StackOneToolSet();
const tools = await toolset.fetchTools();

await generateText({
model: openai('gpt-5.1'),
tools: await tools.toAISDK(),
maxSteps: 3,
model: openai('gpt-5.1'),
tools: await tools.toAISDK(),
stopWhen: stepCountIs(3),
});
```

Expand Down
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Converts StackOne tools to Anthropic format with `tools.toAnthropic()` and sends

### [`ai-sdk-integration.ts`](./ai-sdk-integration.ts) -- Vercel AI SDK

Integrates with the Vercel AI SDK via `tools.toAISDK()`. Runs a multi-step agent loop using `generateText` with `stopWhen: stepCountIs(3)`, letting the model autonomously call tools and reason over results.
Integrates with the Vercel AI SDK via `tools.toAISDK()`. Runs a multi-step agent loop using `generateText` with `stopWhen: stepCountIs(3)`, letting the model autonomously call tools and reason over results. Compatible with AI SDK v5–v7; AI SDK v7 requires Node.js 22+.

### [`claude-agent-sdk-integration.ts`](./claude-agent-sdk-integration.ts) -- Claude Agent SDK

Expand Down
6 changes: 4 additions & 2 deletions examples/ai-sdk-integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
* can autonomously call tools and reason over results until the stop condition
* is met.
*
* In AI SDK v6+, you can use the `ToolLoopAgent` class for more explicit
* agent functionality.
* Compatible with AI SDK v5–v7 (`ai` peer `>=5.0.108 <8.0.0`). Uses
* `stepCountIs`, which exists in v5/v6 and remains available as an alias in v7.
* AI SDK v7 requires Node.js 22+. You can also use the `ToolLoopAgent` class
* for more explicit agent functionality.
*/

import process from 'node:process';
Expand Down
Loading