Skip to content

Migrate to Langchain4j Agentic module, Langchain4j MCP client, and Azure AI Foundry infrastructure#36

Open
aveekr wants to merge 1 commit intomainfrom
feature/migrate-to-langchain-agentic
Open

Migrate to Langchain4j Agentic module, Langchain4j MCP client, and Azure AI Foundry infrastructure#36
aveekr wants to merge 1 commit intomainfrom
feature/migrate-to-langchain-agentic

Conversation

@aveekr
Copy link
Collaborator

@aveekr aveekr commented Feb 13, 2026

Summary

This PR migrates the banking assistant from a custom agent framework to the official langchain4j-agentic module, adopts the Langchain4j MCP client for tool integration, and updates the Azure infrastructure from OpenAI to Azure AI Foundry.

What Changed

1. Langchain4j Agentic Module

  • Replaced the custom agent framework (AbstractReActAgent, MCPToolAgent, manual ReAct loop) with the official langchain4j-agentic module (v1.10.0-beta18)
  • SupervisorAgent rewritten from a concrete class with manual routing to a declarative interface using @Agent, @SystemMessage, and AgenticScopeAccess
  • New builder classes (AccountMCPAgentBuilder, TransactionHistoryMCPAgentBuilder, PaymentMCPAgentBuilder, SupervisorAgentBuilder) encapsulate agent construction using AgenticServices
  • Supervisor uses SupervisorResponseStrategy.LAST for sub-agent orchestration
  • Agent prompts extracted to resource files under prompts/
  • ChatController updated from List<ChatMessage> invoke() to String chat(conversationId, message) with conversation memory via @MemoryId
  • Thought process extraction via AgenticScope for debugging visibility

2. Langchain4j MCP Client

  • Replaced custom MCP infrastructure (MCPToolAgent, MCPServerMetadata, MCPProtocolType) with official langchain4j-mcp client
  • Each agent builder wires McpToolProvider with HttpMcpTransport for SSE-based MCP server connections
  • Custom tools (e.g., InvoiceScanTool) integrated alongside MCP tools via .tools() builder method

3. Azure AI Foundry Infrastructure (Bicep)

  • Renamed all openAi* Bicep params/modules to foundry* to reflect Azure AI Foundry branding
  • Changed Cognitive Services kind from OpenAI to AIServices
  • Added allowProjectManagement: true and SystemAssigned managed identity
  • Upgraded API version to 2025-06-01
  • Default model updated to gpt-4.1 with GlobalStandard SKU
  • Added AZURE_OPENAI_ENDPOINT env var output for the copilot service

Files Deleted (Custom Framework)

  • AbstractReActAgent.java, Agent.java, AgentExecutionException.java, AgentMetadata.java
  • MCPToolAgent.java, MCPServerMetadata.java, MCPProtocolType.java
  • AccountMCPAgent.java, TransactionHistoryMCPAgent.java, PaymentMCPAgent.java

Files Added

  • 4 agent builder classes in langchain4j.agent.builder/
  • 5 prompt resource files in resources/prompts/
  • 3 documentation files in docs/

Breaking Changes

  • Agent API changed from List<ChatMessage> to String-based conversation with memory IDs
  • ChatAppRequest and ResponseChoice now include session_state for conversation continuity
  • Bicep parameter names changed from openAi* to foundry* — requires azd env updates if redeploying

Testing

  • All integration tests updated to use new builder pattern and chat() API

@aveekr aveekr requested a review from dantelmomsft as a code owner February 13, 2026 16:31
@aveekr
Copy link
Collaborator Author

aveekr commented Feb 13, 2026 via email

@aveekr
Copy link
Collaborator Author

aveekr commented Feb 13, 2026 via email

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