Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
38 changes: 38 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,44 @@ jobs:
- name: Run Tests
run: pnpm test

# The `ai` peer range spans three majors whose tool types differ, so the
# single build-and-test job above only ever proves the version pinned in the
# dev catalog. This job checks the rest of the declared range.
#
# Versions are pinned rather than ranged: newer v5/v6 patches resolve
# transitive packages that this repo's `trustPolicy: no-downgrade` rejects,
# which would fail CI for reasons unrelated to the code under test.
ai-peer-range:
name: ai-peer-range (${{ matrix.ai }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ai:
- 5.0.108 # lower bound of the peer range
- 6.0.7 # last v6 the dev catalog shipped
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Setup Nix
uses: ./.github/actions/setup-nix
with:
skip-pnpm-install: 'true'

# `--filter .` keeps the examples workspace out of resolution; it pulls a
# dependency that `blockExoticSubdeps` rejects on any lockfile update.
- name: Install with ai@${{ matrix.ai }}
run: |
sed -i -E "/^ dev:/,/^ [a-z]+:/ s|^ ai: .*| ai: '${{ matrix.ai }}'|" pnpm-workspace.yaml
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
grep -nE "^ ai: " pnpm-workspace.yaml
pnpm install --no-frozen-lockfile --filter .

# Type errors are the failure mode here, and vitest type-checks the suite
# via the root project's `typecheck` config.
- name: Run Tests
run: pnpm exec vitest run --project root

coverage:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
Expand Down
6 changes: 4 additions & 2 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 @@ -209,7 +211,7 @@ const tools = await toolset.fetchTools();
await generateText({
model: openai('gpt-5.1'),
tools: await tools.toAISDK(),
maxSteps: 3,
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
Loading