The Agents API is the next generation of our API, designed for better compatibility with modern AI SDKs like the Vercel AI SDK.
Overview
The Agents API represents a significant improvement over the Assistants API, with the main goal of providing native compatibility with industry-standard AI SDKs. The key difference is the removal of custom input/output transformations in favor of standard formats.Why Migrate?
- Vercel AI SDK compatibility: Works natively with AI SDK 5’s
useChatfunction - Standard formats: Uses industry-standard message formats instead of custom transformations
- Better streaming: Native support for AI SDK streaming patterns
- Future-proof: The Assistants API will be deprecated in a future release
Key Differences
Endpoint Changes
| Assistants API | Agents API | Breaking? |
|---|---|---|
/assistant/v1/chat/completions | /agent/v1/chat/completions | Yes - Format changes |
/assistant/v1/create | /agent/v1/create | No - Only parameter names |
/assistant/v1/get | /agent/v1/get | No - Only parameter names |
/assistant/v1/update | /agent/v1/update | No - Only parameter names |
/assistant/v1/models | /agent/v1/models | No - Identical |
Parameter Changes (Non-Breaking)
For create, get, and update endpoints, the only change is parameter naming:assistantId→agentId- Request/response structure remains identical
- All other parameters unchanged
Breaking Changes in /chat/completions
The chat completions endpoint has significant format changes to support Vercel AI SDK compatibility.
Request Format Changes
Old Format (Assistants API)
New Format (Agents API)
Key Request Differences
-
Message Structure:
- Old:
contentas string - New:
partsas array with typed objects
- Old:
-
Message ID:
- Old: Optional or auto-generated
- New: Required
idfield for each message
-
Attachments:
- Old:
attachmentIdsarray at message level - New:
metadata.attachmentsarray on the message object
- Old:
-
Parameter Name:
- Old:
assistantId - New:
agentId
- Old:
Response Format Changes
Old Format (Assistants API)
New Format (Agents API)
Key Response Differences
-
Top-level Structure:
- Old: Wrapped in
resultarray - New: Wrapped in
messagesarray
- Old: Wrapped in
-
Content Field:
- Old:
contentarray - New:
contentstring
- Old:
Streaming Changes
Old Format (Assistants API)
New Format (Agents API)
Uses Vercel AI SDK streaming format:useChat hook.
Migration Steps
Step 1: Update Endpoint URLs
Step 2: Update Parameter Names (Non-Breaking Endpoints)
For create, get, update endpoints:Step 3: Update Message Format (Breaking - Chat Completions)
Converting Messages
Using with Vercel AI SDK
The Agents API works natively with Vercel AI SDK’suseChat hook:
Step 4: Update Response Handling
Step 5: Update Streaming Code
Before (Custom SSE Parsing)
After (Vercel AI SDK)
Code Examples
Complete Migration Example
Before (Assistants API)
After (Agents API)
Using with Next.js and Vercel AI SDK
Testing Your Migration
Checklist
- Update all endpoint URLs from
/assistant/v1/*to/agent/v1/* - Replace
assistantIdwithagentIdin all requests - Convert message
contentstrings topartsarrays (for chat completions) - Add
idfield to all messages (for chat completions) - Update attachment references to use
metadata.attachmentsformat - Update response handling to work with new format
- Test streaming with new format (or use Vercel AI SDK)
- Update error handling for new response structure
Gradual Migration Strategy
You can migrate endpoints gradually:- Start with non-breaking endpoints: Migrate create, get, update, models first (only parameter names change)
- Test thoroughly: Ensure these work correctly
- Migrate chat completions last: This requires the most code changes
- Use feature flags: Toggle between old and new APIs during transition
Common Migration Issues
Issue 1: Missing Message IDs
Problem: Agents API requires message IDsIssue 2: Attachment Format
Problem: Old attachment format not recognizedmetadata.attachments
Issue 3: Response Parsing
Problem: Looking forresult array
messages array with content string
Support
If you encounter issues during migration:- Check the Agents API documentation for detailed examples
- Review the Vercel AI SDK documentation for SDK-specific help
- Contact support at support@langdock.com
Timeline
- Current: Both APIs are available
- Future: Assistants API will be deprecated (date TBD)
- Recommendation: Migrate new projects to Agents API now
For questions or assistance with migration, contact our support team at support@langdock.com.