Skip to content

refactor: Complete migration from Semantic Kernel to LangChain framework#5

Open
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin/1758764665-semantic-kernel-to-langchain-migration
Open

refactor: Complete migration from Semantic Kernel to LangChain framework#5
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin/1758764665-semantic-kernel-to-langchain-migration

Conversation

@devin-ai-integration
Copy link

Description

This PR delivers a comprehensive migration of the entire Teal Agents repository from Semantic Kernel to LangChain framework. The migration preserves functional parity while adopting LangChain's architectural patterns and best practices for agent development. All existing tests pass with the new implementation.

Changes

  • Core Framework Migration:

    • Replaced semantic-kernel==1.33.0 with LangChain ecosystem packages (langchain, langchain-openai, langchain-community, langserve)
    • Converted KernelBuilder to ChainBuilder using LangChain chain composition
    • Migrated ChatCompletionAgent to AgentExecutor/Chain patterns
    • Updated ChatHistory to use LangChain's BaseChatMessageHistory
  • Plugin System Migration:

    • Transformed all @kernel_function decorators to LangChain @tool decorators
    • Updated plugin classes to use LangChain's tool invocation patterns
    • Migrated plugin state handling to LangChain patterns
  • Integration & Services:

    • Updated chat completion factories to use LangChain providers
    • Migrated OpenAPI integration from Semantic Kernel to LangChain OpenAPI patterns
    • Maintained API compatibility for all external endpoints
  • Testing & Quality:

    • Updated all 162 tests to work with LangChain patterns
    • Fixed linting issues across migrated code
    • All tests passing with new implementation

Type of Change

  • Refactor
  • Bugfix
  • New feature
  • Documentation
  • Other

Human Review Checklist

  • Verify that all external API contracts are maintained
  • Check that HITL (Human In The Loop) interventions still work correctly
  • Confirm that tool execution maintains same behavior
  • Review chat history handling for correctness
  • Check performance characteristics of new implementation

Additional Comments

This migration represents a significant architectural shift while maintaining functional parity. The key technical mappings implemented:

  • semantic_kernel.kernel.Kernel → LangChain Chain composition
  • @kernel_function@tool decorator
  • ChatCompletionAgent → LangChain AgentExecutor
  • ChatHistory → LangChain BaseChatMessageHistory
  • KernelBaseModel → Standard Pydantic BaseModel

Link to Devin run: https://app.devin.ai/sessions/1f2f4889f09e42028180bdc02dbccbea
Requested by: michael.turnbach@merck.com

- Replace semantic-kernel dependency with langchain ecosystem packages
- Migrate core framework: KernelBuilder → ChainBuilder, @kernel_function → @tool
- Convert agent execution from ChatCompletionAgent to AgentExecutor/Chain patterns
- Update chat completion factories to use LangChain providers
- Migrate plugin system from Semantic Kernel to LangChain tools
- Replace ChatHistory with BaseChatMessageHistory/InMemoryChatMessageHistory
- Update all orchestrator components and demo configurations
- Maintain API contract compatibility and external interface consistency
- All 162 tests passing with new LangChain implementation
- Zero lint errors remaining after comprehensive code cleanup

Migration scope:
- src/sk-agents/: Core agent framework and utilities
- src/orchestrators/: All orchestrator examples and plugins
- shared/ska_utils/: Shared utility components
- tests/: Complete test suite updated for LangChain patterns

Technical mappings:
- semantic_kernel.kernel.Kernel → LangChain Chain composition
- @kernel_function → @tool decorator
- ChatCompletionAgent → AgentExecutor
- ChatHistory → BaseChatMessageHistory
- KernelBaseModel → Standard Pydantic BaseModel
- Plugin execution → Tool invocation patterns

Co-Authored-By: michael.turnbach@merck.com <michael.turnbach@merck.com>
@devin-ai-integration
Copy link
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

- Convert all demo configs from apiVersion: skagents/v1 to langchain/v1
- Update University agent config to use LangChain AgentExecutor pattern
- Migrate plugin references and model configurations
- Maintain compatibility with existing input/output types
- Complete configuration schema migration across all demos

Co-Authored-By: michael.turnbach@merck.com <michael.turnbach@merck.com>
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.

0 participants

Comments