Skip to content

feat(deploy): add Next.js + Vercel AI SDK adapter template (Strands VercelModel) - #310

Open
hsaenzG wants to merge 1 commit into
strands-agents:mainfrom
hsaenzG:add-nextjs-vercel-adapter-sample
Open

hsaenzG wants to merge 1 commit into
strands-agents:mainfrom
hsaenzG:add-nextjs-vercel-adapter-sample

Conversation

@hsaenzG

@hsaenzG hsaenzG commented Sep 24, 2026

Copy link
Copy Markdown

Summary

Adds a create-next-app-shaped chat template where the Vercel AI SDK owns the client and providers, and Strands Agents runs the loop, tools, sessions, and hooks inside the Next.js route handler through the VercelModel adapter. Ships with one-click deploy to Vercel and a container path to Amazon Bedrock AgentCore.

Location: typescript/02-deploy/02-nextjs-vercel-adapter/

What's included

  • AI SDK on the client — useChat from @ai-sdk/react manages the conversation and streaming UI.
  • Strands on the server — the agent loop, Zod-typed tools (calculator, current_time), session persistence, and lifecycle hooks run in app/api/chat/route.ts.
  • VercelModel adapter — Strands wraps any Vercel AI SDK provider (@ai-sdk/amazon-bedrock, @ai-sdk/openai). Switch providers with one env var, no code changes.
  • One-click deploy to Vercel — ships as a serverless Node function.
  • Container path to Amazon Bedrock AgentCore — the same agent served over the AgentCore HTTP contract (/ping + /invocations) on an ARM64 container.
  • Container path to any Node host — production Dockerfile using standalone Next.js output.

Model providers

  • Amazon Bedrock (default)
  • OpenAI

Testing

  • npm run dev — chat UI streams tokens and tool activity via useChat.
  • Verified tool calls: "what is 128 divided by 4?" (calculator) and "what time is it in America/Mexico_City?" (current_time).
  • npm run agentcore — local AgentCore runtime responds on /ping and streams from /invocations.

Asana

Ref: https://app.asana.com/1/8442528107068/project/1217155663608611/task/1218279858515566?focus=true

- Add complete Next.js application with Vercel deployment configuration
- Implement dual model provider support (Amazon Bedrock and OpenAI)
- Create pluggable session backend (memory, file, and S3 storage options)
- Add Docker setup with standalone Next.js build for containerized deployment
- Include AgentCore server for stateful agent operations
- Add chat API route with streaming support
- Configure environment templates and deployment documentation
- Provide architecture diagrams and deployment guides
- Update deploy module README with new adapter reference
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant