Skip to content

Refactor AI-Agents service integration: rename endpoints, move ai_description to Itinerary#40

Closed
Copilot wants to merge 2 commits into
developmentfrom
copilot/integrate-ai-agents-client
Closed

Refactor AI-Agents service integration: rename endpoints, move ai_description to Itinerary#40
Copilot wants to merge 2 commits into
developmentfrom
copilot/integrate-ai-agents-client

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 29, 2025

Aligns AI-Agents service integration with proper REST semantics and data model. Moves AI description from response-level to itinerary-level where it belongs, and renames /insights/route to /insight/leg to reflect what's actually being described.

Schema Changes

  • Itinerary schema: Added optional ai_description field for AI-generated itinerary summaries
  • RouteSearchResponse schema: Removed ai_description (now lives on each Itinerary)

Service Layer

  • Renamed: get_route_insight()get_leg_insight()
  • Endpoint: /insights/route/api/v1/insight/leg
  • New method: get_itinerary_insight() calls /api/v1/insight/itinerary

Both methods gracefully degrade on failure (return None), maintaining service availability when AI-Agents is unavailable.

Route Endpoint

The /route/search endpoint now enriches responses with two AI calls per itinerary:

# For each itinerary
itinerary.ai_description = await ai_agents_service.get_itinerary_insight(itinerary)

# For each leg in itinerary
leg.ai_insight = await ai_agents_service.get_leg_insight(leg)

All AI enrichment is wrapped in try-except for graceful degradation.

Tests

Added 6 tests for get_itinerary_insight(). Updated existing tests to reflect renamed methods and new endpoint paths.

Original prompt

This section details on the original issue you should resolve

<issue_title>Integrate AI-Agents Service Client</issue_title>
<issue_description>- HTTP client configured to communicate with ai-agents service

  • Integrate /route/search endpoint with ai-agents service
    • Update itinerary schema with optional (nullable) ai_description which we acquire using api/v1/insight/itinerary in get_itinerary_insight
    • Remove ai_description from RouteSearchResponse
    • Refactor get_route_insight to use proper nomenclature of get_leg_insight and api/v1/insight/leg route
  • Service client handles connection errors gracefully
  • Handles failures gracefully</issue_description>

<agent_instructions>Update tests accordingly</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@zlendo1 Closed with #30 @zlendo1 Wrongfully closed, reconfigured structure

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: zlendo1 <115471708+zlendo1@users.noreply.github.com>
Copilot AI changed the title [WIP] Integrate AI-Agents service client and update itinerary schema Refactor AI-Agents service integration: rename endpoints, move ai_description to Itinerary Oct 29, 2025
Copilot AI requested a review from zlendo1 October 29, 2025 14:21
@zlendo1 zlendo1 closed this Oct 29, 2025
@zlendo1 zlendo1 deleted the copilot/integrate-ai-agents-client branch October 30, 2025 12:14
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.

2 participants