Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
| CHECKOUT (when user says they want to check out): | ||
| Use the MCP 'checkout' tool with: | ||
| - email: "demo@empower-plant.com" | ||
| - name: "Demo Customer" | ||
| - address: "123 Plant Street, Garden City, CA 94000" |
There was a problem hiding this comment.
Bug: The agent's instructions for the checkout tool don't match the tool's required input schema, causing checkout to fail due to validation errors.
Severity: CRITICAL
Suggested Fix
Update the agent's instructions in shopping_agent.py to request all necessary fields for the checkout tool. Implement logic to track the user's cart state (items, quantities, total) within the SessionState. Ensure the agent can construct the full cart and form objects required by the checkout tool's Zod schema before making the tool call.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: agent/app/agents/shopping_agent.py#L49-L53
Potential issue: The agent's instructions for the `checkout` tool are incomplete. The
instructions tell the LLM to call the tool with only `email`, `name`, and `address`.
However, the tool's schema requires a full `cart` object (containing items, quantities,
and total) and a `form` object with separate fields for `firstName`, `lastName`, `city`,
`state`, etc. The application lacks the necessary state management to track cart
contents and construct this required data structure. As a result, the MCP SDK's
validation will reject the tool call, causing the checkout process to fail for the user.
Did we get this right? 👍 / 👎 to inform future reviews.
…the agents"" This reverts commit ac156e4.
|
| CHECKOUT_RESULT:{"success":false,"error":"Error message"} | ||
|
|
||
| ERROR HANDLING: If checkout or any operation fails, display the error and stop. Do NOT offer to retry or troubleshoot. | ||
|
|
||
| STYLE: Concise, friendly, ONE question at a time. |
There was a problem hiding this comment.
Bug: The parse_agent_output function processes CHECKOUT_RESULT line-by-line and fails to parse multi-line JSON from the LLM, causing the result to be displayed as plain text.
Severity: MEDIUM
Suggested Fix
Modify the parse_agent_output function to handle multi-line JSON. When a CHECKOUT_RESULT: marker is found, buffer subsequent lines until a complete JSON object is formed (e.g., by tracking curly brace counts or using a timeout) before attempting to parse it with json.loads().
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: agent/app/agents/shopping_agent.py#L58-L62
Potential issue: The `parse_agent_output` function in `shopping_agent.py` processes
agent output line-by-line. For `CHECKOUT_RESULT` messages, it expects the entire JSON
payload to be on a single line. However, LLMs may format JSON across multiple lines for
readability. When this happens, the parser attempts to call `json.loads()` on an
incomplete fragment (e.g., just `{`), which throws a `JSONDecodeError`. The error
handling then appends the line to a message buffer as plain text. As a result, the
structured `checkout_result` card is not rendered in the UI, and the user sees the raw,
unformatted JSON text instead, degrading the user experience.
Goal
This builds on the initial agent+mcp work which had a lot of hardcoded filler data by actually plugging into Empower DB with products and reviews (recommend the gadgets, i.e. actual products being sold instead of recommending plants). Most importantly it integrates with our backend APIs including
/checkouthighlighting how errors and slowdowns happen downstream from the agent - a unique differentiator that pure AI observability platforms don't have.TODO: