Wire Up AI
Now replace the stub reply with a real model call.
AI Gateway sends the request to Amazon Bedrock. AI SDK for Python gives the backend a simple way to write that model call.
The AI Gateway key is already included in your Devbox. You do not need to create a key for local workshop testing.
Later, when you deploy this app to Vercel, you will create an AI Gateway key for the deployed project.
Add the model
Ask the agent to call AI Gateway.
Paste this into your agent:
PromptAdd a real AI reply to the FastAPI backend using AI SDK for Python. Use AI Gateway for model calls. Use the AI_GATEWAY_API_KEY environment variable for AI Gateway auth. Route requests through AWS Bedrock and use Claude 4.5 Haiku.Try it in the app.
Go back to your port 3000 preview and send a message.
No AWS keys are needed in your app. For the workshop, Bedrock is reached through AI Gateway.
You are ready when
- Sending a message returns a real AI reply.
- Replies no longer look like
You said: .... - Your backend uses
AI_GATEWAY_API_KEYfor AI Gateway.