@corti/ai-sdk-adapter weekly downloads statistics
Corti AI SDK adapter for Vercel AI SDK, integrating with Corti's A2A agents API
@corti/ai-sdk-adapter has 443 recorded weekly downloads on npm, a decrease of 36.6% over the past 30 days, ranking #1571 of 2,322 tracked listings.
About @corti/ai-sdk-adapter
@corti/ai-sdk-adapter
Adapter for integrating Corti's A2A (Agent-to-Agent) API with Vercel AI SDK. This package provides utilities to convert between AI SDK's UI message format and Corti's A2A format.
Installation
npm install @corti/ai-sdk-adapter @corti/sdk @a2a-js/sdk ai
Overview
This adapter provides three main functions:
convertToParams()- ConvertsCortiUIMessage[]to A2AMessageSendParamstoUIMessageStream()- Converts A2A stream to UI message streamcreateA2AClientFactory()- Creates an A2A client factory configured with Corti authentication
Usage
Streaming Chat (Next.js API Route)
import { convertToParams, toUIMessageStream, createA2AClientFactory } from '@corti/ai-sdk-adapter';
import type { CortiUIMessage, ExpertCredential } from '@corti/ai-sdk-adapter';
import { CortiClient } from '@corti/lib';
import { createUIMessageStreamResponse } from 'ai';
export async function POST(req: Request) {
const { messages }: { messages: CortiUIMessage[] } = await req.json();
// Optional: Define credentials for MCP servers
const credentials: ExpertCredential[] = [
{
mcp_name: 'my-server',
token: process.env.MCP_TOKEN,
type: 'bearer' as const,
},
];
// Build A2A params from UI messages
const params = convertToParams(messages, credentials);
// Create A2A client factory and send message stream
const corti = new CortiClient({ /* ... */ });
const factory = createA2AClientFactory(corti);
const agentUrl = await corti.agents.getCardUrl("your-agent-id");
const client = factory.createFromUrl(agentUrl.toString(), '');
const a2aStream = client.sendMessageStream(params);
// Convert to UI stream with optional callbacks
const uiStream = toUIMessageStream(a2aStream, {
callbacks: {
onStart: () => console.log('Stream started'),
onEvent: (event) => console.log('Event:', event),
onFinish: (state) => console.log('Final state:', state),
onError: (error) => console.error('Error:', error),
},
});
return createUIMessageStreamResponse({ stream: uiStream });
}
Client-Side (React with useChat)
import { useState } from 'react';
import { useChat } from 'ai/react';
import type { CortiUIMessage } from '@corti/ai-sdk-adapter';
export default function Chat() {
const [input, setInput] = useState('');
const { messages, sendMessage, status } = useChat<CortiUIMessage>({
api: '/api/chat',
});
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
if (!input.trim() || status === "streaming" || status === "submitted") return;
sendMessage({ message: input });
setInput('');
};
return (
<div>
{messages.map((m) => (
<div key={m.id}>
<strong>{m.role}:</strong>{' '}
{m.parts.map(p => p.type === 'text' ? p.text : '').join(' ')}
</div>
))}
<form onSubmit={handleSubmit}>
<input value={input} onChange={(e) => setInput(e.target.value)} />
<button type="submit">Send</button>
</form>
</div>
);
}
Types
CortiUIMessage
Custom UI message type that extends the standard UIMessage with A2A-specific metadata and data parts:
import type { CortiUIMessage } from '@corti/ai-sdk-adapter';
// CortiUIMessage includes:
// - metadata: contextId, taskId, history, credits, state
// - custom data parts: text with name, json with name/content, status-update
ExpertCredential
Credentials for authenticating with MCP servers:
type ExpertCredential =
| {
mcp_name: string;
token: string;
type: 'bearer';
}
| {
mcp_name: string;
client_id: string;
client_secret: string;
type: 'oauth2.0';
};
How It Works
Context and Task Continuity
The adapter automatically manages conversation context and task continuity:
contextId: Maintains conversation context across multiple messages. Automatically inferred from the last assistant message.taskId: Continues an existing task when the agent requires more input. Only included when the last assistant message hasstate: 'input-required'.- Credentials: Only sent on the first message (when no
taskIdis present).
The convertToParams() function handles all of this automatically - you just pass the messages array from useChat.
Stream Callbacks
The toUIMessageStream() function accepts a StreamConversionOptions object with optional callbacks to monitor stream progress:
const uiStream = toUIMessageStream(a2aStream, {
callbacks: {
onStart: () => {
// Called when streaming begins
},
onEvent: (event) => {
// Called on each new event from the stream
},
onFinish: (state) => {
// Called when stream completes with the final task status
},
onError: (error: Error) => {
// Called if an error occurs during streaming
},
},
});
Runtime Support
This package supports:
- Node.js (18+)
- Edge runtimes (Vercel Edge, Cloudflare Workers)
Limitations
- No tool support: This adapter does not currently support AI SDK tools/function calling
- A2A-specific: Only works with Corti's A2A agents, not general LLM providers
License
MIT
Links
Description from the npm listing.
- ai
- ai-sdk
- vercel
- corti
- a2a
- agents
- llm
- language-model
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (122)Similar npm AI SDKs plugins
All 20 @corti/ai-sdk-adapter alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/@corti/ai-sdk-adapter. First seen Oct 16, 2026; last successful collection Oct 20, 2026. See the methodology.