Welcome to the Microsoft Semantic Kernel for Agentic AI repository! This resource is designed to help beginners leverage Semantic Kernel for building powerful AI agents.
To get started, you'll need the following:
-
FastAPI Framework
FastAPI is used to host Semantic Kernel components as a service, enabling interaction with the chatbot seamlessly. -
Gradio
Gradio helps in building a stunning and interactive chatbot interface. -
Azure OpenAI Compatibility
This project is crafted exclusively for Azure OpenAI subscribers. Semantic Kernel features used here strictly adhere to classes compatible with Azure OpenAI.
π Learn More
Curious to dive deeper? Explore the official documentation for the tools used in this project:
With Semantic Kernel Components
Welcome to the Test Case Management System, powered by Semantic Kernel! This framework combines cutting-edge AI capabilities with structured workflows, making it easy to create, review, and manage test cases collaboratively. Below, we break down the system's components and structure, showcasing how Semantic Kernel plays a pivotal role in enabling intelligent and dynamic behavior.
This project leverages Semantic Kernel's modular and extensible components, such as Kernel Functions, Agents, Plugins, and Strategies, to create an intelligent test case lifecycle management system.
Hereβs how the main Semantic Kernel components are utilized:
The backbone of the system is built on Chat Completion Agents, which enable dynamic and intelligent behavior. Each agent is instantiated with a service_id, specified instructions, and configurations (KernelArguments) to simulate specialized roles:
- Coordinator Kernel: Initializes the Coordinator with the ability to interact with the user and retrieve project details from GitHub.
- Developer Kernel: Focuses on the task of creating detailed test cases from requirements.
- Reviewer Kernel: Ensures validation and approval of test cases based on stringent criteria.
Kernel functions enable the execution of dynamic prompts and decisions:
- _create_kernel_with_chat_completion(): Generates a kernel instance that connects agents to AI-backed completion strategies.
- FunctionChoiceBehavior.Auto(): Automatically selects the most relevant agent to fulfill the next action.
The system operates through three key ChatCompletionAgents:
The Coordinator orchestrates initial interactions with the user by:
- Collecting requirements via structured conversation.
- Leveraging GitHubPlugin to fetch projects, files, and entities.
- Summarizing and presenting test cases for user review.
The Developer agent creates functional test case code:
- Uses the Arrange, Act, Assert methodology.
- Refines test cases iteratively based on Reviewer feedback.
The Reviewer agent is responsible for strict validation:
- Enforces mandatory inclusion of at least one negative test case.
- Approves or rejects test cases and provides feedback for refinement.
Plugins in Semantic Kernel enable external integrations and efficient task execution.
- Integrated to analyze and retrieve projects, files, and entities directly from GitHub.
- Facilitates interaction between user inputs and real-world repositories.
- Handles final output summaries through collaboration among multiple agents, pulling insights from the entire agent-driven conversation.
- Saves approved test case code in the desired format using the appropriate file extension.
The KernelFunctionSelectionStrategy dynamically chooses which agent takes the next turn based on the conversational history:
- User interactions initiate the Developer agent.
- Feedback cycles alternate between Developer and Reviewer until the test case code is approved.
The ApprovalTerminationStrategy determines when the workflow completes:
- Ends the loop once the Reviewer evaluates the test case and marks it as "Reviewed."
- Prevents infinite iterations by limiting the maximum number of cycles.
The FunctionChoiceBehavior ensures agents execute their roles autonomously using AI-powered decision-making.
The AgentGroupChat facilitates dynamic collaboration among the three agents:
- User requirements are gathered by the Coordinator.
- The Developer creates test case code based on these requirements.
- The Reviewer validates and approves the test cases.
- Iterative cycles continue until the test case code is finalized, approved by the Reviewer, and saved.
The selection rules embedded in the Kernel Function ensure an organized turn-based conversation flow between agents based on the semantic history of their interactions.
The process intelligently terminates once the Reviewer approves the test case and outputs the finalized code.
- Use
get_tc_manager()
to launch the Coordinator agent. - Captures user requirements via structured conversation.
- Interacts with GitHub repositories using GitHub Plugin.
- Instantiate Developer and Reviewer agents (
get_developer()
andget_reviewer()
). - Generate dynamic group chat (
get_group_agent()
) to execute turn-based collaboration.
- Use the
invoke_save()
function in theGroupChatPlugin
to persist approved test case code in desired formats and filenames.
Agents use prompt-based instructions embedded in the kernel. For instance, the Developer prompt illustrates constructing test cases using the Arrange-Act-Assert structure.
Each agent behaves intelligently based on its specific design:
- Developer produces code aligned with user requirements.
- Reviewer enforces constraints such as mandatory negative tests.
- Coordinator organizes user feedback into actionable insights.
Plugins, such as the GitHub Plugin and Save Plugin, extend functionality by enabling rich repositories integration and seamless file export.
This system is designed for modularity and extensibility:
- Add additional agents for specialized roles (e.g., Security test creation).
- Enhance Reviewer criteria for more stringent validations.
- Integrate CI/CD pipelines to automatically execute saved test cases.
- Expand plugins for tools like JIRA, Slack, or Azure DevOps.
- Create plugins to integreate the Unit test case with your source code.
- Semantic Kernel:
Enables prompt engineering, function selection, agent orchestration, and dynamic AI-backed workflows. - GitHub Plugin:
Integrates with GitHub APIs for repository analysis. - Python Async Framework:
FastAPI Ensures efficient and scalable asynchronous execution. - Gradio Chatbot:
Helps user to interact with the Agents.
Clone the repo, pip install the requirements and refer the video to progress
https://www.youtube.com/watch?v=OwgAvdYUArA
This system demonstrates the power of Semantic Kernel in enabling intelligent multi-agent collaboration for complex tasks like test case creation and management. Join me in making software testing smarter, faster, and more collaborative! π