plexus.cli.procedure.test_ai_mcp_integration module
Comprehensive end-to-end test for AI + MCP integration in experiments.
This test validates that: 1. MCP transport works with all Plexus tools 2. LangChain can successfully use MCP tools 3. AI models can interact with real Plexus data 4. The complete procedure run workflow functions properly
- class plexus.cli.procedure.test_ai_mcp_integration.TestAIMCPIntegration
Bases:
objectTest class for AI + MCP integration.
- experiment_context()
Sample procedure context for testing.
- experiment_service(mock_client)
Create an procedure service with mock client.
- mock_client()
Create a mock client for testing.
- async test_error_handling_without_openai_key(experiment_context)
Test proper error handling when OpenAI key is not available.
- async test_full_experiment_run_with_ai_mocked(mock_client, experiment_context)
Test the full procedure run workflow with mocked AI.
- async test_langchain_adapter_loads_tools(experiment_context)
Test that LangChain adapter can load MCP tools.
- async test_mcp_server_creation_with_plexus_tools(experiment_context)
Test that MCP server can be created with all Plexus tools.
- async test_mcp_tools_can_be_called(experiment_context)
Test that MCP tools can be called successfully.
- async test_mock_ai_execution_with_tools(experiment_context)
Test AI execution with mocked LangChain components.
- async test_procedure_ai_runner_setup(experiment_context)
Test that ProcedureSOPAgent can be set up properly.
- test_procedure_yaml_parsing()
Test that procedure YAML is properly parsed.
- async test_tool_execution_simulation(experiment_context)
Test that individual tools can be executed and return proper results.
- async plexus.cli.procedure.test_ai_mcp_integration.run_integration_test()
Run a comprehensive integration test manually. This can be called directly to test the system end-to-end.