What you need
- A Next.js project with the App Router (Node 20+).
- A Doconda API key in
DOCONDA_API_KEY. Create it in the dashboard, under API keys. - Your model provider’s key. Here we use Anthropic (
ANTHROPIC_API_KEY); any other AI SDK provider works.
1. Install the dependencies
2. Create the chat route
doconda.tools() gives you Doconda’s tools (create, upload, review, edit…). You turn them into AI SDK tools and pass
them to streamText.
app/api/chat/route.ts
3. Create the chat page
useChat sends the messages to /api/chat and renders the reply as it arrives.
app/page.tsx
4. Try it
http://localhost:3000 and type “Make me a welcome letter for a new client”.
Result
The agent callscreate_document, waits until the Word file is ready and gets this back:
.docx) and to its PDF. The links expire after 5 minutes; if the
user comes back later, the agent calls get_document and gets new ones.
Next steps
- AI SDK: the full guide, also with the MCP client.
- TypeScript SDK: every method, in case you want to call Doconda without an agent.
- Complete examples on GitHub.