Skip to content

Commit 6a75c8e

Browse files
rosetta-livekit-bot[bot]KrishnaShukdavidzhaodevin-ai-integration[bot]
authored
fix(anthropic): cover retry stream recreation (#1588)
Co-authored-by: Krishna Shukla <shuklakrishna.kris@gmail.com> Co-authored-by: rosetta-livekit-bot[bot] <282703043+rosetta-livekit-bot[bot]@users.noreply.github.com> Co-authored-by: David Zhao <dz@livekit.io> Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent a0144bb commit 6a75c8e

12 files changed

Lines changed: 1063 additions & 0 deletions

File tree

.changeset/many-kiwis-lose.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@livekit/agents-plugin-anthropic": patch
3+
---
4+
5+
fix(anthropic): add non-whitespace trailing dummy

.changeset/orange-squids-cover.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@livekit/agents-plugin-anthropic': patch
3+
---
4+
5+
added anthropic plugin

plugins/anthropic/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# @livekit/agents-plugin-anthropic
2+
3+
Anthropic plugin for LiveKit Node Agents.
4+
5+
## Installation
6+
7+
```bash
8+
npm install @livekit/agents-plugin-anthropic
9+
```
10+
11+
## Usage
12+
13+
```typescript
14+
import * as anthropic from '@livekit/agents-plugin-anthropic';
15+
16+
const session = new voice.AgentSession({
17+
llm: new anthropic.LLM({
18+
model: 'claude-sonnet-4-6',
19+
}),
20+
});
21+
```
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* Config file for API Extractor. For more info, please visit: https://api-extractor.com
3+
*/
4+
{
5+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
6+
7+
/**
8+
* Optionally specifies another JSON config file that this file extends from. This provides a way for
9+
* standard settings to be shared across multiple projects.
10+
*
11+
* If the path starts with "./" or "../", the path is resolved relative to the folder of the file that contains
12+
* the "extends" field. Otherwise, the first path segment is interpreted as an NPM package name, and will be
13+
* resolved using NodeJS require().
14+
*
15+
* SUPPORTED TOKENS: none
16+
* DEFAULT VALUE: ""
17+
*/
18+
"extends": "../../api-extractor-shared.json",
19+
"mainEntryPointFilePath": "./dist/index.d.ts"
20+
}

plugins/anthropic/package.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"name": "@livekit/agents-plugin-anthropic",
3+
"version": "1.0.0",
4+
"description": "Anthropic plugin for LiveKit Node Agents",
5+
"main": "dist/index.js",
6+
"require": "dist/index.cjs",
7+
"types": "dist/index.d.ts",
8+
"exports": {
9+
"import": {
10+
"types": "./dist/index.d.ts",
11+
"default": "./dist/index.js"
12+
},
13+
"require": {
14+
"types": "./dist/index.d.cts",
15+
"default": "./dist/index.cjs"
16+
}
17+
},
18+
"author": "LiveKit",
19+
"type": "module",
20+
"repository": "git@github.com:livekit/agents-js.git",
21+
"license": "Apache-2.0",
22+
"files": [
23+
"dist",
24+
"src",
25+
"README.md"
26+
],
27+
"scripts": {
28+
"build": "tsup --onSuccess \"pnpm build:types\"",
29+
"build:types": "tsc --declaration --emitDeclarationOnly && node ../../scripts/copyDeclarationOutput.js",
30+
"clean": "rm -rf dist",
31+
"clean:build": "pnpm clean && pnpm build",
32+
"lint": "eslint -f unix \"src/**/*.{ts,js}\"",
33+
"api:check": "api-extractor run --typescript-compiler-folder ../../node_modules/typescript",
34+
"api:update": "api-extractor run --local --typescript-compiler-folder ../../node_modules/typescript --verbose"
35+
},
36+
"devDependencies": {
37+
"@livekit/agents": "workspace:*",
38+
"@livekit/agents-plugins-test": "workspace:*",
39+
"@livekit/rtc-node": "catalog:",
40+
"@microsoft/api-extractor": "^7.35.0",
41+
"tsup": "^8.3.5",
42+
"typescript": "^5.0.0",
43+
"zod": "^3.25.76 || ^4.1.8"
44+
},
45+
"dependencies": {
46+
"@anthropic-ai/sdk": "^0.33.1"
47+
},
48+
"peerDependencies": {
49+
"@livekit/agents": "workspace:*",
50+
"@livekit/rtc-node": "catalog:"
51+
}
52+
}

plugins/anthropic/src/index.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// SPDX-FileCopyrightText: 2026 LiveKit, Inc.
2+
//
3+
// SPDX-License-Identifier: Apache-2.0
4+
import { Plugin } from '@livekit/agents';
5+
6+
export { LLM, LLMStream, type LLMOptions } from './llm.js';
7+
export * from './models.js';
8+
9+
class AnthropicPlugin extends Plugin {
10+
constructor() {
11+
super({
12+
title: 'anthropic',
13+
version: __PACKAGE_VERSION__,
14+
package: __PACKAGE_NAME__,
15+
});
16+
}
17+
}
18+
19+
Plugin.registerPlugin(new AnthropicPlugin());

0 commit comments

Comments
 (0)