feat: Add flight-booking-agent kit#271
Conversation
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
kits/flight-booking-agent/scripts/flight-booking-agent_code-node-974_code.ts (1)
1-47: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick winMission-critical: read upstream data from the workflow object.
{{codeNode_383.output}}resolves to a literal template path inside Studio Code node scripts, soflightParamswill not contain the extracted parameters and searches can fall through tovague_request. Useworkflow.codeNode_383.outputinstead.🔧 Proposed fix
-const flightParams = {{codeNode_383.output}}; +const flightParams = workflow.codeNode_383.output;Based on learnings, Lamatic Studio Code node scripts must read upstream values through
workflow.codeNode_383.output, not mustache expressions.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@kits/flight-booking-agent/scripts/flight-booking-agent_code-node-974_code.ts` around lines 1 - 47, Update the flightParams initialization in the main flow to read the upstream value from workflow.codeNode_383.output instead of the literal mustache template expression. Keep the existing vague-request check and downstream parameter extraction unchanged.Source: Learnings
♻️ Duplicate comments (1)
kits/flight-booking-agent/scripts/flight-booking-agent_code-node-974_code.ts (1)
102-119: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winKeep the timeout active through response-body parsing.
The timer is cleared as soon as
fetch()resolves, beforeresponse.json()completes. A response that sends headers but stalls while streaming its body can still hang the node indefinitely. MoveclearTimeout(timeoutId)into afinallyblock after parsing.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@kits/flight-booking-agent/scripts/flight-booking-agent_code-node-974_code.ts` around lines 102 - 119, Keep the timeout active through response-body parsing in the exchange-rate fetch flow. Move clearTimeout(timeoutId) out of the block immediately after fetch resolves and into a finally block that runs after response.json() and all subsequent processing, while preserving the existing success and error behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@kits/flight-booking-agent/scripts/flight-booking-agent_code-node-974_code.ts`:
- Line 62: Update the date generation near today so the example date reflects
the traveler’s request timezone rather than UTC; use the request timezone when
formatting the current date, or explicitly label the generated value as UTC if
timezone-aware formatting is unavailable.
---
Outside diff comments:
In
`@kits/flight-booking-agent/scripts/flight-booking-agent_code-node-974_code.ts`:
- Around line 1-47: Update the flightParams initialization in the main flow to
read the upstream value from workflow.codeNode_383.output instead of the literal
mustache template expression. Keep the existing vague-request check and
downstream parameter extraction unchanged.
---
Duplicate comments:
In
`@kits/flight-booking-agent/scripts/flight-booking-agent_code-node-974_code.ts`:
- Around line 102-119: Keep the timeout active through response-body parsing in
the exchange-rate fetch flow. Move clearTimeout(timeoutId) out of the block
immediately after fetch resolves and into a finally block that runs after
response.json() and all subsequent processing, while preserving the existing
success and error behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: 9dceb0e1-2149-469f-87ce-82cc5c1717c2
📒 Files selected for processing (3)
kits/flight-booking-agent/.env.examplekits/flight-booking-agent/apps/.env.examplekits/flight-booking-agent/scripts/flight-booking-agent_code-node-974_code.ts
💤 Files with no reviewable changes (2)
- kits/flight-booking-agent/.env.example
- kits/flight-booking-agent/apps/.env.example
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
kits/flight-booking-agent/apps/src/app/api/flights/route.ts (2)
6-14: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winMission critical: reject malformed search requests at the boundary.
request.json()failures,null, arrays, objects, and whitespace-only messages currently become a 500 or are sent to the workflow. Parse safely and require a trimmed string, returning 400 for invalid input.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@kits/flight-booking-agent/apps/src/app/api/flights/route.ts` around lines 6 - 14, Update the request parsing in the flights route to safely catch request.json() failures and validate that the parsed body is a non-null, non-array object with a message that is a string containing non-whitespace characters. Return a 400 response for every invalid case, and pass only the trimmed message to the workflow.
64-64: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winMission alert: keep
exchangeRatealigned with the shared response contract.This route emits
null, butSearchResponsedefines exchange-rate metadata as required numeric data anduseFlightsstores it asnumber | undefined. Either always normalize to a number or make the shared type and consumers explicitly null-aware.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@kits/flight-booking-agent/apps/src/app/api/flights/route.ts` at line 64, Update the exchangeRate handling in the flights route so it matches the shared SearchResponse contract and useFlights’s number | undefined expectation: normalize missing values to a numeric value, or consistently change the shared type and all consumers to explicitly support null. Prefer the smallest contract-preserving change and keep route response typing aligned.
♻️ Duplicate comments (1)
kits/flight-booking-agent/apps/src/components/ui/Input.tsx (1)
12-13: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winPreserve an explicitly supplied
id.Because
idis not destructured,{...props}can overwrite the input’s generated id while the label still references the generated value. Destructureid, deriveinputId = id ?? useId(), and useinputIdfor bothhtmlForand the input.🛠️ Proposed fix
- ({ label, error, fullWidth = true, className = "", ...props }, ref) => { - const id = useId(); + ({ label, error, fullWidth = true, className = "", id, ...props }, ref) => { + const generatedId = useId(); + const inputId = id ?? generatedId; ... - htmlFor={id} + htmlFor={inputId} ... - id={id} + id={inputId}Also applies to: 25-27, 36-36
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@kits/flight-booking-agent/apps/src/components/ui/Input.tsx` around lines 12 - 13, Update the Input component’s forwarded props destructuring to extract id, derive inputId from the supplied id or useId() when absent, and use inputId consistently for the label’s htmlFor and the input element’s id so explicit IDs are preserved.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@kits/flight-booking-agent/apps/src/app/page.tsx`:
- Around line 67-72: Update handleBookingConfirm to accept the email argument
passed by BookingModal.onSubmit and thread it into the resulting booking, such
as assigning it to Booking.passengerEmail for display without changing
persistence. Ensure the collected and validated email is no longer silently
ignored while preserving the existing addBooking flow.
In `@kits/flight-booking-agent/apps/src/components/ui/Badge.tsx`:
- Around line 12-17: Restore the complete CSS-variable theme contract across the
affected components. In
kits/flight-booking-agent/apps/src/components/ui/Badge.tsx lines 12-17, replace
raw status colors with CSS-variable-backed semantic variants; define card and
card-foreground tokens for Card.tsx lines 15-16, destructive
background/border/text tokens for ErrorAlert.tsx line 24,
muted/border/destructive/primary tokens for Input.tsx lines 29-33,
muted/border/muted-foreground tokens for Suggestions.tsx line 25, and the border
token for Footer.tsx line 9. Ensure the corresponding --color-* theme
definitions exist in the supplied globals.css.
In `@kits/flight-booking-agent/apps/src/components/ui/ErrorAlert.tsx`:
- Around line 26-32: Add role="alert" to the animated container enclosing the
error message and dismiss button in ErrorAlert so dynamically mounted search
failures are announced to assistive technology.
In `@kits/flight-booking-agent/apps/src/hooks/useBookings.ts`:
- Around line 56-65: Wire the existing removeBooking callback into the booking
history flow so the History “Remove” action performs permanent deletion. Update
page.tsx to destructure and pass removeBooking, then update BookingHistory.tsx
to accept and invoke it for the Remove button instead of routing that action
through onCancel/cancelBooking.
In `@kits/flight-booking-agent/apps/src/types/index.ts`:
- Around line 58-60: Align the demo booking flow around the email submitted by
BookingModal: either remove data.email from the form and submission path,
including passengerEmail from the booking type, or propagate it through
Home.handleBookingConfirm into useBookings and retain it under an explicit
policy. Do not leave passengerEmail optional while the value is silently
discarded.
In `@kits/flight-booking-agent/README.md`:
- Around line 51-63: Change the “# Lamatic API” line in the Environment
Variables section to non-heading text, such as plain descriptive text, so it no
longer creates an H1 or disrupts the Markdown heading hierarchy.
---
Outside diff comments:
In `@kits/flight-booking-agent/apps/src/app/api/flights/route.ts`:
- Around line 6-14: Update the request parsing in the flights route to safely
catch request.json() failures and validate that the parsed body is a non-null,
non-array object with a message that is a string containing non-whitespace
characters. Return a 400 response for every invalid case, and pass only the
trimmed message to the workflow.
- Line 64: Update the exchangeRate handling in the flights route so it matches
the shared SearchResponse contract and useFlights’s number | undefined
expectation: normalize missing values to a numeric value, or consistently change
the shared type and all consumers to explicitly support null. Prefer the
smallest contract-preserving change and keep route response typing aligned.
---
Duplicate comments:
In `@kits/flight-booking-agent/apps/src/components/ui/Input.tsx`:
- Around line 12-13: Update the Input component’s forwarded props destructuring
to extract id, derive inputId from the supplied id or useId() when absent, and
use inputId consistently for the label’s htmlFor and the input element’s id so
explicit IDs are preserved.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: cbdefb09-603e-4ee2-881d-2489488bf0a2
⛔ Files ignored due to path filters (1)
kits/flight-booking-agent/apps/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (23)
kits/flight-booking-agent/README.mdkits/flight-booking-agent/apps/next.config.tskits/flight-booking-agent/apps/package.jsonkits/flight-booking-agent/apps/src/app/api/flights/route.tskits/flight-booking-agent/apps/src/app/globals.csskits/flight-booking-agent/apps/src/app/page.tsxkits/flight-booking-agent/apps/src/components/booking/BookingHistory.tsxkits/flight-booking-agent/apps/src/components/booking/BookingModal.tsxkits/flight-booking-agent/apps/src/components/flights/FlightCard.tsxkits/flight-booking-agent/apps/src/components/flights/FlightResults.tsxkits/flight-booking-agent/apps/src/components/flights/Suggestions.tsxkits/flight-booking-agent/apps/src/components/layout/Footer.tsxkits/flight-booking-agent/apps/src/components/ui/Badge.tsxkits/flight-booking-agent/apps/src/components/ui/Button.tsxkits/flight-booking-agent/apps/src/components/ui/Card.tsxkits/flight-booking-agent/apps/src/components/ui/ErrorAlert.tsxkits/flight-booking-agent/apps/src/components/ui/Input.tsxkits/flight-booking-agent/apps/src/components/ui/Pagination.tsxkits/flight-booking-agent/apps/src/hooks/useBookings.tskits/flight-booking-agent/apps/src/lib/formatters.tskits/flight-booking-agent/apps/src/lib/utils.tskits/flight-booking-agent/apps/src/types/index.tskits/flight-booking-agent/constitutions/default.md
💤 Files with no reviewable changes (1)
- kits/flight-booking-agent/apps/next.config.ts
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@kits/flight-booking-agent/apps/src/components/ui/Pagination.tsx`:
- Around line 48-59: Update PaginationLink and its usage in FlightResults so
click-driven pagination renders a native button instead of an anchor without
href, preserving the existing active styling and click behavior. Pass disabled
to boundary controls such as previous/next when they cannot paginate; retain
anchor rendering only when a real navigable href is provided.
- Line 4: Align all Button imports with the canonical component casing. Update
the imports in
kits/flight-booking-agent/apps/src/components/ui/Pagination.tsx#L4-L4,
kits/flight-booking-agent/apps/src/components/flights/FlightCard.tsx#L6-L6,
kits/flight-booking-agent/apps/src/components/flights/SearchForm.tsx#L6-L6,
kits/flight-booking-agent/apps/src/components/layout/Header.tsx#L5-L5, and
kits/flight-booking-agent/apps/src/components/booking/BookingModal.tsx#L10-L10
to reference the Button module using the same casing as Button.tsx.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: aa9862b0-8ae4-4523-b213-31a3b4a9cf75
⛔ Files ignored due to path filters (1)
kits/flight-booking-agent/apps/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (16)
kits/flight-booking-agent/README.mdkits/flight-booking-agent/apps/components.jsonkits/flight-booking-agent/apps/package.jsonkits/flight-booking-agent/apps/src/app/globals.csskits/flight-booking-agent/apps/src/app/page.tsxkits/flight-booking-agent/apps/src/components/booking/BookingHistory.tsxkits/flight-booking-agent/apps/src/components/booking/BookingModal.tsxkits/flight-booking-agent/apps/src/components/flights/FlightCard.tsxkits/flight-booking-agent/apps/src/components/flights/FlightResults.tsxkits/flight-booking-agent/apps/src/components/flights/SearchForm.tsxkits/flight-booking-agent/apps/src/components/layout/Header.tsxkits/flight-booking-agent/apps/src/components/ui/Button.tsxkits/flight-booking-agent/apps/src/components/ui/ErrorAlert.tsxkits/flight-booking-agent/apps/src/components/ui/Pagination.tsxkits/flight-booking-agent/apps/src/lib/utils.tskits/flight-booking-agent/apps/src/types/index.ts
|
/validate |
|
📡 Running Studio validation — results will appear here shortly. |
|
@Nhlalo LGTM! |
|
@akshatvirmani Fixed the last recommendation by coderabbit, awaiting the merge. |
|
/validate |
|
📡 Running Studio validation — results will appear here shortly. |
What This PR Does
Adds a Flight Booking Agent kit to AgentKit — an AI-powered flight search agent that finds budget-friendly flights using natural language.
Contribution Type
Validation Checklist
Config & Flow Files
lamatic.config.tsagent.mdflows/flight-search.jsonLive Demo
Try it now: https://flight-booking-agent-pearl.vercel.app
Features
Tech Stack
Files Added
kits/flight-booking-agent/- Full kit structureapps/- Next.js frontendflows/- Lamatic flow exportlamatic.config.tsagent.mdREADME.mdNotes
Added Flight Booking Agent kit (docs/config/guardrails):
kits/flight-booking-agent/.env.examplekits/flight-booking-agent/.gitignorekits/flight-booking-agent/README.mdkits/flight-booking-agent/agent.mdkits/flight-booking-agent/constitutions/default.mdkits/flight-booking-agent/lamatic.config.tsAdded Lamatic workflow wiring (nodes/references/prompts/models):
kits/flight-booking-agent/flows/flight-booking-agent.tskits/flight-booking-agent/model-configs/flight-booking-agent_llmnode-977_generative-model-name.tskits/flight-booking-agent/prompts/flight-booking-agent_llmnode-977_system_0.mdkits/flight-booking-agent/prompts/flight-booking-agent_llmnode-977_user_1.mdAdded Lamatic code nodes (parameter extraction + search/pricing formatting):
kits/flight-booking-agent/scripts/flight-booking-agent_code-node-383_code.tskits/flight-booking-agent/scripts/flight-booking-agent_code-node-974_code.tsAdded Next.js 14 TypeScript frontend (Vercel demo + Lamatic-backed API route):
kits/flight-booking-agent/apps/.env.examplekits/flight-booking-agent/apps/.gitignorekits/flight-booking-agent/apps/.prettierignorekits/flight-booking-agent/apps/.prettierrckits/flight-booking-agent/apps/AGENTS.mdkits/flight-booking-agent/apps/CLAUDE.mdkits/flight-booking-agent/apps/components.jsonkits/flight-booking-agent/apps/eslint.config.mjskits/flight-booking-agent/apps/global.d.tskits/flight-booking-agent/apps/next.config.tskits/flight-booking-agent/apps/package.jsonkits/flight-booking-agent/apps/package-lock.jsonkits/flight-booking-agent/apps/postcss.config.mjskits/flight-booking-agent/apps/tsconfig.jsonkits/flight-booking-agent/apps/public/home.pngkits/flight-booking-agent/apps/src/app/globals.csskits/flight-booking-agent/apps/src/app/layout.tsxkits/flight-booking-agent/apps/src/app/page.tsxkits/flight-booking-agent/apps/src/app/api/flights/route.tskits/flight-booking-agent/apps/src/components/ClientOnly.tsxkits/flight-booking-agent/apps/src/components/layout/Header.tsxkits/flight-booking-agent/apps/src/components/layout/Footer.tsxkits/flight-booking-agent/apps/src/components/booking/BookingHistory.tsxkits/flight-booking-agent/apps/src/components/booking/BookingModal.tsxkits/flight-booking-agent/apps/src/components/flights/SearchForm.tsxkits/flight-booking-agent/apps/src/components/flights/Suggestions.tsxkits/flight-booking-agent/apps/src/components/flights/FlightResults.tsxkits/flight-booking-agent/apps/src/components/flights/FlightStats.tsxkits/flight-booking-agent/apps/src/components/flights/FlightCard.tsxkits/flight-booking-agent/apps/src/components/ui/Badge.tsxkits/flight-booking-agent/apps/src/components/ui/Button.tsxkits/flight-booking-agent/apps/src/components/ui/Card.tsxkits/flight-booking-agent/apps/src/components/ui/ErrorAlert.tsxkits/flight-booking-agent/apps/src/components/ui/Input.tsxkits/flight-booking-agent/apps/src/components/ui/Pagination.tsxkits/flight-booking-agent/apps/src/components/ui/Spinner.tsxkits/flight-booking-agent/apps/src/hooks/useFlights.tskits/flight-booking-agent/apps/src/hooks/useBookings.tskits/flight-booking-agent/apps/src/hooks/useLocalStorage.tskits/flight-booking-agent/apps/src/lib/constants.tskits/flight-booking-agent/apps/src/lib/formatters.tskits/flight-booking-agent/apps/src/lib/generators.tskits/flight-booking-agent/apps/src/lib/utils.tskits/flight-booking-agent/apps/src/types/index.tsFlow overview (from
kits/flight-booking-agent/flows/flight-booking-agent.ts; no separateflow.jsonfound):triggerNode(triggerNode_1): real-time GraphQL/API trigger accepting{ "message": "string" }dynamicNode:LLMNode_977(“Generate Text”): uses Groq-backed model ref plus the system/user prompt markdownscodeNode_383: extracts/validates LLM JSON and builds Duffel offer-request parameters (or returnsvague_request)codeNode_974: fetches exchange rate, queries Duffel for offer pricing (search only), converts/filter by cabin + optional min/max, and normalizes the finalflights+ summary statsresponseNode(responseNode_triggerNode_1): mapscodeNode_974.outputfields into the API JSON response payload