Fix Tambo SDK 500 errors and wire up AgentGrid tool in chat API#3
Draft
charliecreates[bot] wants to merge 6 commits intomainfrom
Draft
Fix Tambo SDK 500 errors and wire up AgentGrid tool in chat API#3charliecreates[bot] wants to merge 6 commits intomainfrom
charliecreates[bot] wants to merge 6 commits intomainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #1
Summary
This pull request fixes the 500 Internal Server Error occurring in
app/api/chat/route.tswhen calling the Tambo API and correctly wires up theAgentGridtool so that tool calls are returned to the frontend.Changes
Use correct free-tier model
app/api/chat/route.tsto use the appropriate Tambo/OpenAI-compatible model for the free tier (gpt-4.1-2025-04-14orgpt-4o-mini, depending on availability/configuration).Fix
AgentGridtool definitiontoolsconfiguration passed into the Tambo client so thatAgentGridis defined in a TypeScript- and Zod-safe way.AgentGridtool inline with a proper JSON schema / Zod schema, orAgentGridtool definition and wired it into the tools array/object expected by the SDK.Return tool calls in API response
AgentGridtool, the resulting tool call (name + arguments) is included in the JSON body so the frontend can render the grid UI.Remove manual circuit breaker logic
app/api/chat/route.tsthat bypassed or mocked the Tambo API.Error handling and type safety
toolsconfiguration so future schema changes surface during development rather than at runtime.Testing
app/api/chat/route.tswith and withoutAgentGrid-relevant prompts.AgentGridare present in the API response and parseable by the frontend.